[ipxe-devel] how to edit kernel & initrd

Michael Brown mbrown at fensystems.co.uk
Mon Mar 11 12:13:38 UTC 2013


On Monday 11 Mar 2013 11:40:53 Leo Baltus wrote:
> The use case I had in mind was to have a couple of often used menu-
> selectable kernels & initrd's, select one of these and be able to edit
> all configuration lines (kernel & initrd), much like grub can.

You can do this quite easily, since iPXE's menus are constructed dynamically 
under control of the script.  Here's an example (with error handling omitted 
for clarity):

#!ipxe

set fedora_kernel http://my.web.server/fedora/vmlinuz
set fedora_initrd http://my.web.server/fedora/initrd.img
set fedora_cmdline selinux=0

set recovery_kernel http://my.web.server/ubuntu/vmlinuz
set recovery_initrd http://my.web.server/fedora/initrd.img
set recovery_cmdline console=ttyS0,115200n8 console=tty0 single

menu Select operating system
item --key f fedora Fedora
item --key r recovery Fedora (recovery mode)
choose os
set kernel ${${os}_kernel}
set initrd ${${os}_initrd}
set cmdline ${${os}_cmdline}

:edit
menu Edit boot parameters
item --key k kernel Kernel: ${kernel}
item --key i initrd Initrd: ${initrd}
item --key c cmdline Command line: ${cmdline}
item --default --key b boot Boot
choose action
iseq ${action} boot && goto boot ||
echo -n ${action}: ${}
read ${action}
goto edit

:boot
initrd ${initrd}
chain ${kernel} ${cmdline}

Michael



More information about the ipxe-devel mailing list