From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 1/4] ci: pytest: mount virtfs with signed FIT image into VMs
Date: Thu, 12 Jun 2025 10:56:00 +0200 [thread overview]
Message-ID: <20250612085603.4190573-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20250612085603.4190573-1-a.fatoum@barebox.org>
This is in preparation for adding a FIT boot pytest.
We intentionally don't use scripts/make_fit.py as its compression is
broken and we want to sign the FIT image, so we can test that in future
too.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
.github/testfs/multi_v7_defconfig-gzipped.its | 57 +++++++++++++++++++
.github/testfs/multi_v8_defconfig-gzipped.its | 57 +++++++++++++++++++
.github/workflows/test-labgrid-pytest.yml | 20 ++++++-
scripts/generate_testfs.sh | 26 +++++++++
4 files changed, 159 insertions(+), 1 deletion(-)
create mode 100644 .github/testfs/multi_v7_defconfig-gzipped.its
create mode 100644 .github/testfs/multi_v8_defconfig-gzipped.its
create mode 100755 scripts/generate_testfs.sh
diff --git a/.github/testfs/multi_v7_defconfig-gzipped.its b/.github/testfs/multi_v7_defconfig-gzipped.its
new file mode 100644
index 000000000000..11595c39baa1
--- /dev/null
+++ b/.github/testfs/multi_v7_defconfig-gzipped.its
@@ -0,0 +1,57 @@
+/dts-v1/;
+
+/ {
+ description = "fitImage for testing";
+ #address-cells = <1>;
+ images {
+ kernel-1 {
+ description = "barebox image";
+ data = /incbin/("barebox-dt-2nd.img.gz");
+ type = "kernel";
+ arch = "arm";
+ os = "linux";
+ compression = "gzip";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ fdt-qemu-virt32.dtb {
+ description = "Flattened Device Tree blob";
+ data = /incbin/("arch/arm/dts/qemu-virt32.dtb");
+ type = "flat_dt";
+ arch = "arm";
+ compression = "none";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ ramdisk-1 {
+ description = "initramfs";
+ data = /incbin/("ramdisk.cpio.gz");
+ type = "ramdisk";
+ arch = "arm";
+ os = "linux";
+ compression = "none";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ };
+
+ configurations {
+ default = "conf-qemu-virt32.dtb";
+ conf-qemu-virt32.dtb {
+ description = "Qemu Virt32";
+ kernel = "kernel-1";
+ fdt = "fdt-qemu-virt32.dtb";
+ ramdisk = "ramdisk-1";
+ compatible = "linux,dummy-virt";
+ signature-1 {
+ algo = "sha256,rsa2048";
+ sign-images = "kernel", "fdt", "ramdisk";
+ signer-name = "None";
+ signer-version = "None";
+ };
+ };
+ };
+};
diff --git a/.github/testfs/multi_v8_defconfig-gzipped.its b/.github/testfs/multi_v8_defconfig-gzipped.its
new file mode 100644
index 000000000000..5ce678eec9a8
--- /dev/null
+++ b/.github/testfs/multi_v8_defconfig-gzipped.its
@@ -0,0 +1,57 @@
+/dts-v1/;
+
+/ {
+ description = "fitImage for testing";
+ #address-cells = <1>;
+ images {
+ kernel-1 {
+ description = "barebox image";
+ data = /incbin/("barebox-dt-2nd.img.gz");
+ type = "kernel";
+ arch = "arm64";
+ os = "linux";
+ compression = "gzip";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ fdt-qemu-virt64.dtb {
+ description = "Flattened Device Tree blob";
+ data = /incbin/("arch/arm/dts/qemu-virt64.dtb");
+ type = "flat_dt";
+ arch = "arm64";
+ compression = "none";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ ramdisk-1 {
+ description = "initramfs";
+ data = /incbin/("ramdisk.cpio.gz");
+ type = "ramdisk";
+ arch = "arm64";
+ os = "linux";
+ compression = "none";
+ hash-1 {
+ algo = "sha256";
+ };
+ };
+ };
+
+ configurations {
+ default = "conf-qemu-virt64.dtb";
+ conf-qemu-virt64.dtb {
+ description = "Qemu Virt64";
+ kernel = "kernel-1";
+ fdt = "fdt-qemu-virt64.dtb";
+ ramdisk = "ramdisk-1";
+ compatible = "linux,dummy-virt";
+ signature-1 {
+ algo = "sha256,rsa2048";
+ sign-images = "kernel", "fdt", "ramdisk";
+ signer-name = "None";
+ signer-version = "None";
+ };
+ };
+ };
+};
diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index d4043de961b2..64618582a940 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -80,6 +80,20 @@ jobs:
if [ ${{matrix.arch}} = "riscv" ]; then
cp /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin ${KBUILD_OUTPUT}/
fi
+
+ - name: Populate testfs
+ run: |
+ export KBUILD_OUTPUT=build-${{matrix.arch}}-${{matrix.defconfig}}
+ export KBUILD_DEFCONFIG=${{matrix.defconfig}}
+
+ for i in ${{matrix.lgenv}}; do
+ grep -wq 'testfs' "$i" || continue
+
+ # Just use already built dtc
+ export PATH="$PATH:${KBUILD_OUTPUT}/scripts/dtc/"
+ exec scripts/generate_testfs.sh
+ done
+
- name: labgrid-pytest
run: |
export KBUILD_OUTPUT=build-${{matrix.arch}}-${{matrix.defconfig}}
@@ -87,10 +101,14 @@ jobs:
for i in ${{matrix.lgenv}}; do
grep -wq '\(QEMUDriver\|ExternalConsoleDriver\):' "$i" || continue
+ if grep -wq 'testfs' "$i"; then
+ extraargs="--fs testfs=${KBUILD_OUTPUT}/testfs"
+ fi
+
cfg=$(basename $i .yaml)
echo "Testing $cfg"
labgrid-pytest --lg-env $i test/py --verbosity=1 \
- --junitxml=$cfg.tests.xml --lg-log=log/$cfg
+ --junitxml=$cfg.tests.xml --lg-log=log/$cfg $extraargs
done
- name: Publish Test Results
diff --git a/scripts/generate_testfs.sh b/scripts/generate_testfs.sh
new file mode 100755
index 000000000000..c5d24f7e1af8
--- /dev/null
+++ b/scripts/generate_testfs.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+MKIMAGE=${MKIMAGE:-mkimage}
+KGZIP=${KGZIP:-gzip}
+
+set -e
+
+if [ -z "${KBUILD_OUTPUT}" ] || [ -z "${KBUILD_DEFCONFIG}" ] ; then
+ 2>&1 echo "KBUILD_OUTPUT and KBUILD_DEFCONFIG must be set"
+ exit 1
+fi
+
+rm -rf "${KBUILD_OUTPUT}/testfs/"
+mkdir -p ${KBUILD_OUTPUT}/testfs
+
+cat ${KBUILD_OUTPUT}/images/barebox-dt-2nd.img | \
+ ${KGZIP} -n -f -9 >${KBUILD_OUTPUT}/barebox-dt-2nd.img.gz
+
+cp .github/testfs/${KBUILD_DEFCONFIG}-gzipped.its ${KBUILD_OUTPUT}/
+
+find COPYING LICENSES/ | cpio -o -H newc | ${KGZIP} \
+ > ${KBUILD_OUTPUT}/ramdisk.cpio.gz
+
+${MKIMAGE} -G $PWD/test/self/development_rsa2048.pem -r \
+ -f ${KBUILD_OUTPUT}/${KBUILD_DEFCONFIG}-gzipped.its \
+ ${KBUILD_OUTPUT}/testfs/barebox-gzipped.fit
--
2.39.5
next prev parent reply other threads:[~2025-06-12 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 8:55 [PATCH 0/4] test: py: add FIT image boot test Ahmad Fatoum
2025-06-12 8:56 ` Ahmad Fatoum [this message]
2025-06-12 8:56 ` [PATCH 2/4] test: py: add FIT " Ahmad Fatoum
2025-06-12 8:56 ` [PATCH 3/4] ci: pytest: multi_v8_defconfig: pass --runxfail Ahmad Fatoum
2025-06-12 8:56 ` [PATCH 4/4] ci: container: add device-tree-compiler Ahmad Fatoum
2025-06-17 7:29 ` [PATCH 0/4] test: py: add FIT image boot test Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250612085603.4190573-2-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox