probonopd
10/29/2018 - 7:18 PM

kernelci-local.md

Locally reproducing kernelci.org boots

Work in progress.

#!/bin/bash

# Let's say I want to recreate the boot described on
# https://kernelci.org/boot/id/5bd738a859b514802674be00/
# with my local hardware and an SD card

# On https://kernelci.org/boot/id/5bd738a859b514802674be00/ we see
# https://storage.kernelci.org/mainline/master/v4.19-9418-g9f51ae62c84a/arm/multi_v7_defconfig/zImage
# unfortunately there seems to be no way to get the second from the first

URL="https://storage.kernelci.org/mainline/master/v4.19-9418-g9f51ae62c84a/arm/multi_v7_defconfig/"
DIR=$(echo "$URL" | cut -d "/" -f 1-8)
BOOTLOG_URL="$DIR/lab-baylibre-seattle/boot-meson8b-odroidc1.txt"
wget "$BOOTLOG_URL" -O bootlog
grep -e "^odroidc#" bootlog | cut -d "#" -f 2-99 > commands

# Convert from tftp to sd commands
cat commands | sed -e 's|192.168.0.1:tmp/meson8b-.*/||g' | \
sed -e 's|tftp|fatload mmc 0:1|g' | \
sed -e 's|dhcp||g' | \
sed -e 's|setenv serverip.*||g'| \
sed -e 's|uImage-.*|uImage|g'| \
sed -e 's|initrd-.*|rootfs.cpio.gz|g'| \
sed -e 's|tmp_.*dtb|dtb.img|g'| \
sed '/^$/d'

# Get kernel
wget "$DIR/zImage"

# Get initrd (=rootfs)
wget "https://storage.kernelci.org/images/rootfs/buildroot/armel/rootfs.cpio.gz" # TODO: Don't hardcode armel

# Get modules
wget "$DIR/arm/multi_v7_defconfig/modules.tar.xz"

# Merge modules into initrd
# TODO: Figure out a good way to do this
# The easiest would be to load 2 .cpio.gz into the kernel? Is this possible?

# Get dtb
wget "$DIR/dtbs/meson8b-mxq.dtb" -O dtb.img

# TODO: Understand the different rootfs in
# https://storage.kernelci.org/images/rootfs/buildroot/armel/tests/
# (there also is one with Python included)