Skip to content

Commit be600ed

Browse files
committedJun 28, 2011
[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>
1 parent cc7c2a9 commit be600ed

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed
 

‎src/arch/i386/core/cmdline.c

+14-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ static void cmdline_init ( void ) {
6666
struct image *image = &cmdline_image;
6767
userptr_t cmdline_user;
6868
char *cmdline;
69-
char *tmp;
69+
char *boot_image;
70+
char *boot_image_end;
7071
size_t len;
7172

7273
/* Do nothing if no command line was specified */
@@ -91,9 +92,18 @@ static void cmdline_init ( void ) {
9192
/* Check for unwanted cruft in the command line */
9293
while ( isspace ( *cmdline ) )
9394
cmdline++;
94-
if ( ( tmp = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL ) {
95-
DBGC ( image, "CMDLINE stripping \"%s\"\n", tmp );
96-
*tmp = '\0';
95+
if ( ( boot_image = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL ) {
96+
boot_image_end = strchr ( boot_image, ' ' );
97+
if ( boot_image_end ) {
98+
*boot_image_end = '\0';
99+
DBGC ( image, "CMDLINE stripping \"%s\"\n",
100+
boot_image );
101+
strcpy ( boot_image, ( boot_image_end + 1 ) );
102+
} else {
103+
DBGC ( image, "CMDLINE stripping \"%s\"\n",
104+
boot_image );
105+
*boot_image = '\0';
106+
}
97107
}
98108
DBGC ( image, "CMDLINE using \"%s\"\n", cmdline );
99109

0 commit comments

Comments
 (0)