FS#13900 - [mkinitcpio] param acpi_osi does not provide whitespaces
Attached to Project:
Arch Linux
Opened by Sebastian Wiemer (syracus) - Saturday, 21 March 2009, 13:27 GMT
Last edited by Thomas Bächler (brain0) - Wednesday, 04 May 2011, 07:04 GMT
Opened by Sebastian Wiemer (syracus) - Saturday, 21 March 2009, 13:27 GMT
Last edited by Thomas Bächler (brain0) - Wednesday, 04 May 2011, 07:04 GMT
|
Details
Description:
Linux <host> 2.6.28-ARCH #1 SMP PREEMPT .... i686 VIA C7-M Processor 1600Mhz CentaurHauls GNU/Linux As of trying out a kernel workaround for hp 2133 mini to get apci cpu scaling working i tried a suggesten found in several forum threads. For that notebook with the most current bios version someone should try to give the kernel parameter acpi_osi="!Windows 2006" On reboot init stops with kernel panic complaining that 2006" is an invalid parameter option. Investigating further it seems that whitespaces are not supported. Neither masking with \<space> nor '_' works as expected. Not really sure if whitespaces should be allowed in kernel parameters, but it seems to work with several other distros (ubuntu, fedora, mint). Maybe this is further more related to grub than kernel. Sorry if this report is categorized the wrong way. Additional info: * package version(s) * config and/or log files etc. Steps to reproduce: Just add acpi_osi="!Windows 2006" to kernel parameter line in /boot/grub/menu.lst (regardless if after or before ro) and reboot |
This task depends upon
Closed by Thomas Bächler (brain0)
Wednesday, 04 May 2011, 07:04 GMT
Reason for closing: Fixed
Additional comments about closing: mkinitcpio 0.6.11
Wednesday, 04 May 2011, 07:04 GMT
Reason for closing: Fixed
Additional comments about closing: mkinitcpio 0.6.11
there is a for loop processing the kernel command line args in the initrd's /bin/init script:
for cmd in ${CMDLINE}; do
case "${cmd}" in
\#*) break ;; # ignore everything after a # in the commandline
# The kernel passes those to the kernel on its own
[0123456Ss]) ;;
single) ;;
#Allow "init=X" to pass-through
init=*) kinit_params="${kinit_params} ${cmd}" ;;
# only export stuff that does work with dash :)
*=*) cmd="$(replace -s= "${cmd}" '.' '_')"
cmd="$(replace -s= "${cmd}" '-' '_')"
export "${cmd}"
;;
*) cmd="$(replace "${cmd}" '.' '_')"
cmd="$(replace "${cmd}" '-' '_')"
export "${cmd}=y"
;;
esac
done
the shell chops
acpi_osi="!Windows
and
2006"
into two separate arguments and get processed by the last two (respectively) case matches.
for acpi_osi="!Windows this works (although is useless)
but for 2006" this does not work (it attempts to export an environment variable with the name 2006" which isn't allowed)
the solution here is already there: the #* match that breaks from the loop so you can insert that prior to the acpi_osi variable.
here is my grub entry as an example:
title Arch
root (hd0,3)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/..... ro vga=773 # acpi_osi="!Windows 2006"
initrd /boot/kernel26.img
the kernel will still process this argument but that shell loop will not.
Please help :-)
cheers
# set
CMDLINE='root=/dev/disk/by-uuid/4ad49bf5-f44a-4116-8164-704bcecc5c59 ro console=ttyS0 acpi_osi="!Windows 2006" break=y'
...
acpi_osi='"!Windows'
...
Also attached how look a sample command line.
env.example.txt (0.5 KiB)
env.example2.txt (0.6 KiB)
I was thinking about a different approach: What if we only try to export things that are actually of interest to us and ignore the rest? No idea how to do that yet, but: we are not at all interested in the value of acpi_osi or most of the other stuff passed to the kernel. Basically, we want to know rw, ro, root=, cryptdevice=, crypto= (deprecated), cryptkey=, resume=, break= and very few more that I don't remember now.
IMO, there is no point in adding support for parsing a variable that we will just ignore anyway.
# kernel commandline parsing
for o in $(cat /proc/cmdline); do
key="${o%%=*}"
key="${key//-/_}"
if [ "${key%.*}" != "${key}" ]; then # module parameter
add_module_param "${key%.*}" "${o#*.}"
else
# environment variable
# set local variables too, in case somehow the kernel does not do this correctly
value="${o#*=}"
value=${value:=1}
eval cmd_$key="${value}"
eval $key="${value}" 2> /dev/null
fi
done
I don't think they ignore this problem too.
No problem.
About only accept needed params, is interesting. Something like: init script with a dynamic and configurable parameters via each install conf hook. So can have a file like ""/init_acepted_parameters"" generated by mkinitcpio. (If and only if is not much complicated with ash :P)