[syslinux] passing parameters to the newly booted kernel

Luciano Rocha strange at nsk.no-ip.org
Wed Mar 26 07:30:02 PDT 2008


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




More information about the Syslinux mailing list