summaryrefslogtreecommitdiffstats
path: root/src/core/main.c
diff options
context:
space:
mode:
authorMichael Brown2009-02-24 06:51:21 +0100
committerMichael Brown2009-02-24 06:57:56 +0100
commit4f3bab1a55359a2623e098a6ed61e8d82145af77 (patch)
tree9f12c983dd2846d5b5f2d0598d928db9add7c51b /src/core/main.c
parent[image] Added "chain" command to fetch, load, and execute image (diff)
downloadipxe-4f3bab1a55359a2623e098a6ed61e8d82145af77.tar.gz
ipxe-4f3bab1a55359a2623e098a6ed61e8d82145af77.tar.xz
ipxe-4f3bab1a55359a2623e098a6ed61e8d82145af77.zip
[image] Allow for zero embedded images
Having a default script containing #!gpxe autoboot can cause problems when entering commands to load and start a kernel manually; the default script image will still be present when the kernel is started and so will be treated as an initrd. It is possible to work around this by typing "imgfree" before any other commands, but this is counter-intuitive. Fix by allowing the embedded image list to be empty (in which case we just call autoboot()), and making this the default. Reported by alkisg@gmail.com.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 8d360c42..bd2428f0 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -71,13 +71,17 @@ __asmcall int main ( void ) {
shell();
} else {
/* 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.
+ * image, or autoboot() if we have no images. If
+ * booting fails for any reason, offer a second chance
+ * to enter the shell for diagnostics.
*/
- for_each_image ( image ) {
- image_exec ( image );
- break;
+ if ( have_images() ) {
+ for_each_image ( image ) {
+ image_exec ( image );
+ break;
+ }
+ } else {
+ autoboot();
}
if ( shell_banner() )