Skip to content

Commit

Permalink
buildroot: Compress images with zstd
Browse files Browse the repository at this point in the history
My benchmarks show that zstd has the second best decompression
ratio/speed, whereas the best decompression ratio algorithm is
not the same as the best decompression speed algorithm. Compression
speed is not awful either.

Check that the tool is installed and bail out if it is not.

Link: ClangBuiltLinux/continuous-integration#184 (comment)
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
  • Loading branch information
nathanchance committed Mar 26, 2020
1 parent bc8c676 commit 1740f54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion buildroot/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ set -u
# Move into the folder that contains this script
cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" || exit 1

# Make sure the user has zstd installed
command -v zstd &>/dev/null || die "zstd could not be found on your system, please install it!"

# Generate list of configs to build
CONFIGS=()
[[ ${#} -eq 0 ]] && die "Please specify the configs that you want to build as parameters to this script!"
Expand Down Expand Up @@ -75,6 +78,6 @@ for CONFIG in "${CONFIGS[@]}"; do
IMAGES=( "output/images/rootfs.cpio" )
for IMAGE in "${IMAGES[@]}"; do
[[ -f ${IMAGE} ]] || die "${IMAGE} could not be found! Did the build error?"
cp -v "${IMAGE}" "${IMAGES_FOLDER}"
zstd -19 "${IMAGE}" -o "${IMAGES_FOLDER}/${IMAGE##*/}.zst" || die "Compressing ${IMAGE##*/} failed!"
done
done

0 comments on commit 1740f54

Please sign in to comment.