fs/iso9660: add option for transparent (de)compression
authorYann E. MORIN <yann.morin.1998@free.fr>
Wed, 20 Dec 2017 21:27:42 +0000 (22:27 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 31 Dec 2017 17:13:36 +0000 (18:13 +0100)
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[Thomas: rename option to BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
fs/iso9660/Config.in
fs/iso9660/iso9660.mk

index 842c987f210c159f03ac780b8586f72913ca4c90..6f001c0640e2a7aa3ade16568bb591e596696ac2 100644 (file)
@@ -63,6 +63,15 @@ config BR2_TARGET_ROOTFS_ISO9660_INITRD
          contain a kernel image, an initrd image (unless an initramfs
          linked into the kernel is used) and the bootloader.
 
+config BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION
+       bool "transparent compression"
+       depends on !BR2_TARGET_ROOTFS_ISO9660_INITRD
+       depends on !BR2_TARGET_ROOTFS_INITRAMFS
+       help
+         Say 'y' to enable use of transparent (de)compression. Files
+         are stored compressed and will be decompressed on-the-fly
+         upon access at runtime.
+
 config BR2_TARGET_ROOTFS_ISO9660_HYBRID
        bool "Build hybrid image"
        depends on BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
index c2de27101aca9cfcf6edb69398f054c58f30c7f4..06467262e0e5da653c5b3c71bd03dc170531d02a 100644 (file)
@@ -41,6 +41,17 @@ define ROOTFS_ISO9660_CREATE_TEMPDIR
        mkdir -p $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_CREATE_TEMPDIR
+else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION),y)
+ROOTFS_ISO9660_TARGET_DIR = $(FS_DIR)/rootfs.iso9660.tmp
+# This must be early, before we copy the bootloader files
+define ROOTFS_ISO9660_MKZFTREE
+       $(RM) -rf $(ROOTFS_ISO9660_TARGET_DIR)
+       mkzftree -X -z 9 -p $(PARALLEL_JOBS) \
+               $(TARGET_DIR) \
+               $(ROOTFS_ISO9660_TARGET_DIR)
+endef
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_MKZFTREE
+ROOTFS_ISO9660_GENISOIMAGE_OPTS += -z
 else
 ROOTFS_ISO9660_TARGET_DIR = $(TARGET_DIR)
 endif
@@ -117,6 +128,7 @@ endif # ROOTFS_ISO9660_USE_INITRD
 define ROOTFS_ISO9660_CMD
        $(HOST_DIR)/bin/genisoimage -J -R -b $(ROOTFS_ISO9660_BOOT_IMAGE) \
                -no-emul-boot -boot-load-size 4 -boot-info-table \
+               $(ROOTFS_ISO9660_GENISOIMAGE_OPTS) \
                -o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef