PXE Grub and All in One Images

So one little advertised feature of grub is grub-mkstandalone. Over the past week I have been playing with grub-mkstandalone to create grub.efi for a new board. We had an issue that the default grub with CentOS 7 performs badly on some EFI firmware when using tftp and it suddenly occured to me that grub-mkstandalone allows you to put file into the grub.efi itself.

So for the arm64 server I was working on.

grub-mkstandalone -O arm64-efi -o grub.efi boot/grub/grub.cfg Image

The contect of the boot/grub/grub.cfg

set timeout=5

menuentry 'Centos Image' --class os {
echo 'Loading Linux ...'
linux (memdisk)/Image earlycon=uart8250,mmio32,0x80300000 console=ttyS0,115200 acpi=force ip=dhcp root=/dev/nfs nfsroot=xxx.xxx.xxx.xxx:/srv/nfs/centos rw

# echo 'Loading initial ramdisk ...'
# initrd (tftp)/boot/initrd
}

And can now load Image without using the tftp implementation in grub 😀