From 433f822d76074943a7ab54de147be0889f4c3bef Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 13 Aug 2018 13:01:14 -0700 Subject: [PATCH] Build image for clean super partition. This adds a new super_empty.img output to the build when PRODUCT_USE_LOGICAL_PARTITIONS is true and a super partition size is set. This will be used by fastboot flashall in fastbootd, since it needs a record of the partition layout in case the super partition is corrupt or not yet flashed. Unlike the full super.img, super_empty.img is not a sparse image. It contains the minimal data sequence needed to format the super partition. It also does not contain partition sizes, since flashing is responsible for choosing the correct partition size. The full super.img (which contains embedded partition data) is still available via "make dist". Bug: 78793464 Test: super_empty.img generated when PRODUCT_USE_LOGICAL_PARTITIONS is true. mmm system/extras/partition_tools && lpdump super_empty.img works Change-Id: I34e915a1fead806287dde554d190474785e52500 --- core/Makefile | 20 ++++++++++++++++---- core/main.mk | 4 ++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/core/Makefile b/core/Makefile index cf8a51df59..08767bbf63 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2803,19 +2803,20 @@ ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) ifdef BOARD_SUPER_PARTITION_SIZE INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img +INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img + $(INSTALLED_SUPERIMAGE_TARGET): $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST)) # For A/B devices, super partition always contains sub-partitions in the _a slot, because this # image should only be used for bootstrapping / initializing the device. When flashing the image, # bootloader fastboot should always mark _a slot as bootable. ifeq ($(AB_OTA_UPDATER),true) -$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_PARTITION_SUFFIX=_a -$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_METADATA_SLOTS=2 +$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_PARTITION_SUFFIX=_a +$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_METADATA_SLOTS=2 else -$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_METADATA_SLOTS=1 +$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_METADATA_SLOTS=1 endif # AB_OTA_UPDATER - $(INSTALLED_SUPERIMAGE_TARGET): $(HOST_OUT_EXECUTABLES)/lpmake $< \ --sparse \ @@ -2829,6 +2830,17 @@ $(INSTALLED_SUPERIMAGE_TARGET): $(HOST_OUT_EXECUTABLES)/lpmake $(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET)) +$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(HOST_OUT_EXECUTABLES)/lpmake + $< \ + --metadata-size 65536 \ + --metadata-slots $(PRIVATE_METADATA_SLOTS) \ + --device-size $(BOARD_SUPER_PARTITION_SIZE) \ + --output $@ \ + $(foreach name,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ + --partition $(name)$(PRIVATE_PARTITION_SUFFIX):$$($(UUIDGEN) $(name)$(PRIVATE_SUPER_PARTITION_SUFFIX)):readonly:0) + +$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET)) + endif # BOARD_SUPER_PARTITION_SIZE endif # PRODUCT_BUILD_SUPER_PARTITION diff --git a/core/main.mk b/core/main.mk index c5067b14e7..25887d0e32 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1211,6 +1211,9 @@ systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) .PHONY: superimage superimage: $(INSTALLED_SUPERIMAGE_TARGET) +.PHONY: superimage_empty +superimage_empty: $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) + .PHONY: bootimage bootimage: $(INSTALLED_BOOTIMAGE_TARGET) @@ -1233,6 +1236,7 @@ droidcore: files \ $(INSTALLED_BPTIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ $(INSTALLED_FILES_FILE) \