db845c: Enable booting from mmc-sdcard

This is an experimental build configuration and only used to
boot AOSP on mmc sdcard on DB845c and RB5 in the LKFT lab.
Regular users should not enable this build flag and should
boot from UFS instead.

Booting from external sdcards will help prevent the internal
emmc/ufs wear off in the long run and extend the lab-life of
most of our devboards.

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. As of today, 1st AOSP/main boot
with Linux kernel v6.7 on a 16GB Samsung EVO+ SDHCI sdcard
takes just under 3mins to boot to UI and subsequent reboot
to UI takes just over 1min.

Using U-Boot to partition and flash mmc sdcard:
To avoid flashing anything on internal UFS and boot solely
from a sdcard, we are switching to chainloading U-Boot from
ABL bootloader. For now we are using an upstream U-Boot fork
for DB845c and RB5 and its currently under work-in-progress:
https://source.devboardsforandroid.linaro.org/platform/external/u-boot/
Since upstream U-Boot only support boot image header version
2, so we are also using the same. It also helps us load and
boot with boot.img from RAM using "fastboot boot boot.img"
command in the lab. In the long run we plan to switch to
AOSP/external/u-boot project to catch up with all the
Android bootloader features. We are using U-Boot "gpt" and
"fastboot" commands to create partition table on external
sdcard and flash AOSP super and userdata images. Follow the
U-Boot instructions here to prepare a sdcard to boot AOSP:
https://devboardsforandroid.linaro.org/en/latest/devices/rb3.html#booting-aosp-from-mmc-sdcard

Loading UFS driver from vendor_dlkm partition:
The AOSP's first_stage_init mount take the first platform
block device it finds and continues with it, irrespective of
the androidboot.boot_devices bootarg. This is a blocker for
us to boot from mmc sdcard because first_stage_init always
tried to look for and mount UFS partitions. In order to
avoid touching first_stage_init boot / mount flow in
AOSP/system/core project, we will be loading UFS driver from
vendor_dlkm partition so that UFS gets probed later in the
boot cycle.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I20cd89df8b5f1fdb1bf712232284d6d754518d8f
8 files changed