Files
warewulf/etc/grub/grub.cfg.ww
Jonathon Anderson fb9f269fc5 Update ipxe and grub configuration for clarity #1156
Also:

- Defined a menu for iPXE
- Support a IPXEMenuEntry tag to select the boot method
- Merge iPXE dracut support into default.ipxe (use IPXEMenuEntry=dracut)

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-02-17 02:31:05 -07:00

183 lines
4.5 KiB
Plaintext

echo
echo "Warewulf v4 (GRUB)"
echo
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
{{- if not .ImageName }}
echo "!!"
echo "!! No image defined for {{.Fqdn}}."
echo "!! Rebooting in 30s...
echo "!!"
sleep 30
reboot
{{- end }}
echo "Reading asset key..."
smbios --type 3 --get-string 8 --set assetkey
uri="(http,{{.Ipaddr}}:{{.Port}})/provision/${net_default_mac}?assetkey=${assetkey}"
kernel="${uri}&stage=kernel"
set default={{ or .Tags.GrubMenuEntry "single-stage" }}
set timeout=2
menuentry "Single-stage boot" --id single-stage {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}}
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Downloading images..."
image="${uri}&stage=image&compress=gz"
system="${uri}&stage=system&compress=gz"
runtime="${uri}&stage=runtime&compress=gz"
initrd $image $system $runtime
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load images."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Booting..."
boot
}
menuentry "Single-stage boot (no compression)" --id single-stage-nocompress {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}}
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Downloading images..."
image="${uri}&stage=image"
system="${uri}&stage=system"
runtime="${uri}&stage=runtime"
initrd $image $system $runtime
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load images."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Booting..."
boot
}
menuentry "Two stage boot with dracut" --id dracut {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
initramfs="${uri}&stage=initramfs"
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}"
net_args="rd.neednet=1 {{range $devname, $netdev := .NetDevs}}{{if and $netdev.Hwaddr $netdev.Device}} ifname={{$netdev.Device}}:{{$netdev.Hwaddr}} {{end}}{{end}}"
wwinit_args="root=wwinit wwinit.uri=${wwinit_uri} init=/init"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}} $net_args $wwinit_args
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Downloading initramfs..."
initrd $initramfs
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load initramfs."
echo "!! Rebooting in 15s..."
echo "!!"
fi
echo "Booting..."
boot
}
menuentry "UEFI Firmware Settings" --id "uefi-firmware" {
fwsetup
}
menuentry "System restart" {
echo "System rebooting..."
reboot
}
menuentry "System shutdown" {
echo "System shutting down..."
halt
}