← Back to team overview

sony-vaio-z-series team mailing list archive

Re: grub2 and acpi_osi

 

Hello Norbert,

Am Freitag, den 09.10.2009, 07:40 +0200 schrieb Norbert Preining:
> On Fr, 09 Okt 2009, Raphael Gradenwitz wrote:
> > The *Quotes* are not part of the argument but the *Space* between
> > Windows and 2006 is.
> > 
> > And /proc/cmdline is parsed in a way like:
> > 
> > for ARG in $(cat /proc/cmdline)
> > do
> >     echo "${ARG}"|grep -q "=" && ${ARG%=*}=${ARG##*=}
> > done
> 
> I don't get that!!??? The kernel does not use shell to parse the
> cmdline args,

Of course not, I wrote 'in a way like' meant as 'pseudo code'

>  they are passed INTO the kernel from the grub 
> loader via putting the different argumetns onto the stack
> before jumping to the kernel entry point.

They are passed as string. But even though, it does not change the
message I wanted to provide with my example. I am a C programmer, I know
that the kernel does not speak shell script. The Kernel does not speak
english to but we do ;-)

> 
> The kernel afterwards puts the arguments as read from the stack into
> some place to be shown in /proc/cmdline, but it never evaluates them
> in the way you said.

That is exactly the point I wanted you to see: "As read from ..", you
wrote it, that means, if it reads

..
acpi_osi=!Windows 2006
..

then it would enter

.. acpi_osi="!Windows 2006" ..

in /proc/cmdline

if it reads

..
acpi_osi=!Windows
2006
..

than it enters

.. acpi_osi=!Windows 2006 ..

> 
> > and as you can see, that would result in
> > acpi_osi=!Windows
> > and 2006 wil be interpreted as a (not understood) alone standing word.
> 
> Yes that would be the case if some later shell scriupt has to parse
> the cmd line, but that is irrelevant since acpi_osi is a kernel
> parameter.

Ack.

> 
> > There is no way for the kernel other than "guessing" if the next word is
> > part of the argument and if not. OK, it could check the result with a
> 
> No. The way is simply what has been put on the execution stack.

The weak point here is

'what'

> 
> The *kernel* is not *reading* /proc/cmdline, it is showing
> us what the cmdline was with which it was called.

Exactly. That shows me what the kernel "understood".

.. acpi_osi="!Windows 2006" ..

or

.. acpi_osi=!Windows 2006 ..

See above.

> 
> > Is the led on the stamina-speed slider burning on your vaio after a
> > reboot? Even if your /proc/cmdline had the argument without quotes the
> > boot before?
> 
> Yes, and even the right one when I switch between the two modes.
> 
> > For me it does *not*.
> 
> Really strange.
> 
> > root=UUID=b4acd5c9-258f-47fc-8a8c-0f497f6f5137 ro splash vga=791 acpi_osi="!Windows 2006" acpi_backlight=vendor
> > 
> > and after a boot with grub2:
> > :~$ cat /proc/cmdline
> > root=UUID=b4acd5c9-258f-47fc-8a8c-0f497f6f5137 ro splash vga=791 acpi_osi=!Windows 2006 acpi_backlight=vendor
> 
> 
> Yes of course.

not "of course."

Please boot with grub legacy and check your /proc/cmdline and boot with
grub2 and check it again.

There is no 'of course' that it results diferent!

>  My view is:
> - grup puts these thing on the execution stack:
> 	root=UUID=b4acd5c9-258f-47fc-8a8c-0f497f6f5137
> 	ro
> 	splash
> 	vga=791
> 	acpi_osi=!Windows 2006
> 	 acpi_backlight=vendor
> - the kernel reads that in and evaluates the stuff.
> - then the kernel puts the args into a list:
> 	root=... ro splash vga=791 acpi_osi=!Windows 2006 ...
>   and exhibits that in /proc/cmdline.

but booting the same kernel with grub legacy works diferent?
That is everything but logic!

> 
> > When I boot with grub2 and edit the comandline in the grub shell by hand
> > puting a backslash in front of those quote-signs:
> > acpi_osi=\"!Windows 2006\"
> > than it works.
> 
> "works" for you means that it is shown as that in /proc/cmline, but
> that *does*not*count* at all!

But when I use grub legacy it is with quotes in /proc/cmdline and
everything works fine, using grub2 it is without quotes and the
functionality is stuck.

> 
> When I have more time I will hack the kernel to actually show me what
> his idea of cmd line is and show you the output.

It is not a kernel issue, it is a grub2 issue, since grub legacy works
fine.
I guess, that grub2 (at least the version I am using) removes the quotes
one step to early and provides no

        root=UUID=b4acd5c9-258f-47fc-8a8c-0f497f6f5137
        ro
        splash
        vga=791
        acpi_osi=!Windows 2006
        acpi_backlight=vendor

but:

        root=UUID=b4acd5c9-258f-47fc-8a8c-0f497f6f5137 
        ro
        splash
        vga=791
        acpi_osi=!Windows
        2006
        acpi_backlight=vendor

as arguments (at least in my case)

That results of course in wrong interpretation.
The fact that I can get things work by presetting backslashes makes me
think so.

Raphael
-- 
(Please post and/or answer >if possible< with
Reply-to: sony-vaio-z-series@xxxxxxxxxxxxxxxxxxx
Thanks)

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Follow ups

References