use new initramfs routine on aarch64 and riscv64 too

This commit is contained in:
Tobias Powalowski 2024-07-18 08:14:32 +02:00
parent d8418ed9ab
commit 8b3618a991

View file

@ -32,15 +32,25 @@ _create_initrd_dir() {
} }
_compress_initrd() { _compress_initrd() {
echo "Creating zstd compressed image: ${1}"
pushd "${_W_DIR}/tmp/initrd" >"${_NO_LOG}" || return 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" fd . -u --min-depth 1 -X touch -hcd "@0"
# use zstd only it has best compression and decompression echo "Appending directories..."
fd . -u --min-depth 1 -0 | sort -z | 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 -cnf - -T - |
LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- | 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 popd >"${_NO_LOG}" || return
echo "Build complete." echo "Build complete."
} }