diff --git a/core/Makefile b/core/Makefile index 73e93fc302..e11dd02c66 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2835,23 +2835,29 @@ ifeq ($(AB_OTA_UPDATER),true) $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_PARTITION_SUFFIX=_a endif # AB_OTA_UPDATER -$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(HOST_OUT_EXECUTABLES)/lpmake +$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) + +# $(1): slot A suffix (_a or empty) +# $(2): include images or not (true or empty) +define build-superimage-target-args + $(if $(2), --sparse) \ + --metadata-size 65536 \ + --metadata-slots $(if $(1),2,1) \ + --device-size $(BOARD_SUPER_PARTITION_SIZE) \ + $(foreach name,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ + --partition $(name)$(1):$$($(UUIDGEN) $(name)$(1)):readonly:$(if $(2),$(call read-size-of-partitions,$(name)),0) \ + $(if $(2), --image $(name)$(1)=$(call images-for-partitions,$(name))) \ + $(if $(1), --partition $(name)_b:$$($(UUIDGEN) $(name)_b):readonly:0) \ + ) +endef # $(1): output image path # $(2): slot A suffix (_a or empty) # $(3): include images or not (true or empty) define build-superimage-target $(HOST_OUT_EXECUTABLES)/lpmake \ - $(if $(3), --sparse) \ - --metadata-size 65536 \ - --metadata-slots $(if $(2),2,1) \ - --device-size $(BOARD_SUPER_PARTITION_SIZE) \ - --output $(1) \ - $(foreach name,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ - --partition $(name)$(2):$$($(UUIDGEN) $(name)$(2)):readonly:$(if $(3),$(call read-size-of-partitions,$(name)),0) \ - $(if $(3), --image $(name)$(2)=$(call images-for-partitions,$(name))) \ - $(if $(2), --partition $(name)_b:$$($(UUIDGEN) $(name)_b):readonly:0) \ - ) + $(call build-superimage-target-args,$(2),$(3)) \ + --output $(1) endef $(INSTALLED_SUPERIMAGE_TARGET): @@ -2974,6 +2980,7 @@ OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \ $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \ $(HOST_OUT_EXECUTABLES)/delta_generator \ $(HOST_OUT_EXECUTABLES)/care_map_generator \ + $(LPMAKE) \ $(AVBTOOL) \ $(BLK_ALLOC_TO_BASE_FS) \ $(BROTLI) \ @@ -3014,7 +3021,9 @@ OTATOOLS += \ $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \ $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \ $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \ - $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) + $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \ + $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \ + $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) .PHONY: otatools @@ -3162,6 +3171,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \ + $(LPMAKE) \ $(SELINUX_FC) \ $(APKCERTS_FILE) \ $(SOONG_ZIP) \ @@ -3488,6 +3498,13 @@ endif ifdef BUILT_VENDOR_MATRIX $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml endif +ifdef BOARD_SUPER_PARTITION_SIZE + $(hide) echo "super_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt + $(hide) echo "lpmake=$(notdir $(LPMAKE))" >> $(zip_root)/META/misc_info.txt + $(hide) echo -n "lpmake_args=" >> $(zip_root)/META/misc_info.txt + $(hide) echo $(call build-superimage-target-args,$(if $(filter true,$(AB_OTA_UPDATER)),_a,)) \ + >> $(zip_root)/META/misc_info.txt +endif $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root) diff --git a/core/config.mk b/core/config.mk index f3be4960d0..dd881db3d0 100644 --- a/core/config.mk +++ b/core/config.mk @@ -691,6 +691,7 @@ DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar FAT16COPY := build/make/tools/fat16copy.py CHECK_LINK_TYPE := build/make/tools/check_link_type.py UUIDGEN := build/make/tools/uuidgen.py +LPMAKE := $(HOST_OUT_EXECUTABLES)/lpmake$(HOST_EXECUTABLE_SUFFIX) PROGUARD := external/proguard/bin/proguard.sh JAVATAGS := build/make/tools/java-event-log-tags.py diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index e47c038886..4479bedf32 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -625,6 +625,22 @@ def AddPackRadioImages(output_zip, images): shutil.copy(img_radio_path, prebuilt_path) +def AddSuperEmpty(output_zip): + """Create a super_empty.img and store it in output_zip.""" + + img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "super_empty.img") + cmd = [OPTIONS.info_dict.get('lpmake')] + cmd += shlex.split(OPTIONS.info_dict.get('lpmake_args').strip()) + cmd += ['--output', img.name] + + p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdoutdata, _ = p.communicate() + assert p.returncode == 0, \ + "lpmake tool failed:\n{}".format(stdoutdata) + + img.Write() + + def ReplaceUpdatedFiles(zip_filename, files_list): """Updates all the ZIP entries listed in files_list. @@ -793,6 +809,10 @@ def AddImagesToTargetFiles(filename): banner("vbmeta") AddVBMeta(output_zip, partitions) + if OPTIONS.info_dict.get("super_size"): + banner("super_empty") + AddSuperEmpty(output_zip) + banner("radio") ab_partitions_txt = os.path.join(OPTIONS.input_tmp, "META", "ab_partitions.txt")