x86: fix to parse multiboot command line passed by latest grub
latest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
So xen + grub2 always loss the first option, because xen will skip the first option.
Usually, the module-name is not start with char [a-zA-Z], such as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added isalpha() test of the first char of module-name/option to function cmdline_cook(), try to handle both the old and new cmdline format.
xen/arch/x86/setup.c +2 -0
@@ -423,6 +423,8 @@ p = p ? :"" ;while ( *p ==' ' ) p++; +if (isalpha (*p)) +return p;while ( (*p !=' ' ) && (*p !='\0' ) ) p++;while ( *p ==' ' )
PATCH 1/1 x86: fix to parse multiboot command line passed by latest grub
latest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
So xen + grub2 always loss the first option, because xen will skip the first option.
Usually, the module-name is not start with char [a-zA-Z], such as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added isalpha() test of the first char of modulename/option to function cmdline_cook(), try to handle both the old and new cmdline format.
xen/arch/x86/setup.c +2 -0
@@ -423,6 +423,8 @@ p = p ? :"" ;while ( *p ==' ' ) p++; +if (isalpha (*p)) +return p;while ( (*p !=' ' ) && (*p !='\0' ) ) p++;while ( *p ==' ' )
Quoted 6 lines · Wei Yongjun
latest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
Quoted 8 lines
So xen + grub2 always loss the first option, because xen will skip the first option.
Usually, the module-name is not start with char [a-zA-Z], such as
/boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch addedisalpha()test of the first char of modulename/option to functioncmdline_cook(), try to handle both the old and new cmdline format.
Xen doesn't actually complain about unknown options, does it? So why not simply stop stripping the first option altogether? Under grub1 Xen will just ignore it and under grub2 it won't be passed in.
Ian.
Quoted 22 lines
Signed-off-by Wei Yongjun <[email protected]>xen/arch/x86/setup.c +2
-0@@ -423,6 +423,8 @@ p = p ? :"" ;while ( *p ==' ' ) p++; +if (isalpha (*p)) +return p;while ( (*p !=' ' ) && (*p !='\0' ) ) p++;while ( *p ==' ' )_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 18 lines · Ian Campbell
Quoted 6 lines · Wei Yongjun
latest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
Quoted 9 lines
So xen + grub2 always loss the first option, because xen will skip the first option.
Usually, the module-name is not start with char [a-zA-Z], such as
/boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch addedisalpha()test of the first char of modulename/option to functioncmdline_cook(), try to handle both the old and new cmdline format.
Quoted 4 lines
Xen doesn't actually complain about unknown options, does it? So why not simply stop stripping the first option altogether? Under grub1 Xen will just ignore it and under grub2 it won't be passed in.
That it is OK. But the module-name will pass to the dom0, the cmdline of dom0 like this
under grub1:
# cat /proc/cmdline /boot/vmlinuz-2.6.31.6-xen root=UUID=575f3be9-0a50-4d62-a36d-800e85a7aa70 ro console=tty0
Other way, I will send a patch as your advice^_^.
Thanks
Quoted 30 lines
Ian.
Quoted 22 lines
Signed-off-by Wei Yongjun <[email protected]>xen/arch/x86/setup.c +2
-0@@ -423,6 +423,8 @@ p = p ? :"" ;while ( *p ==' ' ) p++; +if (isalpha (*p)) +return p;while ( (*p !=' ' ) && (*p !='\0' ) ) p++;while ( *p ==' ' )_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH v2 1/1 x86: fix to parse multiboot command line passed by latest grub
In reply to Ian Campbelllatest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
So xen + grub2 always loss the first option, because xen will skip the first option.
Since xen doesn't actually complain about unknown options, so simply stop stripping the first option altogether, under grub1 Xen will just ignore it and under grub2 it won't be passed in.
xen/arch/x86/setup.c +0 -4
@@ -423,10 +423,6 @@ p = p ? :"" ;while ( *p ==' ' ) p++; -while ( (*p !=' ' ) && (*p !='\0' ) ) - p++; -while ( *p ==' ' ) - p++;return p; }
I recommend just sticking a dummy first arg when writing a command line for grub2, and living with it. Or get grub2 guys to give us a flag to detect this stupid compatibility breakage. I don't really want hacks like this.
-- Keir
Quoted 31 lines · Wei Yongjun
latest grub had changed to "don't pass filename in multiboot command line".
The old cmdline format is: "module-name options..." The new cmdline format is: "options..."
So xen + grub2 always loss the first option, because xen will skip the first option.
Usually, the module-name is not start with char [a-zA-Z], such as
/boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch addedisalpha()test of the first char of module-name/option to functioncmdline_cook(), try to handle both the old and new cmdline format.Signed-off-by Wei Yongjun <[email protected]>xen/arch/x86/setup.c +2
-0@@ -423,6 +423,8 @@ p = p ? :"" ;while ( *p ==' ' ) p++; +if (isalpha (*p)) +return p;while ( (*p !=' ' ) && (*p !='\0' ) ) p++;while ( *p ==' ' )
Quoted 2 lines · Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit :
I recommend just sticking a dummy first arg when writing a command line for grub2, and living with it.
That's what we did in GNU Mach.
Quoted 2 lines
Or get grub2 guys to give us a flag to detect
this stupid compatibility breakage.
They said multiboot never asserted anything about the command line and thus implementation were allowed to vary without notice. The rationale for grub's behavior change is that the user has to migrate from grub1 syntax to grub2 syntax anyway.
Quoted 1 line
I don't really want hacks like this.
It was out of question to commit things like this in GNU Mach as well :)
Samuel
Quoted 9 lines · Samuel Thibault
Quoted 2 lines · Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit :
Or get grub2 guys to give us a flag to detect
this stupid compatibility breakage.They said multiboot never asserted anything about the command line and thus implementation were allowed to vary without notice. The rationale for grub's behavior change is that the user has to migrate from grub1 syntax to grub2 syntax anyway.
They broke it because they could? :-)
Quoted 6 lines · Simon Horman, le Tue 08 Dec 2009 09:00:00 +1100, a écrit :
Quoted 5 lines · Samuel Thibault
Quoted 2 lines · Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit :
Or get grub2 guys to give us a flag to detect
this stupid compatibility breakage.
Quoted 6 lines
Quoted 4 lines
They said multiboot never asserted anything about the command line and thus implementation were allowed to vary without notice. The rationale for grub's behavior change is that the user has to migrate from grub1 syntax to grub2 syntax anyway.
They broke it because they could? :-)
Yes...
Samuel
Quoted 9 lines · Simon Horman
Quoted 7 lines
Quoted 2 lines
Or get grub2 guys to give us a flag to detect
this stupid compatibility breakage.They said multiboot never asserted anything about the command line and thus implementation were allowed to vary without notice. The rationale for grub's behavior change is that the user has to migrate from grub1 syntax to grub2 syntax anyway.
They broke it because they could? :-)
Yes, it's both stupid and arrogant. Oh well.
-- Keir