[arch-projects] [mkinitcpio] [RFC] Rewrite parse_cmdline (again)
thomas at archlinux.org
Fri Apr 15 04:06:55 EDT 2011
Am 15.04.2011 02:24, schrieb Dave Reisner:
> Yes, the idea is that the user is expected to escape their own
> whitespace, just as they are expected to do so in /etc/fstab.
You don't understand the problem at all: We cannot simply change the
format of the kernel command line as we wish.
I'll explain it to you as clearly as possible:
The kernel interprets A=B pairs on the command line, where B can be
double-quoted - as far as I am aware, the kernel does not interpret any
kind of escapes here, solely double quotes.
This is what the kernel does with them (as far as I figured it out so far):
(1) If the option A is recognized by any part of the kernel, B is passed
as the value of A to that part of the kernel. If we were to escape
characters inside it, it wouldn't understand the value anymore.
(2) If the option A is not recognized by the kernel, it is exported into
the initial environment (which is passed on to PID 1).
(3) If an option is not of the form A=B, but does not contain a =, the
option is parsed as an argument to init.
Sadly, some of the variables we need in early userspace are not exported
- this at least applies to root=, but there might be more (root= is
traditionally used by the kernel, so (1) applies to it). Therefore, we
need to parse the whole command line again.
Most of what we parse there is actually redundant - like the acpi_osi=
or video= options, which are never used in early userspace. However,
even if we omit setting those variables, we still need to parse them to
know where they end, in order to get all options from the command line.
What we MUST do is deal with the format the kernel command line has. I
didn't even understand your comments until now, because I would never
have thought your suggestion was that ridiculous.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 262 bytes
Desc: OpenPGP digital signature
More information about the arch-projects