diff options
author | Michael Brown | 2009-02-24 06:51:21 +0100 |
---|---|---|
committer | Michael Brown | 2009-02-24 06:57:56 +0100 |
commit | 4f3bab1a55359a2623e098a6ed61e8d82145af77 (patch) | |
tree | 9f12c983dd2846d5b5f2d0598d928db9add7c51b /src/image/embedded.c | |
parent | [image] Added "chain" command to fetch, load, and execute image (diff) | |
download | ipxe-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/image/embedded.c')
-rw-r--r-- | src/image/embedded.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/image/embedded.c b/src/image/embedded.c index f76ca11b..4f763578 100644 --- a/src/image/embedded.c +++ b/src/image/embedded.c @@ -16,7 +16,8 @@ * * @v refcnt Reference counter */ -static void embedded_image_free ( struct refcnt *refcnt __unused ) { +static void __attribute__ (( unused )) +embedded_image_free ( struct refcnt *refcnt __unused ) { /* Do nothing */ } @@ -51,14 +52,18 @@ static struct image embedded_images[] = { * Register all embedded images */ static void embedded_init ( void ) { - unsigned int i; + int i; struct image *image; void *data; int rc; + /* Skip if we have no embedded images */ + if ( ! sizeof ( embedded_images ) ) + return; + /* Fix up data pointers and register images */ - for ( i = 0 ; i < ( sizeof ( embedded_images ) / - sizeof ( embedded_images[0] ) ) ; i++ ) { + for ( i = 0 ; i < ( int ) ( sizeof ( embedded_images ) / + sizeof ( embedded_images[0] ) ) ; i++ ) { image = &embedded_images[i]; /* virt_to_user() cannot be used in a static |