summaryrefslogtreecommitdiffstats
path: root/src/core/main.c
diff options
context:
space:
mode:
authorMichael Brown2009-02-16 01:28:30 +0100
committerMichael Brown2009-02-16 01:30:36 +0100
commit076154a1c6ca987f84450c0225c190c9cdd77c59 (patch)
treefbe8e2e7ccbd9de5f048894f9a58687df0c975de /src/core/main.c
parent[romprefix] Update ROM checksum even if PMM allocation fails (diff)
downloadipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.tar.gz
ipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.tar.xz
ipxe-076154a1c6ca987f84450c0225c190c9cdd77c59.zip
[image] Allow multiple embedded images
This patch extends the embedded image feature to allow multiple embedded images instead of just one. gPXE now always boots the first embedded image on startup instead of doing the hardcoded DHCP boot (aka autoboot). Based heavily upon a patch by Stefan Hajnoczi <stefanha@gmail.com>.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/main.c b/src/core/main.c
index e72b8c90..8d360c42 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -19,6 +19,7 @@ Literature dealing with the network protocols:
#include <gpxe/features.h>
#include <gpxe/shell.h>
#include <gpxe/shell_banner.h>
+#include <gpxe/image.h>
#include <usr/autoboot.h>
#include <config/general.h>
@@ -36,6 +37,7 @@ static struct feature features_end[0] __table_end ( struct feature, features );
*/
__asmcall int main ( void ) {
struct feature *feature;
+ struct image *image;
/* Some devices take an unreasonably long time to initialise */
printf ( PRODUCT_SHORT_NAME " initialising devices...\n" );
@@ -68,11 +70,16 @@ __asmcall int main ( void ) {
/* User wants shell; just give them a shell */
shell();
} else {
- /* User doesn't want shell; try booting. If booting
- * fails, offer a second chance to enter the shell for
- * diagnostics.
+ /* User doesn't want shell; load and execute the first
+ * image. If booting fails (i.e. if the image
+ * returns, or fails to execute), offer a second
+ * chance to enter the shell for diagnostics.
*/
- autoboot();
+ for_each_image ( image ) {
+ image_exec ( image );
+ break;
+ }
+
if ( shell_banner() )
shell();
}