cdrom: Compress file system image using Zstandard
Commit Message
This patch uses the new Zstandard algorithm to compress the file system
image on the ISO image. This comes with these advantages:
* Compression is about twice as fast than XZ with the parameters we have
selected here
* We use a lot less memory during compression and can therefore utilise
all processor cores of the build machines
* Decompression (when installing IPFire and when creating the
flash-image) is substantically faster
The downside is that the generated ISO image is slighty larger (~10MiB)
which I am okay with as a trade-off for the points mentioned above.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
lfs/Config | 5 +++++
lfs/cdrom | 2 +-
lfs/flash-images | 2 +-
src/installer/dracut-module/module-setup.sh | 2 +-
src/installer/main.c | 2 +-
5 files changed, 9 insertions(+), 4 deletions(-)
@@ -81,6 +81,11 @@ TAR_OPTIONS = \
--acls \
--xattrs --xattrs-include='*'
+ZSTD_OPTIONS = \
+ -T$(PARALLELISM) \
+ -19 \
+ --long
+
# URLs that are common sources of downloads. If you're having trouble with
# a site you should change its URL to that of a suitable mirror site.
#
@@ -165,7 +165,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
-C / --files-from=$(DIR_TMP)/ROOTFILES | tar $(TAR_OPTIONS) -x -C $(DIR_TMP)/root
rm -f $(DIR_TMP)/ROOTFILES
mkdir $(DIR_TMP)/root/sys
- cd $(DIR_TMP)/root && tar $(TAR_OPTIONS) -cf - * | xz $(XZ_OPT) > $(DIR_TMP)/cdrom/distro.img
+ cd $(DIR_TMP)/root && tar $(TAR_OPTIONS) -cf - * | zstd $(ZSTD_OPTIONS) > $(DIR_TMP)/cdrom/distro.img
rm -rf $(DIR_TMP)/root
# Other files
@@ -152,7 +152,7 @@ endif
# Install IPFire
ifneq "$(BUILD_PLATFORM)" "arm"
- tar $(TAR_OPTIONS) -x --xz -C $(MNThdd)/ -f $(DIR_TMP)/cdrom/distro.img
+ tar $(TAR_OPTIONS) -x --zstd -C $(MNThdd)/ -f $(DIR_TMP)/cdrom/distro.img
else
tar $(TAR_OPTIONS) -x -C $(MNThdd)/ -f $(DIR_TMP)/cdrom/distro.img
endif
@@ -33,7 +33,7 @@ install() {
instmods ext4 iso9660 reiserfs vfat xfs
# Extraction
- inst_multiple tar gzip lzma xz
+ inst_multiple tar gzip zstd
# Networking
inst_multiple dhcpcd ethtool hostname ip ping sort wget
@@ -781,7 +781,7 @@ int main(int argc, char *argv[]) {
// Extract files...
snprintf(commandstring, STRING_SIZE,
- "/bin/tar --acls --xattrs --xattrs-include='*' -C /harddisk -xvf /cdrom/distro.img --xz 2>/dev/null");
+ "/bin/tar --acls --xattrs --xattrs-include='*' -C /harddisk -xvf /cdrom/distro.img --zstd 2>/dev/null");
if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
_("Installing the system..."), logfile)) {