0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git/ synced 2025-10-06 02:32:46 +02:00

image: add support for EROFS rootfs image generation

Add support for generating EROFS rootfs images.

The EROFS filesystem can offer competitive I/O performance while
minimizing final image size when using the MicroLZMA compressor.

Target platform: linux-x86_generic (target-i386_pentium4_musl)

Filesystem     Image Size
=============  ==========
root.erofs     4882432
root.ext4      109051904
root.squashfs  4903302

Co-Developed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://github.com/openwrt/openwrt/pull/19244
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Gao Xiang
2025-06-26 01:45:22 +08:00
committed by Christian Marangi
parent 9ece943540
commit f7fa414d3b
8 changed files with 86 additions and 0 deletions

View File

@@ -99,11 +99,22 @@ endif
JFFS2_BLOCKSIZE ?= 64k 128k
EROFS_PCLUSTERSIZE := $(shell echo $$(($(CONFIG_TARGET_EROFS_PCLUSTER_SIZE)*1024)))
EROFSOPT := -C$(EROFS_PCLUSTERSIZE)
EROFSOPT += -Efragments,dedupe,ztailpacking -Uclear --all-root
EROFSOPT += $(if $(SOURCE_DATE_EPOCH),-T$(SOURCE_DATE_EPOCH) --ignore-mtime)
EROFSOPT += $(if $(CONFIG_SELINUX),,-x-1)
EROFSCOMP := lz4hc,12
ifeq ($(CONFIG_EROFS_FS_ZIP_LZMA),y)
EROFSCOMP := lzma,109
endif
fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs
fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE))
fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE))
fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4
fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs
fs-types-$(CONFIG_TARGET_ROOTFS_EROFS) += erofs
fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE)))
TARGET_FILESYSTEMS := $(fs-types-y)
@@ -309,6 +320,12 @@ define Image/mkfs/ext4
$@ $(call mkfs_target_dir,$(1))/
endef
# Don't use the mkfs.erofs builtin $SOURCE_DATE_EPOCH behavior
define Image/mkfs/erofs
env -u SOURCE_DATE_EPOCH $(STAGING_DIR_HOST)/bin/mkfs.erofs -z$(EROFSCOMP) $(EROFSOPT) \
$@ $(call mkfs_target_dir,$(1))
endef
define Image/Manifest
$(if $(CONFIG_USE_APK), \
$(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network \