diff options
author | Michael Brown | 2011-06-28 12:29:28 +0200 |
---|---|---|
committer | Michael Brown | 2011-06-28 12:33:39 +0200 |
commit | be600ed9967d93f5012d5277d7ce8ce89d135918 (patch) | |
tree | 313c8c1910343570a739f2ea019022b12beb5f2e /src | |
parent | [ipv4] Record ARP resolution errors (diff) | |
download | ipxe-be600ed9967d93f5012d5277d7ce8ce89d135918.tar.gz ipxe-be600ed9967d93f5012d5277d7ce8ce89d135918.tar.xz ipxe-be600ed9967d93f5012d5277d7ce8ce89d135918.zip |
[prefix] Cope with BOOT_IMAGE= anywhere within command line
Some bootloaders seem to add "BOOT_IMAGE=..." at the end of the
command line; some at the start. Cope with either variation.
Reported-by: Dave Hansen <dave@sr71.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/i386/core/cmdline.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/arch/i386/core/cmdline.c b/src/arch/i386/core/cmdline.c index fa5adb8c..595fdada 100644 --- a/src/arch/i386/core/cmdline.c +++ b/src/arch/i386/core/cmdline.c @@ -66,7 +66,8 @@ static void cmdline_init ( void ) { struct image *image = &cmdline_image; userptr_t cmdline_user; char *cmdline; - char *tmp; + char *boot_image; + char *boot_image_end; size_t len; /* Do nothing if no command line was specified */ @@ -91,9 +92,18 @@ static void cmdline_init ( void ) { /* Check for unwanted cruft in the command line */ while ( isspace ( *cmdline ) ) cmdline++; - if ( ( tmp = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL ) { - DBGC ( image, "CMDLINE stripping \"%s\"\n", tmp ); - *tmp = '\0'; + if ( ( boot_image = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL ) { + boot_image_end = strchr ( boot_image, ' ' ); + if ( boot_image_end ) { + *boot_image_end = '\0'; + DBGC ( image, "CMDLINE stripping \"%s\"\n", + boot_image ); + strcpy ( boot_image, ( boot_image_end + 1 ) ); + } else { + DBGC ( image, "CMDLINE stripping \"%s\"\n", + boot_image ); + *boot_image = '\0'; + } } DBGC ( image, "CMDLINE using \"%s\"\n", cmdline ); |