Features/S390xNetworkBoot: Difference between revisions

From QEMU
Line 4: Line 4:


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.
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.
Starting with 2.10 QEMU includes a pre-built s390-netboot.img based on the SLOF firmware, enabling network booting from a DHCP/TFTP server


== Building s390-netboot.img ==
== Building s390-netboot.img ==

Revision as of 12:12, 12 September 2017

This is a short overview about using network boot for s390x.

Overview

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.

Starting with 2.10 QEMU includes a pre-built s390-netboot.img based on the SLOF firmware, enabling network booting from a DHCP/TFTP server

Building s390-netboot.img

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 [1], then retrieve the remote kernel and initial ramdisk and finally use kexec to boot the network kernel.

In a nutshell:

  1. Create a skeleton initramfs directory structure
  2. Create the init script, the PXE boot scripts and the DHCP default script
  3. Copy kexec and its dependencies from the source system into the initramfs
  4. Copy virtio network and block modules from the source system into the initramfs
  5. Copy the busybox binaries into the initramfs
  6. Build the ramdisk (in compressed CPIO format)
  7. Concatenate the kernel image and the initial ramdisk
  8. 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.