I was recently tasked with getting our prototype to boot from the on-board eMMC, rather than an SD card. We don't speak Windows here, so we can't use the Manufacturing Tool to setup our prototype (plus I'm still getting all the IOMux and driver support in place). Shorter Story: This post proved to be very valuable for getting the eMMC boot partition setup, and I have successfully booted the prototype into U-Boot. Sadly, it's not loading the kernel from the same partition; I think I need to do more work to get U-Boot to talk to the eMMC properly.
Anyway: All the code I can find, both in Yocto and scattered around forum posts, lays out boot partitions as follows:
All the code I've seen leaves byte offsets 512 to (P1 - 1) (where P1 is the first block of the first partition) unallocated and unmentioned in the MBR. The first 1024 (2 blocks) of both the U-Boot image and the block device are skipped, and the remainder blindly copied to the block device. My question is: Where does this placement requirement come from? Is this 2-block/1024-byte offset a Magic Number required by the boot ROM? Is a valid MBR required to be in place for the boot ROM to find the boot code? If a valid MBR isn't required or present, do the offsets change? (Can I use a GPT instead of an MBR?)
In short: What is the boot ROM actually looking for?
Once u-boot is up, it got all the controls and responsible for loading and jumping to the kernel. By convention, the kernel should be written at 1MB (1,048,576 = 0x800 * 512) from the beginning of the eMMC. So u-boot can load and jumps to the kernel by below commands:
mmc dev 3; mmc read ${loadaddr} 0x800 0x2000; bootm
Regards,
Jacky
Thanks for your note. What I was wondering was how the boot ROM found U-Boot in the first place.
Funny, though... I have a distinct memory of posting a followup message here saying that I'd found what appeared to be The Answer in section 8.6.1 in the MX6DL Processor Reference Manual, which describes what the boot ROM will do with various types of boot media. In the case of eMMC, it goes to offset 0x400, reads 4KiB, and interprets the Image Vector Table it finds there to work out how to load the rest of the boot image. But that message appears to be gone...
What this suggests to me is that the boot ROM completely ignores everything on eMMC boot media from 0x000 - 0x400, and I can put anything there I want.
Leo, please click Correct Answer/Helpful Answer, if your question has been answered.
Thanks,
Yixing
That's correct, Byte 0 ~ 0x3FF are ignored by the ROM. However the first sector (512 byte) should be filled with the partition table, so that the kernel can mount the eMMC device.
Regards,
Jacky