summaryrefslogtreecommitdiffstats
path: root/src/arch/i386
diff options
context:
space:
mode:
authorMichael Brown2007-08-02 21:18:32 +0200
committerMichael Brown2007-08-02 21:18:32 +0200
commitd4947c05b27449b4320179d57028a0542fd1394f (patch)
treedc9732c85f3904d04c2d7addf511c01c99dfb7fd /src/arch/i386
parentAllowed zero-cost enforced ordering of features in startup banner (diff)
downloadipxe-d4947c05b27449b4320179d57028a0542fd1394f.tar.gz
ipxe-d4947c05b27449b4320179d57028a0542fd1394f.tar.xz
ipxe-d4947c05b27449b4320179d57028a0542fd1394f.zip
Allow images to hold references to the originating URI.
Some shuffling around of the image management code; this needs tidying up.
Diffstat (limited to 'src/arch/i386')
-rw-r--r--src/arch/i386/image/bzimage.c2
-rw-r--r--src/arch/i386/image/multiboot.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/arch/i386/image/bzimage.c b/src/arch/i386/image/bzimage.c
index 8a8b254b5..ad2a04cf8 100644
--- a/src/arch/i386/image/bzimage.c
+++ b/src/arch/i386/image/bzimage.c
@@ -190,7 +190,7 @@ static size_t bzimage_load_initrd ( struct image *image,
return 0;
/* Create cpio header before non-prebuilt images */
- if ( filename[0] ) {
+ if ( filename && filename[0] ) {
size_t name_len = ( strlen ( filename ) + 1 );
DBGC ( image, "bzImage %p inserting initrd %p as %s\n",
diff --git a/src/arch/i386/image/multiboot.c b/src/arch/i386/image/multiboot.c
index 76114130f..dfd872cb8 100644
--- a/src/arch/i386/image/multiboot.c
+++ b/src/arch/i386/image/multiboot.c
@@ -135,6 +135,7 @@ multiboot_build_module_list ( struct image *image,
unsigned int insert;
physaddr_t start;
physaddr_t end;
+ char *cmdline;
unsigned int i;
/* Add each image as a multiboot module */
@@ -169,7 +170,9 @@ multiboot_build_module_list ( struct image *image,
( ( count - insert ) * sizeof ( *module ) ));
module->mod_start = start;
module->mod_end = end;
- module->string = virt_to_phys ( module_image->cmdline);
+ cmdline = ( module_image->cmdline ?
+ module_image->cmdline : "" );
+ module->string = virt_to_phys ( cmdline );
module->reserved = 0;
/* We promise to page-align modules */
@@ -222,6 +225,7 @@ static struct multiboot_module __bss16_array ( mbmodules, [MAX_MODULES] );
*/
static int multiboot_exec ( struct image *image ) {
physaddr_t entry = image->priv.phys;
+ char *cmdline;
/* Populate multiboot information structure */
memset ( &mbinfo, 0, sizeof ( mbinfo ) );
@@ -229,7 +233,8 @@ static int multiboot_exec ( struct image *image ) {
MBI_FLAG_CMDLINE | MBI_FLAG_MODS );
multiboot_build_memmap ( image, &mbinfo, mbmemmap,
( sizeof(mbmemmap) / sizeof(mbmemmap[0]) ) );
- mbinfo.cmdline = virt_to_phys ( image->cmdline );
+ cmdline = ( image->cmdline ? image->cmdline : "" );
+ mbinfo.cmdline = virt_to_phys ( cmdline );
mbinfo.mods_count = multiboot_build_module_list ( image, mbmodules,
( sizeof(mbmodules) / sizeof(mbmodules[0]) ) );
mbinfo.mods_addr = virt_to_phys ( mbmodules );