summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThore Sommer <debian@thson.de>2020-10-07 23:25:22 +0200
committerLuca Boccassi <bluca@debian.org>2020-10-12 13:35:16 +0000
commit9a26533a06a8892b4014d86fe0c9d9e3b08ae1e5 (patch)
treeb7a9a535c5bcd3b66a6a4d8d21f64e103f78922e
parentce39f3e507a8d03b1c986c400d797f13f82ae9d5 (diff)
downloadvyos-live-build-9a26533a06a8892b4014d86fe0c9d9e3b08ae1e5.tar.gz
vyos-live-build-9a26533a06a8892b4014d86fe0c9d9e3b08ae1e5.zip
Add option to change compression algorithm and level for squashfs.
-rw-r--r--manpages/en/lb_config.18
-rwxr-xr-xscripts/build/binary_rootfs13
-rwxr-xr-xscripts/build/config23
3 files changed, 41 insertions, 3 deletions
diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index 84f7038fa..c09abfbaa 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -68,6 +68,10 @@
.br
[\fB\-\-chroot\-filesystem\fR ext2|ext3|ext4|squashfs|jffs2|none]
.br
+ [\fB\-\-chroot\-squashfs\-compression\-level\fR LEVEL]
+.br
+ [\fB\-\-chroot\-squashfs\-compression\-type\fR gzip|lzma|lzo|lz4|xz|zstd]
+.br
[\fB\-\-clean\fR]
.br
[\fB\-\-color\fR]
@@ -292,6 +296,10 @@ sets which stages should be cached (a comma or space separated list). By default
defines if the binary image should contain a file called XXXsums.txt, where XXX is one of the mentioned checksum types. This file lists all files on the image together with their checksums. This in turn can be used by \fIlive\-boot\fR(7)'s built\-in integrity\-check to verify the medium if specified at boot prompt. In general, this should not be 'none' and is an important feature of live system released to the public. However, during development of very big images it can save some time by not calculating the checksums.
.IP "\fB\-\-chroot\-filesystem\fR ext2|ext3|ext4|squashfs|jffs2|none" 4
defines which filesystem type should be used for the root filesystem image. If you use none, then no filesystem image is created and the root filesystem content is copied on the binary image filesystem as flat files. Depending on what binary filesystem you have chosen, it may not be possible to build with such a plain root filesystem, e.g. fat16/fat32 will not work as linux does not support running directly on them.
+.IP "\fB\-\-chroot\-squashfs\-compression\-level\fR LEVEL" 4
+defines the compression level that is used for the root filesystem image if squashfs is used. Each compression algorithm supports different levels (or none). You can look them up in the \fImksquashfs\fR help. Defaults to the default setting in \fImksquashfs\fR.
+.IP "\fB\-\-chroot\-squashfs\-compression\-type\fR gzip|lzma|lzo|lz4|xz|zstd" 4
+defines the compression algorithm that is used for the root filesystem image if squashfs is used. Defaults to xz.
.IP "\fB\-\-clean\fR" 4
minimizes config directory by automatically removing unused and thus empty subdirectories.
.IP "\fB\-\-color\fR" 4
diff --git a/scripts/build/binary_rootfs b/scripts/build/binary_rootfs
index a81c21fd5..5934ad672 100755
--- a/scripts/build/binary_rootfs
+++ b/scripts/build/binary_rootfs
@@ -287,7 +287,18 @@ case "${LB_CHROOT_FILESYSTEM}" in
esac
fi
- MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz"
+ # Set squashfs compression type or default to xz
+ if [ -n "${LB_CHROOT_SQUASHFS_COMPRESSION_TYPE}" ]
+ then
+ MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp ${LB_CHROOT_SQUASHFS_COMPRESSION_TYPE}"
+ else
+ MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz"
+ fi
+
+ if [ -n "${LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL}" ]
+ then
+ MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -Xcompression-level ${LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL}"
+ fi
case "${LB_BUILD_WITH_CHROOT}" in
true)
diff --git a/scripts/build/config b/scripts/build/config
index 2bd929bc1..4f2a53538 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -46,6 +46,8 @@ USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\
\t [--cache-stages STAGE|\"STAGES\"]\n\
\t [--checksums md5|sha1|sha224|sha256|sha384|sha512|none]\n\
\t [--chroot-filesystem ext2|ext3|ext4|squashfs|jffs2|none]\n\
+\t [--chroot-squashfs-compression-level LEVEL]\n\
+\t [--chroot-squashfs-compression-type gzip|lzma|lzo|lz4|xz|zstd]\n\
\t [--clean]\n\
\t [--color]\n\
\t [--compression bzip2|gzip|lzip|xz|none]\n\
@@ -138,8 +140,9 @@ Local_arguments ()
bootloader:,bootloaders:,bootstrap-qemu-arch:,bootstrap-qemu-exclude:,
bootstrap-qemu-static:,breakpoints,build-with-chroot:,
cache:,cache-indices:,cache-packages:,cache-stages:,checksums:,
- chroot-filesystem:,clean,color,compression:,conffile:,config:,
- debconf-frontend:,debconf-priority:,debian-installer:,
+ chroot-filesystem:,chroot-squashfs-compression-level:,
+ chroot-squashfs-compression-type:,clean,color,compression:,conffile:,
+ config:,debconf-frontend:,debconf-priority:,debian-installer:,
debian-installer-distribution:,debian-installer-gui:,
debian-installer-preseedfile:,debootstrap-options:,debootstrap-script:,
debug,distribution:,distribution-binary:,distribution-chroot:,dump,
@@ -419,6 +422,16 @@ Local_arguments ()
shift 2
;;
+ --chroot-squashfs-compression-level)
+ LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL="${2}"
+ shift 2
+ ;;
+
+ --chroot-squashfs-compression-type)
+ LB_CHROOT_SQUASHFS_COMPRESSION_TYPE="${2}"
+ shift 2
+ ;;
+
--compression)
LB_COMPRESSION="${2}"
shift 2
@@ -1136,6 +1149,12 @@ cat > config/chroot << EOF
# Set chroot filesystem
LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}"
+# Set chroot squashfs compression level
+LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL="${LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL}"
+
+# Set chroot squashfs compression type
+LB_CHROOT_SQUASHFS_COMPRESSION_TYPE="${LB_CHROOT_SQUASHFS_COMPRESSION_TYPE}"
+
# Set union filesystem
LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM}"