This is a short overview about using network boot for s390x.
The network boot feature enhances the s390x ipl device and the s390-ccw bios with support for booting via a virtio-net boot device. A new address is added to the ccw ipl block providing the address of a s390-netboot.img which performs the actual load over the network. This code has been included into QEMU since 2.9.
A s390-netboot.img can be built by bundling some shell scripts, busybox and the kexec binary bundled into an initial ramdisk and append that to a kernel image. An existing s390 system can be used as source.
The init process can be a simple shell script that mounts a few essential filesystems, like /dev, /proc, /sys, ..., starts a DHCP client (busybox udchpc) and then invokes another script to do the actual network boot.
udchpc will invoke the script /usr/share/udhcpc/default.script in response to DHCP server messages to configure interfaces. The sample busybox default.script can be used for that, but needs to also extract the DHCP options like the tftp server address and pass that on to the boot script.
The boot script itself has to retrieve the PXELINUX configuration from the tftp server as in , then retrieve the remote kernel and initial ramdisk and finally use kexec to boot the network kernel.
In a nutshell:
- Create a skeleton initramfs directory structure
- Create the init script, the PXE boot scripts and the DHCP default script
- Copy kexec and its dependencies from the source system into the initramfs
- Copy virtio network and block modules from the source system into the initramfs
- Copy the busybox binaries into the initramfs
- Build the ramdisk (in compressed CPIO format)
- Concatenate the kernel image and the initial ramdisk
- Update the 8 bytes at location 66568 with the offset value of the ramdisk in the new binary, and the 8 bytes at location 66576 with the size of the ramdisk. Both values need to be updated in binary, big endian format.