diff --git a/board/common/Config.in b/board/common/Config.in index c73e1d3d..ed192024 100644 --- a/board/common/Config.in +++ b/board/common/Config.in @@ -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 diff --git a/board/common/image/image-itb-dl-release/Config.in b/board/common/image/image-itb-dl-release/Config.in new file mode 100644 index 00000000..0b6769e8 --- /dev/null +++ b/board/common/image/image-itb-dl-release/Config.in @@ -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. diff --git a/board/common/image/image-itb-dl-release/generate.sh b/board/common/image/image-itb-dl-release/generate.sh new file mode 100755 index 00000000..33841dd5 --- /dev/null +++ b/board/common/image/image-itb-dl-release/generate.sh @@ -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 diff --git a/board/common/image/image-itb-dl-release/image-itb-dl-release.mk b/board/common/image/image-itb-dl-release/image-itb-dl-release.mk new file mode 100644 index 00000000..4dce031d --- /dev/null +++ b/board/common/image/image-itb-dl-release/image-itb-dl-release.mk @@ -0,0 +1,9 @@ +################################################################################ +# +# image-itb-dl-release +# +################################################################################ + +IMAGE_ITB_DL_RELEASE_CONFIG_VARS := URL + +$(eval $(ix-image)) diff --git a/board/common/image/image-itb-qcow/Config.in b/board/common/image/image-itb-qcow/Config.in index c8c55945..8262344f 100644 --- a/board/common/image/image-itb-qcow/Config.in +++ b/board/common/image/image-itb-qcow/Config.in @@ -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. diff --git a/board/common/image/image-itb-qcow/image-itb-qcow.mk b/board/common/image/image-itb-qcow/image-itb-qcow.mk index 98e5d05e..be44478a 100644 --- a/board/common/image/image-itb-qcow/image-itb-qcow.mk +++ b/board/common/image/image-itb-qcow/image-itb-qcow.mk @@ -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))