Update: a new version of the patch. It now works and supports all compressors supported by busybox (I tried bzip2, gzip, lzma, lzop and xz). lzma and xz fail. Others work.
-- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il | | a Mutt's tzaf...@cohens.org.il | | best tzaf...@debian.org | | friend
>From ca9802d44611873eee35c42aeb2ea1f729a0d4dc Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen <tzafrir.co...@xorcom.com> Date: Tue, 10 Apr 2018 16:07:43 +0300 Subject: [PATCH] debirf: support different compressor for nested rootfs Add configuration variable DEBIRF_COMPRESS, defaults to "xz". May also be set to use any other similar compressor (tested with bzip2, gzip, lzop and lzma). This is the compressor to use for the nested rootfs. For the sake of simplicity, the name of that file remains rootfs.cxz regardless. Gzip-compressed images are noticably larger (roughly 150% in my case). However we had a case of an odd corruption of the xz image when the compressor was xz (on one specific system, with an Atom D525 based Intel board). --- debirf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/debirf b/debirf index 1e20c5c..bf380a3 100755 --- a/debirf +++ b/debirf @@ -39,6 +39,9 @@ STAGE_ROOT=${STAGE_ROOT:-true} STAGE_MODULES=${STAGE_MODULES:-true} STAGE_INITRD=${STAGE_INITRD:-true} +# The compressor to use for the root filesystem archive: +DEBIRF_COMPRESS=${DEBIRF_COMPRESS:-xz} + # warn if running as root ROOT_WARNING=true @@ -48,6 +51,7 @@ export DEVICE_ARCHIVE=${DEVICE_ARCHIVE:-/usr/share/debirf/devices.tar.gz} # default package include/excludes DEBIRF_DEFAULT_PACKAGES=${DEBIRF_DEFAULT_PACKAGES:-/usr/share/debirf/packages} + ############################################################### ### FUNCTIONS @@ -159,7 +163,7 @@ pack_rootfs() { # abort with a failure if our attempts to build the rootfs fail: set -o pipefail - fakeroot_if_needed bash -c ". $DEBIRF_COMMON && FAKECHROOT_EXCLUDE_PATH=/does-not-exist debirf_exec sh -c 'find * | grep -v -e ^run/ | cpio --create -H newc'" | xz -9 > "$1" + fakeroot_if_needed bash -c ". $DEBIRF_COMMON && FAKECHROOT_EXCLUDE_PATH=/does-not-exist debirf_exec sh -c 'find * | grep -v -e ^run/ | cpio --create -H newc'" | $DEBIRF_COMPRESS -9 > "$1" } export -f pack_rootfs @@ -215,7 +219,7 @@ if (grep -q break=preunpack /proc/cmdline); then fi cd /newroot echo unpacking rootfs... -unxz - < /rootfs.cxz | cpio -i +$DEBIRF_COMPRESS -d - < /rootfs.cxz | cpio -i if (grep -q break=bottom /proc/cmdline); then echo "honoring break=bottom kernel arg" /bin/sh -- 2.11.0