The actual use of this extension is still in development and the log files are not currently publicly visible, but it may still be useful for people to know the what and why.
The Debian ARMMP kernel can be used for multiple devices, just changing the DTB. I've already done tests with this for Cubietruck and Beaglebone-Black, iMX.53 was one of the original test devices too. Whilst these tests can deploy a full image (there are examples of building such images in the vmdebootstrap), it is a lot quicker to do simple tests of a kernel using a ramdisk. The default Debian initramfs has a focused objective but still forms a useful base for extension. In particular, I want to be able to test one initramfs on multiple boards (so multiple dtbs) with the same kernel image. I then want to be able, on selected boards, to mount a SATA drive or write an image to eMMC or a USB stick or whatever. LAVA (via the ongoing refactoring, not necessarily in the current dispatcher code) can automate such tests, e.g. to allow me to boot a Cubietruck into a standard Debian ARMMP armhf install on the SATA drive but using a modified (or updated) ARMMP kernel over TFTP without needing to install it on the device itself. That same kernel image can then be tested on multiple boards to see if the changes have benefitted one board at the expense of another. Automating all of that could be of a lot of benefit to the ARM kernel developers in Debian and outside Debian.
So, the start point. Install Debian onto a Cubietruck & in my case, with a SATA drive attached. All well and good so far, standard Debian Jessie ARMMP. (Cubietruck uses the LPAE kernel flavour but that won't matter for the initramfs.)
Rather than building the initramfs manually, this provides a shortcut & at some point I may investigate how to do this in QEMU but for now, it's just as quick to SSH onto the Cubietruck and update.
I've already written a little script to download the relevant linux-image package for ARMMP, unpack it and pull out the vmlinuz, the dtbs and a selected list of modules. The list is selective because TFTP has a 32Mb download limit and there are more modules than that. So I borrowed a snippet from the Xen folks (already shown previously here).
The script is in a support repository for LAVA but can be used anywhere. (You'll need to edit the package name in the script to choose between ARMMP and ARMMP LPAE.
Get a working initramfs from an installed device running Debian ARMMP and copy some files for use later.
use the name of the symlink in the copy so that the file in /tmp/ is the actual file, using the name of the symlink as the filename. This is important later as it saves a step of having to make the (unnecessary) symlink inside the initramfs. Also, mkinitramfs, which built this initrd.img file in the first place, uses the same shared libraries as the main system, so copying these into the initramfs still works. (This is really useful when you get your ramdisk to support the attached secondary storage, allowing you to simply mount the original Debian install and fixup the initramfs by copying files off the main Debian install.) The relevant files are to support DNS lookup inside the initramfs which then allows a test to download a new image to put onto the attached media before rebooting into it.
cp /boot/initrd.img-3.16.0-4-armmp-lpae /tmp/ cp /lib/arm-linux-gnueabihf/libresolv.so.2 /tmp/ cp /mnt/lib/arm-linux-gnueabihf/libnss_dns.so.2 /tmp/
Copy these off the device for local adjustment:
scp IP_ADDR:/tmp/FILE .
Decompress the initrd.img:
cp initrd.img-3.16.0-4-armmp-lpae initrd.img-3.16.0-4-armmp-lpae.gzip gunzip initrd.img-3.16.0-4-armmp-lpae.gzip
Make a new empty directory:
mkdir initramfs cd initramfs
sudo cpio -id < initrd.img-3.16.0-4-armmp-lpae
Remove the old modules (LAVA can add these later, allowing tests to use an updated build with updated modules):
sudo rm -rf ./lib/modules/*
Start to customise - need a script for udhcpc and two of the libraries from the installed system to allow the initramfs to do DNS lookups successfully:
cp ../libresolv.so.2 ./lib/arm-linux-gnueabihf/ cp ../libnss_dns.so.2 ./lib/arm-linux-gnueabihf/
Copy the udhcpc default script into place:
mkdir ./etc/udhcpc/ sudo cp ../udhcpc.d ./etc/udhcpc/default.script sudo chmod 0755 ./etc/udhcpc/default.script
Rebuild the cpio archive:
find . | cpio -H newc -o > ../initrd.img-armmp.cpio
cd .. gzip initrd.img-armmp.cpio
If using u-boot, add the UBoot header:
mkimage -A arm -T ramdisk -C none -d initrd.img-armmp.cpio.gz initrd.img-armmp.cpio.gz.u-boot
Checksum the final file so that you can check that against the LAVA logs:
Each type of device will need a set of modules modprobed before tests can start. With the refactoring code, I can use an inline YAML and use dmesg -n 5 to reduce the kernel message noise. The actual module names here are just those for the Cubietruck but by having these only in the job submission, it makes it easier to test particular combinations and requirements:
- dmesg -n 5 - lava-test-case udevadm --shell udevadm hwdb --update - lava-test-case depmod --shell depmod -a - lava-test-case sata-mod --shell modprobe -a stmmac ahci_sunxi sd_mod sg ext4 - lava-test-case ifconfig --shell ifconfig eth0 up - lava-test-case udhcpc --shell udhcpc - dmesg -n 7
In due course, this will be added to the main LAVA documentation to allow others to keep the initramfs up to date and to support further test development.