From 8b3618a991d20711b7c6d95b23628678f04747d9 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Thu, 18 Jul 2024 08:14:32 +0200 Subject: [PATCH] use new initramfs routine on aarch64 and riscv64 too --- usr/lib/archboot/release.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/usr/lib/archboot/release.sh b/usr/lib/archboot/release.sh index d11fc1d9d..82485ca50 100644 --- a/usr/lib/archboot/release.sh +++ b/usr/lib/archboot/release.sh @@ -32,15 +32,25 @@ _create_initrd_dir() { } _compress_initrd() { - echo "Creating zstd compressed image: ${1}" pushd "${_W_DIR}/tmp/initrd" >"${_NO_LOG}" || return - # Reproducibility: set all timestamps to 0 + echo "Creating initramfs:" fd . -u --min-depth 1 -X touch -hcd "@0" - # use zstd only it has best compression and decompression - fd . -u --min-depth 1 -0 | sort -z | + echo "Appending directories..." + fd . -u -t d -0 | sort -z | + LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - | + LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- > "../../${1}" || _abort "Image creation failed!" + echo "Appending compressed files..." + fd . -t f -t l -u -e 'bz2' -e 'gz' -e 'xz' -e 'zst' --min-depth 1 -0 | sort -z | + LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - | + LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- >> "../../${1}" || _abort "Image creation failed!" + # remove compressed files, timestamps need reset! + fd . -u -e 'bz2' -e 'gz' -e 'xz' -e 'zst' --min-depth 1 -X rm + fd . -u --min-depth 1 -X touch -hcd "@0" + echo "Appending zstd compressed image..." + fd . -t f -t l -u --min-depth 1 -0 | sort -z | LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - | LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- | - zstd -T0 -19 > "../../${1}" || exit 1 + zstd -T0 -19 >> "../../${1}" || _abort "Image creation failed!" popd >"${_NO_LOG}" || return echo "Build complete." }