sm8x50: Enable booting from mmc-sdcard
Set TARGET_SDCARD_BOOT=true at build time to build and boot
AOSP from mmc sdcard. This device configuration need atleast
16GB sdcard to boot from.
Booting from external sdcards will help prevent the internal
emmc/ufs wear off in the long run and extend the lab-life of
SM8550-HDKs.
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I59530d39915c051565e9d02087164c1cbd1fbae2
diff --git a/sm8x50/BoardConfig.mk b/sm8x50/BoardConfig.mk
index 4995b75..43f437f 100644
--- a/sm8x50/BoardConfig.mk
+++ b/sm8x50/BoardConfig.mk
@@ -23,17 +23,34 @@
BOARD_KERNEL_CMDLINE += qcom_geni_serial.con_enabled=1
BOARD_KERNEL_CMDLINE += console=ttyMSM0,115200n8
BOARD_KERNEL_CMDLINE += allow_mismatched_32bit_el0 clk_ignore_unused pd_ignore_unused
+
+ifeq ($(TARGET_SDCARD_BOOT), true)
+BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc@0/8804000.mmc
+else
BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc@0/1d84000.ufs
+endif
+
BOARD_KERNEL_CMDLINE += androidboot.hardware=sm8x50
BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
# Image Configuration
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864 #64M
+
+ifeq ($(TARGET_SDCARD_BOOT), true)
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 8589934592 #8G
+BOARD_FLASH_BLOCK_SIZE := 4096
+# Super partition
+BOARD_SUPER_PARTITION_SIZE := 4294967296 #4G
+BOARD_DB_DYNAMIC_PARTITIONS_SIZE := 4290772992 # Reserve 4M for DAP metadata
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/utils/sdcard-boot/sepolicy/
+else
BOARD_USERDATAIMAGE_PARTITION_SIZE := 223226966016 #200+G
BOARD_FLASH_BLOCK_SIZE := 131072
# Super partition
BOARD_SUPER_PARTITION_SIZE := 6442450944 #6GB
BOARD_DB_DYNAMIC_PARTITIONS_SIZE := 6438256640 # Reserve 4M for DAP metadata
+endif
+
BOARD_SUPER_PARTITION_METADATA_DEVICE := super
BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE := true
BOARD_DB_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor system_ext product
diff --git a/sm8x50/device.mk b/sm8x50/device.mk
index 1613a5f..8928c74 100644
--- a/sm8x50/device.mk
+++ b/sm8x50/device.mk
@@ -51,9 +51,11 @@
device/linaro/dragonboard/shared/utils/ethaddr/ethaddr.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/ethaddr.rc \
device/linaro/dragonboard/shared/utils/ethaddr/set_ethaddr.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_ethaddr.sh
+ifneq ($(TARGET_SDCARD_BOOT), true)
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/fstab:$(TARGET_COPY_OUT_RAMDISK)/first_stage_ramdisk/fstab.sm8x50 \
$(LOCAL_PATH)/fstab:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.sm8x50
+endif
PRODUCT_VENDOR_PROPERTIES += \
ro.soc.manufacturer=Snapdragon 8 Gen Devboard \
diff --git a/sm8x50/sm8x50.mk b/sm8x50/sm8x50.mk
index 55f8476..d48f645 100644
--- a/sm8x50/sm8x50.mk
+++ b/sm8x50/sm8x50.mk
@@ -17,6 +17,9 @@
$(call inherit-product, device/linaro/dragonboard/sm8x50/device.mk)
+#Boot from mmc-sdcard
+TARGET_SDCARD_BOOT ?= false
+
# Product overrides
PRODUCT_NAME := sm8x50
PRODUCT_DEVICE := sm8x50