]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
cdrom: Compress file system image using Zstandard
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 13 Jul 2021 16:27:59 +0000 (16:27 +0000)
committerArne Fitzenreiter <arne_f@ipfire.org>
Wed, 14 Jul 2021 08:28:46 +0000 (08:28 +0000)
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>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
lfs/Config
lfs/cdrom
lfs/flash-images
src/installer/dracut-module/module-setup.sh
src/installer/main.c

index f0139e1c59f3e3502351918bfe254b393860b632..a2d3cddc5ca49e6e251ee6d65adb77d61ab16a7f 100644 (file)
@@ -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.
 #
index c58fc0885ad5f0f9d880f125f4ecbbbf3be1d3a4..18c63c79b67fb0ad78e6646b74341b461471b907 100644 (file)
--- a/lfs/cdrom
+++ b/lfs/cdrom
@@ -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
index 15398d05108d7ce6524b84b96caab801b2e6f0ef..72e635073d2bfd2c08644823e78111cedb652f53 100644 (file)
@@ -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
index ef4b15bdcc332edd19dca58993d0e3503dc69a5c..29ec4c0d7f58344b1154e0e0b6ae03fa4eb9610c 100755 (executable)
@@ -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
index fd20a1f37a0609f489a4032817eb42024a3ec8f7..bc0fdaa674a726ca467dda284cb0c05051c49305 100644 (file)
@@ -786,7 +786,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)) {