How to program preloader & u-boot into eMMC?


#1

There seems has no related article/document described “how to program eMMC”.

As I know that eMMC equal to SD card… except that eMMC can’t remove from the PCB…

So, there has questions:

  1. If eMMC is blank, how to program preloader into eMMC ?
  2. How to create partitions on eMMC ?

#2

I know that DS-5 can running preloader + u-boot on HPS via JTAG interface…

Which command in u-boot can do partitioning eMMC ? and how ?


#3

I guess you cannot:
https://www.denx.de/wiki/DULG/UsingPCCard

If you are desperate, you could try to find out if you can use “ide write” to overwrite the entire eMMC content, including the partition table from a raw disk image, but I would not dare try this on my board .

Alternatively, you could try to load the Linux kernel into memory as well, boot from this, and then format your eMMC from Linux (I cannot give you more details).


#4

Here’s a few comments in an attempt to be helpful.

I believe that the HPS first stage boot looks for a partition table. If no partition table exists then the preloader should be written to address zero (start of the card). I’ve never done this but I would guess that it might be done as follows:

  • insert card in a system running Linux
  • execute fdisk -l to see if it’s /dev/sdb etc…
  • assuming card is at /dev/sdb
  • filename below is default for Arria10

dd if=uboot_w_dtb-mkpimage.bin of=/dev/sdb bs=64k seek=0

If the card has a partition table then the HPS looks for the first partition type A2 (raw). It can be any partition number but the first A2 partition must contain the preloader. Assuming you’ve used partition 2 for the card you’d write it like this:

dd if=uboot_w_dtb-mkpimage.bin of=/dev/sdb2 bs=64k seek=0

To update a preloader in a running system on partition 2 (for Arria10 it’s the preloader and u-boot all in one binary) you’d do it like this:
dd if=uboot_w_dtb-mkpimage.bin of=/dev/mmcblk0p2 bs=64k seek=0

You can also read the preloader back to do a binary comparison if you’d like:

  • read it
    dd if=/dev/mmcblk0p2 of=mypreloader.bin bs=64k seek=0 count=16
  • compare
    diff mypreloader.bin uboot_w_dtb-mkpimage.bin

Summary:
I’ve only booted Cyclone V and Arria10 devices using a partition table. I’ve used different partitions (p2 and p3) for the preloader with no issue. I’ve also placed additional RAW A2 partitions on a card and observed that only the first A2 partition is used for the preloader. For Cyclone V you must also have a u-boot binary on the card. I’m not sure how this would work with no partitions. I’ve typically made partition 1 a FAT with u-boot and partition 2 a RAW partition with the preloader (no u-boot binary needed on FAT for Arria10). I started by using a script supplied with one of the GSRD downloads to make the partition table. You can do all of this manually with fdisk and mkfs to partition and format the card mcanually if you prefer. Search for making an SD card on Rocketboards for examples and more info.

Hope this was helpful.


#5

I had a similar problem. Eventually I managed to get a UART to work to get u-boot loaded into the EMMC, and then went from there, painful, but works. Future revisions of the board had a small header fitted which connects to an SD-card reader. Now I just dd it from my PC running Unix.


#6

I found this document , but need to use DS-5 via JTAG. It’s for Arria10 SoC, but also supports Cyclone V SoC (I think…)

Just give it a try…


#7

How are you solving this problem? I also encountered the same problem, I don’t know how to solve it.