3.4. Android on SD Card

This applications Notes contains step to use SD Card instead of EMMC.

3.4.1. Build U-Boot with this changes

3.4.1.1. Download sources

Follow this link to download Bootloader sources.

Apply this patch in U-boot source code:

diff --git a/configs/am62x_android_a53.config b/configs/am62x_android_a53.config
index fc949f65d7fe..d50952557192 100644
--- a/configs/am62x_android_a53.config
+++ b/configs/am62x_android_a53.config
@@ -5,7 +5,7 @@ CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
# Enable Android boot flow
CONFIG_SYS_MALLOC_LEN=0x08000000

3.4.1.2. Build U-Boot

Follow this link to build U-Boot.

Rebuild U-boot then copy u-boot.img in Android build system environment : vendor/ti/am62x/bootloader/am62-sk

3.4.1.3. Build Android

Follow this link to build Android image. Go in your Android environment then rebuild with TARGET_SDCARD_BOOT=true build args:

cd ${YOUR_PATH}/ti-aosp-13
lunch <BUILD_TARGET>
m TARGET_SDCARD_BOOT=true

Warning

If using the AM62X LP SK EVM, the following patch needs to be applied in device/ti/am62x

commit 337223e9fe4777d603a6c9c7830a6a6947a01d72 (HEAD -> mkorpershoek/sdcard-boot)
Author: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Date:   Tue Feb 6 10:01:29 2024 +0100

    Boardconfig: add tps65219 to vendor ramdisk modules

    On AM62X LP SK, when booting from SD card (TARGET_SDCARD_BOOT=true),
    the system panics early because we can't mount early partitions:

    [   14.564779][   T48] gpio-regulator regulator-4: Failed to register regulator: -517
    [   14.573021][   T50] platform regulator-4: deferred probe pending
    [   14.708155][    T1] init: Wait for partitions returned after 10010ms
    [   14.714568][    T1] init: bool
    android::init::BlockDevInitializer::InitDevices(std::set<std::string>):
    partition(s) not found after polling timeout: metadata, super
    [   14.729555][    T1] init: Failed to mount required partitions early

    The regulator-4 gets deferred because the vin-supply (ldo1_reg) is not
    available.  In fact, ldo1_reg is provided by the ti,tps65219 pmic driver
    module and that module is not shipped in the vendor ramdisk.

    Add the tps65219 module and its dependencies to the vendor ramdisk.
    This fixes booting from SD Card on AM62x LP SK EVM.

    Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

diff --git a/BoardConfig.mk b/BoardConfig.mk
index 60756cb6d646..5604c32db022 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -262,6 +262,9 @@ BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/tidss.ko \
        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/sii902x.ko \
        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/display-connector.ko \
-        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/panel-simple.ko
+        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/panel-simple.ko \
+        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/tps65219.ko \
+        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/tps65219-pwrbutton.ko \
+        device/ti/am62x-kernel/kernel/$(TARGET_KERNEL_USE)/tps65219-regulator.ko

BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD +=  $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)

3.4.1.4. Flashing SD Card

Warning

Minimal size for SD card is 16GB

  • Change the Boot Mode DIP switches to SD card boot mode.

    Boot mode DIP Switch:
    SW1: 11000010 SW2: 01000000
    
  • Go in out dir in android environment and launch this command:

    # If you are using binaries built locally
    cd out/target/product/am62x
    sudo ./flashall.sh --board="am62x-sk" --sdcard="/dev/sdX"
    

flashall.sh script print in your console instruction to do

Note

Replace X in /dev/sdX/ by letter corresponding to your SDCard