forked from openkylin/platform_build
Merge changes from topic "dp_retrofit"
* changes: Add build flags for spanning the super partition across multiple block devices. logical partitions -> dynamic partitions
This commit is contained in:
commit
b7ea9d3870
|
@ -1241,7 +1241,7 @@ ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
|
|||
INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
|
||||
endif
|
||||
|
||||
ifeq (true,$(PRODUCT_USE_LOGICAL_PARTITIONS))
|
||||
ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
|
||||
|
||||
ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
|
||||
$(error vboot 1.0 doesn't support logical partition)
|
||||
|
@ -1250,7 +1250,7 @@ endif
|
|||
# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
|
||||
# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
|
||||
|
||||
endif # PRODUCT_USE_LOGICAL_PARTITIONS
|
||||
endif # PRODUCT_USE_DYNAMIC_PARTITIONS
|
||||
|
||||
# $(1): the path of the output dictionary file
|
||||
# $(2): a subset of "system vendor cache userdata product product_services oem odm"
|
||||
|
@ -2919,27 +2919,20 @@ ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
|||
# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
|
||||
ifneq ($(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) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_PARTITION_SUFFIX=_a
|
||||
endif # AB_OTA_UPDATER
|
||||
|
||||
$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE)
|
||||
define super-slot-suffix
|
||||
$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
|
||||
endef
|
||||
|
||||
# $(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) \
|
||||
--metadata-slots $(if $(filter true,$(AB_OTA_UPDATER)),2,1) \
|
||||
--super-name $(BOARD_SUPER_PARTITION_METADATA_DEVICE) \
|
||||
$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), $(if $(filter true,$(AB_OTA_UPDATER)), --auto-slot-suffixing)) \
|
||||
$(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
|
||||
--device $(device):$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)) \
|
||||
$(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
|
||||
--group $(group)$(1):$(BOARD_$(call to-upper,$(group))_SIZE) \
|
||||
$(if $(1), --group $(group)_b:$(BOARD_$(call to-upper,$(group))_SIZE)) \
|
||||
|
@ -2959,15 +2952,23 @@ define build-superimage-target
|
|||
--output $(1)
|
||||
endef
|
||||
|
||||
$(INSTALLED_SUPERIMAGE_TARGET):
|
||||
# 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.
|
||||
|
||||
ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
|
||||
INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
|
||||
$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
||||
$(call pretty,"Target super fs image: $@")
|
||||
$(call build-superimage-target,$@,$(PRIVATE_PARTITION_SUFFIX),true)
|
||||
$(call build-superimage-target,$@,$(call super-slot-suffix),true)
|
||||
endif
|
||||
|
||||
$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
|
||||
|
||||
$(INSTALLED_SUPERIMAGE_EMPTY_TARGET):
|
||||
INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
|
||||
$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE)
|
||||
$(call pretty,"Target empty super fs image: $@")
|
||||
$(call build-superimage-target,$@,$(PRIVATE_PARTITION_SUFFIX))
|
||||
$(call build-superimage-target,$@,$(call super-slot-suffix))
|
||||
|
||||
$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
|
||||
|
||||
|
@ -2989,6 +2990,25 @@ droid_targets: check-all-partition-sizes
|
|||
# Add image dependencies so that generated_*_image_info.txt are written before checking.
|
||||
check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
||||
|
||||
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
|
||||
# Check sum(super partition block devices) == super partition (/ 2 for A/B)
|
||||
# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
|
||||
define check-super-partition-size
|
||||
size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
|
||||
sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
|
||||
max_size_tail=$(if $(filter true,$(AB_OTA_UPDATER))," / 2"); \
|
||||
max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
|
||||
if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
|
||||
echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
||||
echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
|
||||
exit 1; \
|
||||
else \
|
||||
echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
|
||||
echo $${sum_sizes_expr} '==' $${max_size_expr}; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
# $(1): human-readable max size string
|
||||
# $(2): max size expression
|
||||
# $(3): list of partition names
|
||||
|
@ -3035,6 +3055,7 @@ endef
|
|||
|
||||
check-all-partition-sizes check-all-partition-sizes-nodeps:
|
||||
$(call check-all-partition-sizes-target)
|
||||
$(call check-super-partition-size)
|
||||
|
||||
endif # PRODUCT_BUILD_SUPER_PARTITION
|
||||
|
||||
|
@ -3658,7 +3679,7 @@ ifneq ($(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,)) \
|
||||
$(hide) echo $(call build-superimage-target-args,$(call super-slot-suffix)) \
|
||||
>> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
|
||||
|
|
|
@ -937,13 +937,26 @@ ifndef PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
|
|||
endif
|
||||
.KATI_READONLY := PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
|
||||
|
||||
ifeq ($(PRODUCT_USE_LOGICAL_PARTITIONS),true)
|
||||
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
|
||||
ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
|
||||
$(error PRODUCT_USE_DYNAMIC_PARTITIONS must be true when PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
|
||||
is set)
|
||||
endif
|
||||
ifdef PRODUCT_SHIPPING_API_LEVEL
|
||||
ifeq (true,$(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29))
|
||||
$(error Devices with shipping API level $(PRODUCT_SHIPPING_API_LEVEL) must not set \
|
||||
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
|
||||
requirements := \
|
||||
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
|
||||
PRODUCT_BUILD_SUPER_PARTITION \
|
||||
|
||||
$(foreach req,$(requirements),$(if $(filter false,$($(req))),\
|
||||
$(error PRODUCT_USE_LOGICAL_PARTITIONS requires $(req) to be true)))
|
||||
$(error PRODUCT_USE_DYNAMIC_PARTITIONS requires $(req) to be true)))
|
||||
|
||||
requirements :=
|
||||
|
||||
|
@ -1026,6 +1039,48 @@ BOARD_SUPER_PARTITION_PARTITION_LIST := \
|
|||
$(BOARD_$(group)_PARTITION_LIST))
|
||||
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
|
||||
|
||||
ifdef BOARD_SUPER_PARTITION_SIZE
|
||||
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
|
||||
|
||||
# The metadata device must be specified manually for retrofitting.
|
||||
ifndef BOARD_SUPER_PARTITION_METADATA_DEVICE
|
||||
$(error Must specify BOARD_SUPER_PARTITION_METADATA_DEVICE if BOARD_SUPER_PARTITION_BLOCK_DEVICES is used.)
|
||||
endif
|
||||
|
||||
# The metadata device must be included in the super partition block device list.
|
||||
ifeq (,$(filter $(BOARD_SUPER_PARTITION_METADATA_DEVICE),$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)))
|
||||
$(error BOARD_SUPER_PARTITION_METADATA_DEVICE is not listed in BOARD_SUPER_PARTITION_BLOCK_DEVICES.)
|
||||
endif
|
||||
|
||||
# The metadata device must be supplied to init via the kernel command-line.
|
||||
BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
|
||||
|
||||
else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
|
||||
|
||||
# These should not be specified on devices launching with dynamic partition support.
|
||||
ifdef BOARD_SUPER_PARTITION_BLOCK_DEVICES
|
||||
$(error BOARD_SUPER_PARTITION_BLOCK_DEVICES can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.)
|
||||
endif
|
||||
ifdef BOARD_SUPER_PARTITION_METADATA_DEVICE
|
||||
$(error BOARD_SUPER_PARTITION_METADATA_DEVICE can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.)
|
||||
endif
|
||||
|
||||
# For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the
|
||||
# build can handle both cases consistently.
|
||||
BOARD_SUPER_PARTITION_BLOCK_DEVICES := super
|
||||
BOARD_SUPER_PARTITION_METADATA_DEVICE := super
|
||||
BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE := $(BOARD_SUPER_PARTITION_SIZE)
|
||||
|
||||
endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
|
||||
endif # BOARD_SUPER_PARTITION_SIZE
|
||||
.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES
|
||||
.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE
|
||||
|
||||
$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \
|
||||
$(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \
|
||||
$(error $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty))) \
|
||||
$(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))
|
||||
|
||||
endif # PRODUCT_BUILD_SUPER_PARTITION
|
||||
|
||||
# ###############################################################
|
||||
|
|
|
@ -244,7 +244,11 @@ else
|
|||
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
|
||||
endif
|
||||
|
||||
ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.logical_partitions=$(PRODUCT_USE_LOGICAL_PARTITIONS)
|
||||
# TODO(b/119286600): remove ro.logical_partitions
|
||||
ADDITIONAL_PRODUCT_PROPERTIES += \
|
||||
ro.boot.logical_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) \
|
||||
ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) \
|
||||
ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
###
|
||||
|
|
|
@ -210,6 +210,8 @@ _product_var_list := \
|
|||
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
|
||||
PRODUCT_BUILD_SUPER_PARTITION \
|
||||
PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION \
|
||||
PRODUCT_USE_DYNAMIC_PARTITIONS \
|
||||
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
|
||||
|
||||
define dump-product
|
||||
$(info ==== $(1) ====)\
|
||||
|
|
|
@ -513,20 +513,32 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := \
|
|||
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE))
|
||||
|
||||
# Logical and Resizable Partitions feature flag.
|
||||
PRODUCT_USE_LOGICAL_PARTITIONS := \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS))
|
||||
.KATI_READONLY := PRODUCT_USE_LOGICAL_PARTITIONS
|
||||
# Dynamic partition feature flags.
|
||||
|
||||
# All requirements of PRODUCT_USE_LOGICAL_PARTITIONS falls back to
|
||||
# PRODUCT_USE_LOGICAL_PARTITIONS if not defined.
|
||||
# When this is true, dynamic partitions is retrofitted on a device that has
|
||||
# already been launched without dynamic partitions. Otherwise, the device
|
||||
# is launched with dynamic partitions.
|
||||
# This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS.
|
||||
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS := \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
|
||||
.KATI_READONLY := PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
|
||||
|
||||
# TODO(b/119286600): remove PRODUCT_USE_LOGICAL_PARTITIONS
|
||||
PRODUCT_USE_DYNAMIC_PARTITIONS := $(or \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_PARTITIONS)), \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS)), \
|
||||
$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
|
||||
.KATI_READONLY := PRODUCT_USE_DYNAMIC_PARTITIONS
|
||||
|
||||
# All requirements of PRODUCT_USE_DYNAMIC_PARTITIONS falls back to
|
||||
# PRODUCT_USE_DYNAMIC_PARTITIONS if not defined.
|
||||
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := $(or \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
|
||||
$(PRODUCT_USE_LOGICAL_PARTITIONS))
|
||||
$(PRODUCT_USE_DYNAMIC_PARTITIONS))
|
||||
.KATI_READONLY := PRODUCT_USE_DYNAMIC_PARTITION_SIZE
|
||||
PRODUCT_BUILD_SUPER_PARTITION := $(or \
|
||||
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BUILD_SUPER_PARTITION)),\
|
||||
$(PRODUCT_USE_LOGICAL_PARTITIONS))
|
||||
$(PRODUCT_USE_DYNAMIC_PARTITIONS))
|
||||
.KATI_READONLY := PRODUCT_BUILD_SUPER_PARTITION
|
||||
|
||||
# List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence
|
||||
|
|
Loading…
Reference in New Issue