Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ jobs:
- ubuntu-latest
- ubuntu-24.04-arm

target:
- VM
- RPI

exclude:
# don't try to do raspi tests on amd64
- runner: ubuntu-latest
target: RPI
# don't do raspi tests on <= bookworm hosts, needs at least QEMU 9.x
- host_release: bookworm
target: RPI

# We want a working shell, qemu, python and docker. Specific version should not matter (much).
runs-on: ${{ matrix.runner }}

Expand All @@ -73,22 +85,24 @@ jobs:
name: "Setup test environment"

- run: ./tests/build-vm-and-test.sh run
name: "Build VM image using grml-debootstrap on host ${{matrix.host_release}} for ${{matrix.release}}"
name: "Build ${{matrix.target}} image using grml-debootstrap on host ${{matrix.host_release}} for ${{matrix.release}}"
env:
HOST_RELEASE: ${{matrix.host_release}}
RELEASE: ${{matrix.release}}
TARGET: ${{matrix.target}}

- run: ./tests/build-vm-and-test.sh test
id: build_vm_and_test_test
name: "Test built VM image for ${{matrix.release}}"
name: "Test built ${{matrix.target}} image for ${{matrix.release}}"
env:
RELEASE: ${{matrix.release}}
TARGET: ${{matrix.target}}

- name: Archive VM image on failure
uses: actions/upload-artifact@v6
if: always() && (steps.build_vm_and_test_test.outcome == 'failure')
with:
name: vm-image-${{matrix.host_release}}-${{matrix.release}}-${{matrix.runner}}
name: vm-image-${{matrix.host_release}}-${{matrix.release}}-${{matrix.runner}}-${{matrix.target}}
if-no-files-found: error
path: qemu.img
retention-days: 5
Expand All @@ -97,6 +111,6 @@ jobs:
uses: actions/upload-artifact@v6
if: always()
with:
name: vm-results-${{matrix.host_release}}-${{matrix.release}}-${{matrix.runner}}
name: vm-results-${{matrix.host_release}}-${{matrix.release}}-${{matrix.runner}}-${{matrix.target}}
if-no-files-found: error
path: tests/results/
30 changes: 29 additions & 1 deletion chroot-script
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ bash -n /etc/debootstrap/variables
[ -r /proc/1 ] || mount -t proc none /proc
[ -r /sys/kernel ] || mount -t sysfs none /sys

if [ -n "$RPIFIRM" ]; then
mkdir --parents /boot/firmware
mount "$RPIFIRM" /boot/firmware
fi

# variable checks {{{

# use aptitude only if it's available
Expand Down Expand Up @@ -368,6 +373,9 @@ kernel() {
if expr "$COMPONENTS" : '.*non-free' >/dev/null ; then
KERNELPACKAGES="$KERNELPACKAGES firmware-linux"
fi
if [ -n "$RPI" ] ; then
KERNELPACKAGES="$KERNELPACKAGES raspi-firmware"
fi
# shellcheck disable=SC2086
DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES
else
Expand All @@ -376,6 +384,19 @@ kernel() {
}
# }}}

# fix kernel command line for Raspberry Pi {{{
rpi_cmdline() {
if [ -z "$RPI" ]; then
return 0
fi

local cmdline
cmdline="$(cat /boot/firmware/cmdline.txt)"
cmdline="$(sed "s/root=[^ ]*/root=UUID=${TARGET_UUID}/" <<< "$cmdline")"
echo "$cmdline" > /boot/firmware/cmdline.txt
}
# }}}

# reconfigure packages {{{
# shellcheck disable=SC2329
reconfigure() {
Expand Down Expand Up @@ -522,6 +543,11 @@ if [ -n "$EFI" ] ; then
echo "UUID=$UUID_EFI /boot/efi vfat umask=0077 0 1" >> /etc/fstab
fi

if [ -n "$RPIFIRM" ] ; then
UUID_RPIFIRM="$(blkid -o value -s UUID "$RPIFIRM")"
echo "UUID=$UUID_RPIFIRM /boot/firmware vfat umask=0077 0 1" >> /etc/fstab
fi

cat >> /etc/fstab << EOF
proc /proc proc defaults 0 0
/dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0
Expand Down Expand Up @@ -874,6 +900,8 @@ finalize() {

umount /sys >/dev/null 2>/dev/null || true
umount /proc >/dev/null 2>/dev/null || true

umount /boot/firmware >/dev/null 2>/dev/null || true
}
# }}}

Expand All @@ -899,7 +927,7 @@ trap signal_handler HUP INT QUIT TERM
kernel packages extrapackages reconfigure hosts \
default_locales timezone fstab install_fs_tools hostname \
initrd grub_install passwords \
custom_scripts upgrade_system remove_apt_cache services \
custom_scripts upgrade_system rpi_cmdline remove_apt_cache services \
remove_chrootmirror; do
if stage "$i" ; then
"$i"
Expand Down
Loading
Loading