SD card

Instead of using eMMC as boot medium, it’s possible to boot from SD card instead. To boot Android from SD card, a couple of software components need to be rebuild.

Build U-Boot with this changes

Follow this link to download the Downloading sources.

Apply this patch in U-Boot source code:

diff --git a/configs/am62x_a53_android.config b/configs/am62x_a53_android.config
index 55fa93b140f9..dd0d36069d74 100644
--- a/configs/am62x_a53_android.config
+++ b/configs/am62x_a53_android.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_CMD_GPT=y # Needed for FASTBOOT_CMD_OEM_FORMAT
 CONFIG_RANDOM_UUID=y # Needed for FASTBOOT_CMD_OEM_FORMAT
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
diff --git a/include/env/ti/android.env b/include/env/ti/android.env
index a058beb7fc42..693806550853 100644
--- a/include/env/ti/android.env
+++ b/include/env/ti/android.env
@@ -24,8 +24,8 @@ partitions+=name=userdata,size=-,uuid=${uuid_gpt_userdata}
 fastboot_raw_partition_bootenv=0x800 0x400 mmcpart 1
 fastboot.partition-type:metadata=f2fs

-boot_targets=mmc0
-mmcdev=0
+boot_targets=mmc1
+mmcdev=1
 bootmeths=android
 vendor_boot_comp_addr_r=0xd0000000
 bootcmd=bootflow scan -lb

Build U-Boot

Follow this link to build the bootloaders: Android Bootloaders.

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

Build Android

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

$ cd ${YOUR_PATH}/ti-aosp-15
$ source build/envsetup.sh
$ lunch <BUILD_TARGET>
$ m TARGET_SDCARD_BOOT=true

Flashing SD Card

Note

  • Minimal size for SD card is 16GB

  • AM62PX is picky about SD card compatibility, see troubleshooting section below

  • Change the boot mode DIP switches to SD card boot mode:

    Switch Label

    SW2: 12345678

    SW3: 12345678

    SD

    01000000

    11000010

  • Go in out directory in android environment and launch this command:

    $ cd out/target/product/am62p
    $ sudo ./flashall.sh --board="am62px-sk" --sdcard="/dev/sdX"
    

    Note

    The flashall.sh script requires you to transfer the SD Card from the host to the board at some point while it is running. Do not interrupt it. After flashing the SD Card, it will pause execution and wait for actions to be completed from the bootloader on the board. The board must have the boot pins set up for SD Card boot (see above). Here is a summary of the procedure:

    • Set the board boot pins to SD Card (see above).

    • Run the flashall.sh script with the proper arguments to flash the SD Card.

    • Transfer the SD Card to the board when requested by the script without interrupting its execution.

    • Power on the board and interrupt the boot flow to get the bootloader prompt.

    • Run the printed commands as given by the script.

    • Upon reboot, interrupt the boot to get the bootloader prompt again.

    • Set the board into fastboot mode ( fastboot 0 ).

    • On the host, press any key (or enter) to get the flashall.sh script to continue its execution and finish the flash procedure.

Tip

Replace X in /dev/sdX/ by letter corresponding to your SD card

Known issues

AM62PX compatibility

AM62PX is known to be quite picky about which SD cards are compatible. If you observe the following error, make sure you try another SD card.

U-Boot SPL 2023.04-00001-g4b7ab5b72e6c (Jul 09 2024 - 13:29:27 +0200)
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.2.7--v09.02.07 (Kool Koala)')
SPL initial stack usage: 17064 bytes
Trying to boot from MMC2
spl_register_fat_device: fat register err - -1
spl_load_image_fat: error reading image tispl.bin, err - -1
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Erase eMMC

The boot ROM can get confused when there are both bootloaders on eMMC and SD card. To erase the eMMC, run the following commands from U-Boot prompt:

# mmc0boot0
=> mmc dev 0 1
=> mmc erase 0 0xfc00

# mmc0boot1
=> mmc dev 0 2
=> mmc erase 0 0xfc00

# user partition
=> mmc dev 0 0
=> mmc erase 0 0x1da4000