board/common: Restore capability to create QEMU image from tarball

Previously, post-image.sh was able to create QEMU images from an
existing release tarball. This was useful when you wanted to test a
new bootloader build without having to wait for a full Infix build.

Restore this capability by adding a separate image target for it, and
then allow image-itb-qcow to source its input images from that instead
of a locally build squash+aux.
This commit is contained in:
Tobias Waldekranz
2025-12-03 16:46:13 +01:00
parent 04e33c0f15
commit 87b3f9c304
6 changed files with 57 additions and 14 deletions
+1
View File
@@ -5,6 +5,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-aux/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-qcow/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-gns3a/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rauc/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-dl-release/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-readme/Config.in"
endmenu
@@ -0,0 +1,15 @@
menuconfig IMAGE_ITB_DL_RELEASE
bool "Download existing release"
depends on !BR2_TARGET_ROOTFS_SQUASHFS
help
This is primarily used by target specific builds, where the
bootloader artifact needs to be combined with an existing
Infix image, to create a full disk image that can be
provisioned to an SD-card or eMMC.
config IMAGE_ITB_DL_RELEASE_URL
string "URL"
depends on IMAGE_ITB_DL_RELEASE
default "https://github.com/kernelkit/infix/releases/download/latest/infix-${BR2_ARCH}.tar.gz"
help
URL to release tarball.
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
set -e
squash="${BINARIES_DIR}"/rootfs.squashfs
aux="${BINARIES_DIR}"/aux.ext4
[ -f "${squash}" ] && [ -f "${aux}" ] && exit 0
archive="${WORKDIR}/$(basename ${URL})"
[ -f "${archive}" ] || wget -O"${archive}" "${URL}"
echo "Unpacking..."
tar -xa --strip-components=1 -C "${BINARIES_DIR}" -f "${archive}"
auxsize=$(stat -c %s "${aux}")
if [ "${auxsize}" -gt $((8 << 20)) ]; then
# In older releases, 16M aux.ext4 images were generated. In order
# to keep the image-itb-qcow logic simpler, trim it 8M, which we
# always generate nowadays.
echo "WARNING: Auxiliary partition is unexpectedly large. Resizing..."
resize2fs "${aux}" 8M
truncate -s 8M "${aux}"
tune2fs -l "${aux}"
fi
@@ -0,0 +1,9 @@
################################################################################
#
# image-itb-dl-release
#
################################################################################
IMAGE_ITB_DL_RELEASE_CONFIG_VARS := URL
$(eval $(ix-image))
+1 -13
View File
@@ -1,8 +1,6 @@
menuconfig IMAGE_ITB_QCOW
bool "QEMU disk image (ITB)"
default y
select IMAGE_ITB_ROOTFS
select IMAGE_ITB_AUX
depends on (IMAGE_ITB_ROOTFS && IMAGE_ITB_AUX) || IMAGE_ITB_DL_RELEASE
select BR2_PACKAGE_HOST_GENIMAGE
help
Compose a full disk image with redundant Linux OS partitions,
@@ -68,13 +66,3 @@ config IMAGE_ITB_QCOW_BOOT_OFFSET
Offset at which the bootloader partition is placed. Remember
to make sure that the GPT still fits at the start of the
image.
config IMAGE_ITB_QCOW_RELEASE_URL
string "Infix URL"
depends on IMAGE_ITB_QCOW
depends on !BR2_TARGET_ROOTFS_SQUASHFS
default "https://github.com/kernelkit/infix/releases/download/latest/infix-${BR2_ARCH}.tar.gz"
help
In situations where Infix itself is not being built, but a
disk image is, i.e. when building a bootloader: place this
Infix release in the primary and secondary partitions.
@@ -4,7 +4,12 @@
#
################################################################################
IMAGE_ITB_QCOW_DEPENDENCIES := host-genimage image-itb-rootfs image-itb-aux
# We can source the rootfs+aux from a local build, or from a
# downloaded release; so adjust our dependencies accordingly.
IMAGE_ITB_QCOW_SRC-$(IMAGE_ITB_ROOTFS) := image-itb-rootfs image-itb-aux
IMAGE_ITB_QCOW_SRC-$(IMAGE_ITB_DL_RELEASE) := image-itb-dl-release
IMAGE_ITB_QCOW_DEPENDENCIES := host-genimage $(IMAGE_ITB_QCOW_SRC-y)
IMAGE_ITB_QCOW_CONFIG_VARS := BOOT_DATA BOOT_OFFSET SIZE
$(eval $(ix-image))