Use EROFS LZMA compression of firmware on x86 instead of per-file ZSTD (#3877)

Instead of using per-file ZSTD compression, compress firmware (and newly also
kernel modules) using LZMA within EROFS image. LZMA was picked because ZSTD
support in EROFS is still experimental and due to some limitations in the
implementation, the compression takes significantly more time.

This change gives us more control over compression of the files and with the
proposed settings, saves a bit of the space (~10 MiB) in the resulting image.
In theory, even higher savings could be achieved through compressing other
runtime binaries, but this would need to be thoroughly tested whether it
doesn't have any detrimental effects. For firmware and modules, the overhead
should be minimal, as they are usually touched only once per boot and are
rather small before decompression.

* buildroot 74994c4f32...92fab35fed (6):
  > fs/erofs: add custom compression option with optional compress-hints file
  > package/erofs-utils: bump to version 1.8.5
  > package/erofs-utils: bump to version 1.8.3
  > package/erofs-utils: bump to version 1.8.2
  > package/erofs-utils: bump to version 1.8.1
  > package/erofs-utils: add libdeflate and zlib optional dependencies
This commit is contained in:
Jan Čermák 2025-02-14 12:27:39 +01:00 committed by GitHub
parent 5fcf2932a6
commit 3a666bbeea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 4 deletions

@ -1 +1 @@
Subproject commit 74994c4f32fd6f7abe5400aff454ef5e20651d6c
Subproject commit 92fab35fede435d7df72b118a02f83334241f074

View File

@ -0,0 +1,3 @@
# assumed -zlz4hc,12:lzma,9 for optimal compression
16384 1 usr/lib/firmware/
16384 1 usr/lib/modules/

View File

@ -33,8 +33,6 @@ BR2_PACKAGE_E2FSPROGS_E2IMAGE=y
BR2_PACKAGE_NFS_UTILS=y
# BR2_PACKAGE_NFS_UTILS_RPC_NFSD is not set
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_COMPRESS=y
BR2_PACKAGE_LINUX_FIRMWARE_COMPRESS_ZSTD=y
BR2_PACKAGE_LINUX_FIRMWARE_AMDGPU=y
BR2_PACKAGE_LINUX_FIRMWARE_I915=y
BR2_PACKAGE_LINUX_FIRMWARE_IBT=y
@ -156,7 +154,9 @@ BR2_PACKAGE_UTIL_LINUX_NOLOGIN=y
BR2_PACKAGE_UTIL_LINUX_PARTX=y
BR2_PACKAGE_UTIL_LINUX_ZRAMCTL=y
BR2_TARGET_ROOTFS_EROFS=y
BR2_TARGET_ROOTFS_EROFS_LZ4HC_LEVEL=12
BR2_TARGET_ROOTFS_EROFS_CUSTOM_COMPRESSION=y
BR2_TARGET_ROOTFS_EROFS_COMPRESSION_ALGORITHMS="lz4hc,12:lzma,9"
BR2_TARGET_ROOTFS_EROFS_COMPRESSION_HINTS="$(BR2_EXTERNAL_HASSOS_PATH)/board/pc/generic-x86-64/erofs-compress-hints.txt"
BR2_TARGET_ROOTFS_EROFS_DEDUPE=y
BR2_TARGET_ROOTFS_EROFS_FRAGMENTS=y
BR2_TARGET_ROOTFS_EROFS_ZTAILPACKING=y

View File

@ -36,6 +36,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
CONFIG_MISC_FILESYSTEMS=y
CONFIG_BLOCK=y
CONFIG_EROFS_FS=y
CONFIG_EROFS_FS_ZIP_LZMA=y
CONFIG_EXT4_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y