Files
infix/board/common/image/image-itb-dl-release/generate.sh
T
Tobias Waldekranz 87b3f9c304 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.
2025-12-03 16:46:13 +01:00

26 lines
722 B
Bash
Executable File

#!/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