Merge "target-files: Support erofs_compress_hints" into main

This commit is contained in:
Treehugger Robot
2024-08-13 01:21:02 +00:00
committed by Gerrit Code Review
2 changed files with 49 additions and 2 deletions

View File

@@ -6883,6 +6883,33 @@ ifdef BOARD_KERNEL_PAGESIZE
$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/INIT_BOOT/pagesize
endif # BOARD_KERNEL_PAGESIZE
endif # BUILDING_INIT_BOOT_IMAGE
ifdef BOARD_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_EROFS_COMPRESS_HINTS) $(zip_root)/META/erofs_default_compress_hints.txt
endif
ifdef BOARD_SYSTEMIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_SYSTEMIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/system_erofs_compress_hints.txt
endif
ifdef BOARD_SYSTEM_EXTIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_SYSTEM_EXTIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/system_ext_erofs_compress_hints.txt
endif
ifdef BOARD_PRODUCTIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_PRODUCTIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/product_erofs_compress_hints.txt
endif
ifdef BOARD_VENDORIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_VENDORIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/vendor_erofs_compress_hints.txt
endif
ifdef BOARD_ODMIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_ODMIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/odm_erofs_compress_hints.txt
endif
ifdef BOARD_VENDOR_DLKMIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_VENDOR_DLKMIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/vendor_dlkm_erofs_compress_hints.txt
endif
ifdef BOARD_ODM_DLKMIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_ODM_DLKMIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/odm_dlkm_erofs_compress_hints.txt
endif
ifdef BOARD_SYSTEM_DLKMIMAGE_EROFS_COMPRESS_HINTS
$(hide) cp $(BOARD_SYSTEM_DLKMIMAGE_EROFS_COMPRESS_HINTS) $(zip_root)/META/system_dlkm_erofs_compress_hints.txt
endif
ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
$(call fs_config,$(zip_root)/VENDOR_BOOT/RAMDISK,) > $(zip_root)/META/vendor_boot_filesystem_config.txt
endif

View File

@@ -907,9 +907,10 @@ def LoadInfoDict(input_file, repacking=False):
d["root_fs_config"] = os.path.join(
input_file, "META", "root_filesystem_config.txt")
partitions = ["system", "vendor", "system_ext", "product", "odm",
"vendor_dlkm", "odm_dlkm", "system_dlkm"]
# Redirect {partition}_base_fs_file for each of the named partitions.
for part_name in ["system", "vendor", "system_ext", "product", "odm",
"vendor_dlkm", "odm_dlkm", "system_dlkm"]:
for part_name in partitions:
key_name = part_name + "_base_fs_file"
if key_name not in d:
continue
@@ -922,6 +923,25 @@ def LoadInfoDict(input_file, repacking=False):
"Failed to find %s base fs file: %s", part_name, base_fs_file)
del d[key_name]
# Redirecting helper for optional properties like erofs_compress_hints
def redirect_file(prop, filename):
if prop not in d:
return
config_file = os.path.join(input_file, "META/" + filename)
if os.path.exists(config_file):
d[prop] = config_file
else:
logger.warning(
"Failed to find %s fro %s", filename, prop)
del d[key_name]
# Redirect erofs_[default_]compress_hints files
redirect_file("erofs_default_compress_hints",
"erofs_default_compress_hints.txt")
for part in partitions:
redirect_file(part + "_erofs_compress_hints",
part + "_erofs_compress_hints.txt")
def makeint(key):
if key in d:
d[key] = int(d[key], 0)