Setup an alternative to NFS Boot for Automated QA

Description

NFS doesn't support extended attributes out of the box. So when we'll activate security at the filesystem level (using LSM like SMACK or selinux), we won't be able to boot over NFS.

The base idea to solve this is to use alternative protocols to connect block
devices through network, getting rid of filesystem, permissions, attribs etc.. Some candidates:

  • NBD / DRBD

  • iSCSI

  • AoE (ATA over Eth)

  • ...

Ideas: we won't get any vanilla support for booting on such devices in the

kernel AFAIK. So we'll need to push an initrd that will mount the rootfs
then 'pivot_root' on it, as usually done for example when one wants to
mount a rootfs on a RAID5 volume.
We could expect to have an AGL network image which could be built on top of the
usual image, with a few extra steps to assemble an initramfs (kernel config
would also require some extra features)

Environment

AGL QA on "real" boards (Porter, Minnowboard, ...)

Activity

Show:

Jan-Simon Moeller August 1, 2016 at 8:27 AM

Works.

Stephane Desneux June 21, 2016 at 2:29 PM

Pushed a patch (https://gerrit.automotivelinux.org/gerrit/#/c/5829/) to support NBD devices in kernel.

Tested with latest snapshot (b299). the above procedure works.

This solves the problem for Minnowboard (but we still need the usb stick workaround due to problems with BIOS TFTP client).

Stephane Desneux June 7, 2016 at 5:01 PM

Today, I managed to boot the Minnowboard Max through network boot. the full boot doesn't work yet, but we're not far.

0. Environment
I made the AGL build in a Docker container for BSP, having IP address 10.20.1.129.

1. Update MinnowBoard MAX BIOS to latest 0.92 (OPTIONAL: this doesn't change anything !!!)
Follow the procedure here: https://firmware.intel.com/projects/minnowboard-max

2. Configure the DNS/TFTP server
I added something like this to my dnsmasq.conf, given that the DHCP/DNS server on my local domain is not the TFTP server hosted inside the build container.

dhcp-mac=set:minmax,00:13:20:*:*:* dhcp-boot=tag:minmax,intel-corei7-64/config.ipxe,tyrex,10.20.1.129

So I have an redirect for TFTP server (the 'next-server' in DHCP/BOOTP mechanism)

3. Create the config.ipxe file in the images deployment dir:
.../build/tmp/deploy/images/intel-corei7-64/config.ipxe:

#!ipxe kernel bzImage initrd initramfs-netboot-image-intel-corei7-64.ext4.gz boot bzImage initrd=initramfs-netboot-image-intel-corei7-64.ext4.gz rw rootfstype=ext4 rootwait rootdelay=2 root=/dev/ram0 ramdisk_size=16384 ip=dhcp nbd.server=${next-server} splash

4. Create a USB key (vfat), containing IPXE.efi and startup.nsh

$ git clone git://git.ipxe.org/ipxe $ cd ipxe/src $ make bin-x86_64-efi/ipxe.efi $ cp bin-x86_64-efi/ipxe.efi [your_usb_stick] $ echo "ipxe.efi" >[your_usb_stick]/startup.nsh

5. Inside the build container, run the tftp server and xnbd-server using the "usual" commands (the same as the ones for other boards, like porter). See README in meta-netboot.
Note that the TFTP server root directory is ...tmp/deploy/images directory.

6. Insert the USB key into the minnowboard

  • turn on the board

  • it should first load ipxe.efi automatically

  • then a dhcp request is done to init the network interface

  • then a tftp request is done to retrieve config.ipxe

  • the script starts by downloading the kernel through TFTP

  • then downloads the initrd

  • and finally boots the kernel with initrd and options to mount NBD rootfs

Everything runs perfectly and I get the "AGL Netboot" banner, indicating that the initrd is loading fine. But everything stops.... simply because NBD support is not enabled in Minnowboard kernel This is the next step...

Stephane Desneux May 24, 2016 at 9:32 AM

Thanks to , I pushed a new patchset which doesn't override the busybox configuration but rather adds a configuration fragment to enable NBD. This way, the other configuration directives coming from other layers are still used.

Stephane Desneux May 23, 2016 at 4:07 PM

I updated meta-netboot to provide a more "standard" layer.conf and a new netboot.bbclass. This way, adding the meta-netboot layer does almost nothing (only busybox config is modified) and the user must add INHERIT+="netboot" explicitely in conf/local.conf

Also, the class tries to handle 3 cases:

  • old uboot image, with initramfs in uImage format (for porter board in particular)

  • new uboot image, with initramfs in ext4.gz format (for some other ARM boards)

  • live image, with initrd (for minnowboard max)

Please review https://gerrit.automotivelinux.org/gerrit/#/c/5633/

Fixed

Details

Assignee

Reporter

Fix versions

Labels

Priority

Created April 18, 2016 at 12:02 PM
Updated August 8, 2016 at 12:08 AM
Resolved August 1, 2016 at 8:27 AM