aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-06-11 12:56:28 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-06-11 12:56:28 +0000
commit28c259771d13181235e64d5cfc7ad2e5b02d91e8 (patch)
treef075bfd7f0f75abc5722f8379b73d8bbb8d0b853
parent651f4a64e14438abe03c8ea7a01763b0e40fc533 (diff)
parent13782ef887133f0e8fb1373191858dba8fa9da24 (diff)
downloadbuild-28c259771d13181235e64d5cfc7ad2e5b02d91e8.tar.gz
Merge "16k: Define PRODUCT_MAX_PAGE_SIZE_SUPPORTED flag" into android13-gsi
-rw-r--r--core/config.mk45
-rw-r--r--core/product.mk8
-rw-r--r--core/soong_config.mk1
3 files changed, 53 insertions, 1 deletions
diff --git a/core/config.mk b/core/config.mk
index 7f0e98ef59..58c5cc0438 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -352,6 +352,51 @@ endif
# are specific to the user's build configuration.
include $(BUILD_SYSTEM)/envsetup.mk
+# Returns true if it is a low memory device, otherwise it returns false.
+define is-low-mem-device
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_PROPERTY_OVERRIDES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_COMPATIBLE_PROPERTY)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_SYSTEM_EXT_PROPERTIES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_PRODUCT_PROPERTIES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_VENDOR_PROPERTIES)),true,\
+$(if $(findstring ro.config.low_ram=true,$(PRODUCT_ODM_PROPERTIES)),true,false)))))))))
+endef
+
+# Get the board API level.
+board_api_level := $(PLATFORM_SDK_VERSION)
+ifdef BOARD_API_LEVEL
+ board_api_level := $(BOARD_API_LEVEL)
+else ifdef BOARD_SHIPPING_API_LEVEL
+ # Vendors with GRF must define BOARD_SHIPPING_API_LEVEL for the vendor API level.
+ board_api_level := $(BOARD_SHIPPING_API_LEVEL)
+endif
+
+# Calculate the VSR vendor API level.
+vsr_vendor_api_level := $(board_api_level)
+
+ifdef PRODUCT_SHIPPING_API_LEVEL
+ vsr_vendor_api_level := $(call math_min,$(PRODUCT_SHIPPING_API_LEVEL),$(board_api_level))
+endif
+
+# Set TARGET_MAX_PAGE_SIZE_SUPPORTED.
+ifdef PRODUCT_MAX_PAGE_SIZE_SUPPORTED
+ TARGET_MAX_PAGE_SIZE_SUPPORTED := $(PRODUCT_MAX_PAGE_SIZE_SUPPORTED)
+else ifeq ($(strip $(call is-low-mem-device)),true)
+ # Low memory device will have 4096 binary alignment.
+ TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
+else
+ # The default binary alignment for userspace is 4096.
+ TARGET_MAX_PAGE_SIZE_SUPPORTED := 4096
+ # When VSR vendor API level >= 34, binary alignment will be 65536.
+ ifeq ($(call math_gt_or_eq,$(vsr_vendor_api_level),34),true)
+ TARGET_MAX_PAGE_SIZE_SUPPORTED := 65536
+ endif
+endif
+.KATI_READONLY := TARGET_MAX_PAGE_SIZE_SUPPORTED
+
# Pruned directory options used when using findleaves.py
# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS
FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(SCAN_EXCLUDE_DIRS) .repo .git)
diff --git a/core/product.mk b/core/product.mk
index 53fee1c54f..dfc403c264 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -25,7 +25,13 @@ _product_list_vars :=
_product_single_value_vars += PRODUCT_NAME
_product_single_value_vars += PRODUCT_MODEL
-# The resoure configuration options to use for this product.
+# Defines the ELF segment alignment for binaries (executables and shared libraries).
+# The ELF segment alignment has to be a PAGE_SIZE multiple. For example, if
+# PRODUCT_MAX_PAGE_SIZE_SUPPORTED=65536, the possible values for PAGE_SIZE could be
+# 4096, 16384 and 65536.
+_product_single_value_vars += PRODUCT_MAX_PAGE_SIZE_SUPPORTED
+
+# The resource configuration options to use for this product.
_product_list_vars += PRODUCT_LOCALES
_product_list_vars += PRODUCT_AAPT_CONFIG
_product_single_value_vars += PRODUCT_AAPT_PREF_CONFIG
diff --git a/core/soong_config.mk b/core/soong_config.mk
index d03b687464..8c9793fb66 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -142,6 +142,7 @@ $(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(fi
$(call add_json_bool, Malloc_zero_contents, $(call invert_bool,$(filter false,$(MALLOC_ZERO_CONTENTS))))
$(call add_json_bool, Malloc_pattern_fill_contents, $(MALLOC_PATTERN_FILL_CONTENTS))
$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
+$(call add_json_str, DeviceMaxPageSizeSupported, $(TARGET_MAX_PAGE_SIZE_SUPPORTED))
$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
$(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))