[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.
This commit is contained in:
Michael Brown
2009-02-24 05:51:21 +00:00
parent 43834f5d25
commit 4f3bab1a55
6 changed files with 32 additions and 20 deletions

View File

@@ -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() )