Skip to content

Commit

Permalink
[prefix] Cope with BOOT_IMAGE= anywhere within command line
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Jun 28, 2011
1 parent cc7c2a9 commit be600ed
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/arch/i386/core/cmdline.c
Expand Up @@ -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 */
Expand All @@ -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 );

Expand Down

0 comments on commit be600ed

Please sign in to comment.