Andrew Hume
2008-Mar-26 13:07 UTC
[syslinux] passing parameters to the newly booted kernel
is it possible to pass parameters from a .cfg file to the newly booted kernel? my setup is pxelinux where the relevent config is label fbsd63 kernel memdisk append initrd=/freebsd6.3.hd harddisk what i would like to do is pass in some parameter so the booted kernel can behave differently. i've looked in teh archives without success, although i did see an elliptic reference to /proc/cmdline from within /linuxrc. i boot both freebsd and linux kernels, so answers for both would be welcome. ------------------ Andrew Hume (best -> Telework) +1 732-886-1886 andrew at research.att.com (Work) +1 973-360-8651 AT&T Labs - Research; member of USENIX and LOPSA
Luciano Rocha
2008-Mar-26 14:30 UTC
[syslinux] passing parameters to the newly booted kernel
On Wed, Mar 26, 2008 at 09:07:40AM -0400, Andrew Hume wrote:> is it possible to pass parameters from a .cfg file to the newly > booted kernel? > > my setup is pxelinux where the relevent config is > > label fbsd63 > kernel memdisk > append initrd=/freebsd6.3.hd harddisk > > what i would like to do is pass in some parameter so the booted > kernel can behave differently. > i've looked in teh archives without success, although i did see an > elliptic reference > to /proc/cmdline from within /linuxrc.All arguments to the kernel are accessible via /proc/cmdline. Also, unrecognized var=val arguments are passed in the environment to the boot process (/sbin/init, /init). Usually, I parse /proc/cmdline like this: cmd=" $(cat /proc/cmdline) " getval() { local val val="${cmd##* $1=}" [ "$val" != "$cmd" ] || return 1 echo "${val%% *}" } Then: root=$(getval root)> i boot both freebsd and linux kernels, so answers for both would be > welcome.Can't help you with freebsd, sorry. -- lfr 0/0
H. Peter Anvin
2008-Mar-26 15:50 UTC
[syslinux] passing parameters to the newly booted kernel
Andrew Hume wrote:> is it possible to pass parameters from a .cfg file to the newly > booted kernel? > > my setup is pxelinux where the relevent config is > > label fbsd63 > kernel memdisk > append initrd=/freebsd6.3.hd harddisk > > what i would like to do is pass in some parameter so the booted > kernel can behave differently. > i've looked in teh archives without success, although i did see an > elliptic reference to /proc/cmdline from within /linuxrc. > > i boot both freebsd and linux kernels, so answers for both would be > welcome. >Yes, although you don't want to use MEMDISK for it. If you boot the kernel "natively", you can pass arguments to it. I believe FreeBSD kernels are Multiboot images, so you can boot them via mboot.c32. Passing arguments to MEMDISK is possible too, but then the OS has to know about MEMDISK specifically. -hpa