This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: Boot from eMMC

Part Number: AM6442

Hi,

My customer is struggling to boot from eMMC on GPEVM.
Could you give some help?

Here are steps customer tried.
1) boot from SD card
2) create emmc partition as below.

# > fdisk /dev/mmcblk0
Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk0p1         2048  411647  409600  200M  c W95 FAT32 (LBA)
/dev/mmcblk0p2       411648 5531647 5120000  2.4G 83 Linux
/dev/mmcblk0p3      5531648 7628799 2097152    1G 82 Linux swap / Solaris
# > mkfs.vfat /dev/mmcblk0p1

3) After format, tispl.bin, uEnv.txt, tiboot3.bin, u-boot.img are copied from
/dev/mmcblk1p1 to /dev/mmcblk0p1

4) change boot mode to eMMC boot (SW2 bit4 is off)

5) Power cycle the board, but no console output is seen.

Are there any differences booting from SD card and eMMC?
(Building steps for tiboot3.bin, tispl.bin, u-boot.img, etc.)

Thanks and regards,
Koichiro Tashiro

  • Hi Koichiro-san,
    Please refer to the following link for eMMC flashing on AM64x EVM
    software-dl.ti.com/.../UG-Memory.html
    Best,
    -Hong

  • Hi Hong,

    Sorry for the late reply.
    Customer refers to the link.
    Then he tried to write binary to /dev/mmcblk0boot0, but it generate an error.

    Here is log:

    root@pos-periph:/media# dd if=tiboot3.bin of=/dev/mmcblk0boot0
    dd: writing to '/dev/mmcblk0boot0': Operation not permitted
    1+0 records in
    0+0 records out
    0 bytes copied, 0.0112773 s, 0.0 kB/s
    root@pos-periph:/media# dd if=tispl.bin of=/dev/mmcblk0boot0 bs=512 skip=2
    dd: error writing '/dev/mmcblk0boot0': Operation not permitted
    1+0 records in
    0+0 records out
    0 bytes copied, 0.0109272 s, 0.0 kB/s
    root@pos-periph:/media# dd if=tiboot3.bin of=/dev/mmcblk0
    mmcblk0       mmcblk0boot1  mmcblk0p2     mmcblk0rpmb
    mmcblk0boot0  mmcblk0p1     mmcblk0p3
    root@pos-periph:/media# dd if=tiboot3.bin of=/dev/mmcblk0p1
    722+1 records in
    722+1 records out
    370114 bytes (370 kB, 361 KiB) copied, 0.027626 s, 13.4 MB/s
    


    Are you able to boot from eMMC?
    Do we need any configuration to write /dev/mmcblk0boot0 ?

    By the way, the link writes /dev/mmcblk0boot0 from u-boot, but customer try to write /dev/mmcblk0boot0 from Linux.
    Is this OK?

    Thanks and reagrds,
    Koichiro Tashiro

  • Hi Koichiro-san,
    Yes, we're able to flash u-boot/kernel/rootfs... to eMMC, and then boot from eMMC on AM64x GP EVM.

    Due to the sensitive nature of the eMMC boot partition contents, which often store a bootloader or bootloader configuration tables crucial to booting the platform, write access is disabled by default in kernel to reduce the chance of accidental bricking.

    If needed, it is possible to disable eMMC boot partitions write protection in Linux.
    For more details, refer www.kernel.org/.../mmc-dev-parts.txt
    I'm attaching a log file for your reference.

    Best,
    -Hong

    root@am64xx-evm:~# uname -a
    Linux am64xx-evm 5.10.41-g4c2eade9f7 #1 SMP PREEMPT Tue Aug 10 21:52:40 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
    root@am64xx-evm:~# ls -l /dev/mmcblk*
    brw-rw---- 1 root disk 179, 32 Aug 10 22:07 /dev/mmcblk0
    brw-rw---- 1 root disk 179, 64 Aug 10 22:10 /dev/mmcblk0boot0
    brw-rw---- 1 root disk 179, 96 Aug 10 22:07 /dev/mmcblk0boot1
    brw-rw---- 1 root disk 179, 33 Aug 10 22:07 /dev/mmcblk0p1
    crw------- 1 root root 237,  0 Aug 10 22:07 /dev/mmcblk0rpmb
    brw-rw---- 1 root disk 179,  0 Aug 10 22:07 /dev/mmcblk1
    brw-rw---- 1 root disk 179,  1 Aug 10 22:07 /dev/mmcblk1p1
    brw-rw---- 1 root disk 179,  2 Aug 10 22:07 /dev/mmcblk1p2
    root@am64xx-evm:~# lsblk -b /dev/mmcblk0p1
    NAME      MAJ:MIN RM        SIZE RO TYPE MOUNTPOINT
    mmcblk0p1 179:33   0 15913155072  0 part /run/media/mmcblk0p1
    root@am64xx-evm:~# lsblk -b /dev/mmcblk0boot0
    NAME         MAJ:MIN RM     SIZE RO TYPE MOUNTPOINT
    mmcblk0boot0 179:64   0 33030144  1 disk 
    root@am64xx-evm:~# cat /sys/block/mmcblk0boot0/force_ro
    1
    root@am64xx-evm:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
    root@am64xx-evm:~# cat /sys/block/mmcblk0boot0/force_ro
    0
    root@am64xx-evm:~# lsblk -b /dev/mmcblk0boot0
    NAME         MAJ:MIN RM     SIZE RO TYPE MOUNTPOINT
    mmcblk0boot0 179:64   0 33030144  0 disk 
    root@am64xx-evm:~# echo 1 > /sys/block/mmcblk0boot0/force_ro
    root@am64xx-evm:~# cat /sys/block/mmcblk0boot0/force_ro
    1
    root@am64xx-evm:~# lsblk -b /dev/mmcblk0boot0
    NAME         MAJ:MIN RM     SIZE RO TYPE MOUNTPOINT
    mmcblk0boot0 179:64   0 33030144  1 disk 
    root@am64xx-evm:~# 

  • Hi Hong,

    Thanks. Customer understands writing to eMMC from kernel is disabled by default.
    Now he tried to write in u-boot as described in UG-Memory.html.
    Here is the log.

    Environment size: 4670/131068 bytes
    => mmc dev 0 1
    switch to partitions #1, OK
    mmc0(part 1) is current device
    => fatload mmc 1 0x82000000 tiboot3.bin
    370114 bytes read in 19 ms (18.6 MiB/s)
    => mmc write 0x82000000 0x0 0x400
    
    MMC write: dev # 0, block # 0, count 1024 ... 1024 blocks written: OK
    => fatload mmc 1 0x88000000 tispl.bin
    658316 bytes read in 30 ms (20.9 MiB/s)
    => mmc write 0x88000000 0x400 0x1000
    
    MMC write: dev # 0, block # 1024, count 4096 ... 4096 blocks written: OK
    => fatload mmc 1 0x89000000 u-boot.img
    887436 bytes read in 41 ms (20.6 MiB/s)
    => mmc write 0x89000000 0x1400 0x2000
    
    MMC write: dev # 0, block # 5120, count 8192 ... 8192 blocks written: OK
    =>
    


    After eMMC was written, boot mode was switch like below.
    Before(SD boot)
    SW2.7 on
    SW2.6 off
    SW2.5 off
    SW2.4 off

    After (eMMC boot)
    SW2.7 on
    SW2.6 off
    SW2.5 off
    SW2.4 on

    But nothing is displayed in serial console. With SD card boot, boot message appears on the console.
    Anything is missed here?

    Thanks and regards,
    Koichiro Tashiro

  • Hi Koichiro-san,
    I'm attaching a log file I used to flashing eMMC on AM64x GP EVM for your reference.
    Do we know the following two cmds are ran @u-boot prompt after flashing eMMC?

    => mmc partconf 0 1 1 1
    => mmc bootbus 0 2 0 0

    Best,

    -Hong

    => mmc dev 0 1
    switch to partitions #1, OK
    mmc0(part 1) is current device
    => fatload mmc 1 ${loadaddr} tiboot3.bin
    370114 bytes read in 19 ms (18.6 MiB/s)
    => mmc write ${loadaddr} 0x0 0x400
    
    MMC write: dev # 0, block # 0, count 1024 ... 1024 blocks written: OK
    => fatload mmc 1 ${loadaddr} tispl.bin
    658220 bytes read in 32 ms (19.6 MiB/s)
    => mmc write ${loadaddr} 0x400 0x1000
    
    MMC write: dev # 0, block # 1024, count 4096 ... 4096 blocks written: OK
    => fatload mmc 1 ${loadaddr} u-boot.img
    888060 bytes read in 41 ms (20.7 MiB/s)
    => mmc write ${loadaddr} 0x1400 0x2000
    
    MMC write: dev # 0, block # 5120, count 8192 ... 8192 blocks written: OK
    => mmc partconf 0 1 1 1
    => mmc bootbus 0 2 0 0
    => 

  • Hi Hong,

    Thanks!
    Adding the last two commands solved the issue at customer.

    Thanks and regards,
    Koichiro Tashiro