linaro_swr: make build pg_agnostic and support 4k/16k page size kernels

To be able to support both 16k page size and 4k pagesize kernels with
the same images, the filesystem block size would need to be 4k. 16k
pagesize kernel can't work with 4k filesystem block size.

More performance gains can be seen if userspace if built for 16k
pagesize kernel where we can use a 16k filesystem block size as well.

While doing this, restrict /userdata to ext4 only, so this will work
without issues of f2fs not supporting different block sizes between fs
and kernel.

Change-Id: Ie7a89c6d78cf660daa0d47173d5b7ecf1f8227a3
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
diff --git a/linaro_swr/BoardConfig.mk b/linaro_swr/BoardConfig.mk
index 9676554..abdd5f2 100644
--- a/linaro_swr/BoardConfig.mk
+++ b/linaro_swr/BoardConfig.mk
@@ -16,7 +16,7 @@
 BOARD_MKBOOTIMG_ARGS := --header_version $(BOARD_BOOT_HEADER_VERSION)
 
 BOARD_KERNEL_BASE := 0x80000000
-BOARD_KERNEL_PAGESIZE := 4096
+# BOARD_KERNEL_PAGESIZE := 4096
 BOARD_KERNEL_CMDLINE += earlycon firmware_class.path=/vendor/firmware/
 BOARD_KERNEL_CMDLINE += init=/init printk.devkmsg=on
 BOARD_KERNEL_CMDLINE += deferred_probe_timeout=30
@@ -26,6 +26,14 @@
 BOARD_BOOTCONFIG := androidboot.hardware=linaro_swr androidboot.boot_devices=soc@0/1d84000.ufshc
 BOARD_BOOTCONFIG += androidboot.verifiedbootstate=orange
 
+# page-agnostic needs
+BOARD_MKBOOTIMG_ARGS += --pagesize 4096
+INTERNAL_VENDOR_BOOTIMAGE_ARGS += --pagesize 4096
+
+# since f2fs doesn't support multiple pagesize kernels,
+# set /userdata to ext4 for this build target
+BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4
+
 # Image Configuration
 BOARD_BOOTIMAGE_PARTITION_SIZE := 100663296 #96M
 BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 100663296 #96M
diff --git a/linaro_swr/device.mk b/linaro_swr/device.mk
index 8219bfb..438383e 100644
--- a/linaro_swr/device.mk
+++ b/linaro_swr/device.mk
@@ -66,4 +66,9 @@
 TARGET_HARDWARE := linaro_swr
 TARGET_KERNEL_USE ?= 6.6
 
+# Page agnostic support - will build ELF files 16K aligned,
+# which will allow 4k/16k page size aligned kernels
+PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 16384
+PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO := true
+
 include device/linaro/dragonboard/device-common.mk