16k: core: Add flag to make AOSP page size agnostic
The new boolean flag will be PRODUCT_PAGE_SIZE_AGNOSTIC.
When PRODUCT_PAGE_SIZE_AGNOSTIC is true:
- AOSP will use getpagesize() to retrieve the page size.
- The flag `TARGET_MAX_PAGE_SIZE_SUPPORTED` has to be equals to `65536`.
- AOSP will be able to use 4k/16k page size Linux kernels
When PRODUCT_PAGE_SIZE_AGNOSTIC is false:
- AOSP will only support 4k page size kernels.
Test: source build/envsetup.sh
lunch aosp_raven_64-userdebug
get_build_var TARGET_PAGE_SIZE_AGNOSTIC
get_build_var PRODUCT_MAX_PAGE_SIZE_SUPPORTED
65536
source build/envsetup.sh
lunch aosp_raven_64-userdebug
build/make/core/config.mk:414: error: TARGET_MAX_PAGE_SIZE_SUPPORTED has to be 65536 to support page size agnostic.
10:32:55 dumpvars failed with: exit status 1
Bug: 289419664
Change-Id: If8fc243a3e2cad77414a53a29805c7b6d349d4dd
diff --git a/core/config.mk b/core/config.mk
index 55ff6ba..920e457 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -425,6 +425,7 @@
endif
# Set TARGET_MAX_PAGE_SIZE_SUPPORTED.
+# TARGET_MAX_PAGE_SIZE_SUPPORTED indicates the alignment of the ELF segments.
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)
@@ -440,6 +441,19 @@
endif
.KATI_READONLY := TARGET_MAX_PAGE_SIZE_SUPPORTED
+# Boolean variable determining if AOSP is page size agnostic. This means
+# that AOSP can use a kernel configured with 4k/16k/64k PAGE SIZES.
+TARGET_PAGE_SIZE_AGNOSTIC := false
+ifdef PRODUCT_PAGE_SIZE_AGNOSTIC
+ TARGET_PAGE_SIZE_AGNOSTIC := $(PRODUCT_PAGE_SIZE_AGNOSTIC)
+ ifeq ($(TARGET_PAGE_SIZE_AGNOSTIC),true)
+ ifneq ($(TARGET_MAX_PAGE_SIZE_SUPPORTED),65536)
+ $(error TARGET_MAX_PAGE_SIZE_SUPPORTED has to be 65536 to support page size agnostic)
+ endif
+ endif
+endif
+.KATI_READONLY := TARGET_PAGE_SIZE_AGNOSTIC
+
# 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)