Hi, All:
I got some hole/trap with am5749_IDK eMMC boot with fat mode.
I saw some unsolved thread on forum.
Thus, I write down the note for someone get the same hole/trap.
I will close the thread tomorrow.
//---root cause
am5749 supports eMMC boot with 2 mode:
1.fat mode
2.raw mode
The eMMC fat mode, the partition must be:
Type: W95 FAT32
ID: c
and this partition should be set bootable flag.
The hole/trap is :
Usually, the fdisk creates partition with ID:83/type:Linux.
It is must to change partition from ID:83/type:Linux to ID:c/type:W95 FAT32
Below is operation note for fat mode and raw mode:
//---environment
[Board] am5749 IDK
[SDK] ti-processor-sdk-linux-am57xx-evm-06.03.00.106-Linux-x86-Install.bin
[Hardware rework]
The am5749_IDK, the sysboot default is 0x8106.
Booting devices order is
1:SD
2:QSPI_1
Changin sysboot from 0x8106 to 0x8102.
(Moving resistor from R436 to R455)
Booting devices order is
1:USB
2:SD
3:eMMC
//---operation note
[fat mode]
Plug in SD card and boot to linux.
SD card is /dev/mmcblk0
eMMC is /dev/mmcblk1
clear eMMC 1M bytes
dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=2K
sync
reboot
check status of eMMC
fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 14.8 GiB, 15913189376 bytes, 31080448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
create partition on eMMC
fdisk /dev/mmcblk1
list status of eMMC
p
Disk /dev/mmcblk1: 14.8 GiB, 15913189376 bytes, 31080448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5b9b8212
create a new empty DOS partition table
o
Created a new DOS disklabel with disk identifier 0x76a6abe2.
create partition#1
n
p
1
2048
+70M
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 145407 143360 70M 83 Linux
change partition#1 type from linux to dos
t
c
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 145407 143360 70M c W95 FAT32 (LBA)
set bootable flag
a
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 2048 145407 143360 70M c W95 FAT32 (LBA)
create partition#2
n
p
2
[enter]
[enter]
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 2048 145407 143360 70M c W95 FAT32 (LBA)
/dev/mmcblk1p2 145408 31080447 30935040 14.8G 83 Linux
write to /dev/mmcblk1
w
format filesystem
mkfs.fat /dev/mmcblk1p1 -n boot
mkfs.ext4 /dev/mmcblk1p2 -L rootfs
reboot and auto mount mmcblk1p1 & mmcblk1p2 to /run/media
reboot
copy boot and rootfs to mmcblk1p1 & mmcblk1p2.
There is a trick method:
create a am5749_IDK SD card with SDK.
Plug in the SD card in USB with card reader.
My case, the device node is located at /run/media/sda1 and /run/media/sda2.
cp /run/media/sda1/* /run/media/mmcblk1p1
cp /run/media/sda2/* /run/media/mmcblk1p2 -r
sync
Press and hold reset button.
Remove SD card
Release reset button and test eMMC boot with fat mode.
[raw mode]
Plug in SD card and boot to linux.
SD card is /dev/mmcblk0
eMMC is /dev/mmcblk1
clear eMMC 1M bytes
dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=2K
sync
reboot
dump MLO to eMMC at 0x100 sector, ROM will get it.
dd if=/run/media/mmcblk0p1/MLO of=/dev/mmcblk1 bs=512 seek=256
dump uboot.img to eMMC at 0x300 sector, MLO will get it.
dd if=/run/media/mmcblk0p1/u-boot.img of=/dev/mmcblk1 bs=512 seek=768
create file system on eMMC.
In order to keep zone for uboot.ing, first partition must start at 4096 instead of 2048.
create partition on eMMC
fdisk /dev/mmcblk1
list status of eMMC
p
Disk /dev/mmcblk1: 14.8 GiB, 15913189376 bytes, 31080448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8d681464
create a new empty DOS partition table
o
Created a new DOS disklabel with disk identifier 0x875af9a3.
create partition#1
n
p
1
4096
+70M
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 4096 147455 143360 70M 83 Linux
change partition#1 type from linux to dos
t
c
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 4096 147455 143360 70M c W95 FAT32 (LBA)
set bootable flag
a
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 4096 147455 143360 70M c W95 FAT32 (LBA)
create partition#2,
!!! Caution !!! the First setor is NOT 2048.
First setor is next to end of partition#1.
This case is 143360+1 = 143361
key in and fdisk will tell you
Sector 143361 is already allocated.
First sector (147456-31080447, default 147456)
n
p
2
147456
[enter]
list status of eMMC
p
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 * 4096 147455 143360 70M c W95 FAT32 (LBA)
/dev/mmcblk1p2 147456 31080447 30932992 14.8G 83 Linux
write to /dev/mmcblk1
w
format filesystem
mkfs.fat /dev/mmcblk1p1 -n boot
mkfs.ext4 /dev/mmcblk1p2 -L rootfs
reboot and auto mount file system
partition #1 is vfat, empty it. just for compatibility.
partition #2 is ext4 for rootfs.
After running fdisk, mkfs.vfat, mkfs.ext4, and
reboot,
there are :
/run/media/mmcblk1p1
/run/media/mmcblk1p2
reboot
copy rootfs to mmcblk1p2.
There is a trick method:
create a am5749_IDK SD card with SDK.
Plug in the SD card in USB with card reader.
My case, the software location in /run/media/sda1 and /run/media/sda2.
copy all of file in /run/media/sda2 to mmcblk1p2.ext4
cp /run/media/sda2/* /run/media/mmcblk1p2 -r
Press and hold reset button.
Remove SD card
Release reset button and test eMMC boot with raw mode.
Wish everyone leave the office on time.