Boot from eMMC on Coral dev board

Hi @mirzak,

great work!

Do you have an idea what needs to be changed to support booting from mmc?

Best regards
Ruben

1 Like

It might be as easy as adjusting,

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"

to

MENDER_STORAGE_DEVICE = "/dev/mmcblk0"

Though I have not had a chance to test this yet, also the eMMC flash process somewhat convoluted if using the standard tools so it might be easier to flash the eMMC from a booted SD card.

1 Like

thanks, i will try this.
youā€™re right, I am currently struggling with uuu tool to flash anything to the device. Without luck so far. Will investigate furtherā€¦

Hi guys, Iā€™m Nam from the coral team, @ruben reached out to me so I wanted to come collect more info :slight_smile:

I never used mender before, but I saw that you can build this os to a .sdimg file? I wonder if this .sdimg is anyway different than a normal OS image and whatā€™s the difference between this and the .mender file? Here something that may works (do this at your own risk):

  1. Connect your dev board to your machine with the serial cable and the USB-A to C cable.
  2. Boot up the board and press any key to put the board on u-boot prompt
  3. On the u-boot prompt, enter ums 0 mmc 0, this will mount the emmc on the board as a usb device on your host machine.
U-Boot# ums 0 mmc 0
  1. Make sure to check fdisk -l to get the correct usb device from the dev board (mine was /dev/sda).
  2. Important: back up the current MendelOS image so you wonā€™t lose it:
$ sudo if=/dev/sda of=mendel_backup.img bs=4M status=progress
  1. Copy the mender disk image to the emmc
$ sudo dd if=path-to-mender-img of=/dev/sda bs=4M status=progress

It is advice to be very careful here because you can wipe out the wrong drive with the ā€œofā€ parameter

That should be it, at least this works for backup the MendelOS image.
Although Iā€™m a little nervous about giving this solution, because Iā€™m not sure if the sdcard image will work with emmc. You may ends up not being able to boot to emmc at all after transferring that image over.

1 Like

Hi @Namburger, thank you for following up.

The .sdimg file is an ordinary OS image with some extra partitions due to Mender requirements (A/B structure). So this is something that you would write to e.g the SD card using similar dd commands as you mention.

On the u-boot prompt, enter ums 0 mmc 0 , this will mount the emmc on the board as a usb device on your host machine.

The ums approach is pretty nice and have used it on several other boards.

You may ends up not being able to boot to emmc at all after transferring that image over.

But it should be possible to restore the eMMC, right? I have not looked at it yet, but at least you could boot an SD card to flash eMMC and it seems like this is something that is recommend as well in coral.ai docs

I will try to play around with the eMMC a bit and will update the instructions once done.

This is the update Artifact, and normally only contains a rootfs image. So this is something that you would deploy using a Mender server.

Yes, you can always use the recovery image here to flash into u-boot on an sdcard and then use the backup image on step 5 to restore your emmc. At least it works in theory :upside_down_face:

Hi @Namburger, hi @mirzak,

Thanks a lot for your responses!
I successfully flashed my image with the u-boot

ums 0 mmc 0

approach. I didnā€™t know this, pretty nice!

But after flashing and changing the boot switches to mmc nothing boots. No output on serial console.
Will investigate more on bootloader changes, perhaps wrong partition in bootloader config.

New results:

  • I flashed the new image with following change to sd

MENDER_STORAGE_DEVICE = ā€œ/dev/mmcblk0ā€

I checked the u-boot variable on old and new image and the changes affected the mmc location ā†’ perfect!
I booted kernel and it uses the previously flashed image from mmc, not sd.

So the problem seems to be that after flashing to mmc spl loader is not found or in wrong place. Do you have any idea how this could happen?

I suspect that the bootloader is stored in the hardware boot partition on eMMC while this is not the case for SD.

Could you try writing the bootloader in a separate step running the following command on your PC:

fastboot flash bootloader0 u-boot.imx

Above is what is executed by the flash.sh script provided by Coral for Mendel OS flashing.

The u-boot.imx is called imx-boot in Yocto deploy directory. Note that you need to start fastboot in U-Boot for this to work.

This can probably be accomplished using mmc write command in U-Boot as well, but would need to experiment with it to understand the offsets.

You can also take a look at Toradex Colibri iMX7 Dual 1GB (in the Flash instructions section), I would expect something similar could work here as well.

I flashed with both ways, fastboot and mmc write like toradex. Both didnā€™t work.
Now I will double-check all my steps and checking the boot mode settings again.

Next step would be to flash mendel os again and then only exchange imx-boot

Did a quick test on my board and it succeeded booting from eMMC, after I used fastboot to flash U-Boot.

So the steps that worked for me are:

  1. Flash SD card with an bootable image, insert to board and boot it
  2. Halt U-boot
  3. Run ums 0 mmc 0 in U-Boot
  4. Flash sdimg
  5. Run fastboot 0 in U-Boot
  6. Flash U-Boot by running fastboot flash bootloader0 imx-boot
  7. Powered off the board
  8. Adjusted boot switches for eMMC
  9. Power on board

Thanks a lot for detailed explanation. I will try tonight again. Guess I made mistake with boot switches. :frowning:

@mirzak now it is working! Thanks a lot for your help.
After flashing bootloader0 the first time i forgot to adjust the boot switches correctly. :face_with_hand_over_mouth:
Also thanks @Namburger for your help!

1 Like

Nice @ruben!
Thanks @mirzak for your expertise!

Hi ruben,
Do you have flash to emmc using uuu tool?
Thanks

Hi @mirzak ,
Does it possible flash imx-boot-coral-dev-sd.bin-flash_evk to eMMC using uuu tool(NXP has provide uuu tool to flash image to board) directly?
Thanks
Jordon Wu

Hi @JordonWu it seems that you use Android fastboot primarily to flash this board. Iā€™ve never actually used this board so perhaps someone with more experience will confirm or correct me on this.

Drew

Hi @mirzak,
I tried
fastboot flash bootloader0 u-boot.imx
But I got the following line, although it did appear to complete successfully.
request 00000000ff95db00 was not queued to ep1in-bulk

Any thought what this relates to and should I be worried?
PS Could anyone share their ā€˜env printā€™ from U-Boot for Coral Dev Board please.