Files
warewulf/etc/ipxe/dracut.ipxe
Jonathon Anderson 53dae60e20 New, optional dracut.ipxe configuration
dracut.ipxe boots an initramfs detected in the container image. This
required a few small changes to warewulfd and the wwinit overlay to
accommodate the dracut initramfs configuring the network interface
before wwinit:

- Include .NetDevs in the ipxe configuration template, so that dracut
  can configure interfaces with the correct names.

- Configure NetworkManager to not keep the initramfs configuration, in
  stead applying the configuration found by wwinit.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-06-06 03:20:09 -04:00

47 lines
1.6 KiB
Plaintext

#!ipxe
echo
echo ================================================================================
echo Warewulf v4 now booting via dracut: {{.Fqdn}} ({{.Hwaddr}})
echo
echo Container: {{.ContainerName}}
{{if .KernelOverride }}
echo Kernel: {{.KernelOverride}}
{{else}}
echo Kernel: {{.ContainerName}} (container default)
{{end}}
echo KernelArgs: {{.KernelArgs}}
echo
set uri http://{{.Ipaddr}}:{{.Port}}/provision/{{.Hwaddr}}?assetkey=${asset}&uuid=${uuid}
echo Warewulf Controller: {{.Ipaddr}}
echo Downloading Kernel Image:
kernel --name kernel ${uri}&stage=kernel || goto reboot
{{if ne .KernelOverride ""}}
echo Downloading Kernel Modules:
imgextract --name kmods ${uri}&stage=kmods&compress=gz || initrd --name kmods ${uri}&stage=kmods || goto reboot
set kernel_mods initrd=kmods
{{end}}
echo Downloading initramfs
initrd --name initramfs ${uri}&stage=initramfs || goto reboot
set dracut_net rd.neednet=1 {{range $devname, $netdev := .NetDevs}}{{if and $netdev.Hwaddr $netdev.Device}} ifname={{$netdev.Device}}:{{$netdev.Hwaddr}} {{end}}{{end}}
set dracut_wwinit root=wwinit wwinit.container=${uri}&stage=container&compress=gz wwinit.system=${uri}&stage=system&compress=gz wwinit.runtime=${uri}&stage=runtime&compress=gz {{if ne .KernelOverride ""}}wwinit.kmods=${uri}&stage=kmods&compress=gz{{end}} init=/init
echo Booting initramfs
#echo Network KernelArgs: ${dracut_net}
#echo Dracut wwinit KernelArgs: ${dracut_wwinit}
#sleep 15
boot kernel initrd=initramfs ${kernel_mods} ${dracut_net} ${dracut_wwinit} wwid={{.Hwaddr}} {{.KernelArgs}}
:reboot
echo
echo There was an error, rebooting in 15s...
echo
sleep 15
reboot