Booting LIME2 from the eMMC boot blocks

Started by ardavast, August 30, 2023, 05:01:33 PM

Previous topic - Next topic


Zdraveyte, maina

I'm trying to get an A20-OLinuXino-LIME2-e16Gs16M rev. L to boot from the eMMC boot partitions. The A20 user manual says (page 11): "Support eMMC mandatory and alternative boot operations", so in theory this should be possible.

Installing U-Boot to the user part of the eMMC works flawlessly. I did the following on my dev machine:
cd /opt
tar Jxf arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz
export PATH=$PATH:/opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin
cd -
git clone
cd u-boot
git checkout v2023.07.02
export CROSS_COMPILE=arm-none-eabi-
make A20-OLinuXino-Lime2-eMMC_defconfig

And then on the target:
cat /dev/zero > /dev/mmcblk1
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk1 bs=1024 seek=8

After reboot (without SD card) U-Boot comes up and everything seems to work.

Now, for the part that doesn't work: I tried to install U-boot inside the eMMC boot partitions without success.
I did the following (mostly taken from here):
echo 0 > /sys/block/mmcblk1boot0/force_ro
echo 0 > /sys/block/mmcblk1boot1/force_ro
cat /dev/zero > /dev/mmcblk1boot0
cat /dev/zero > /dev/mmcblk1boot1
mmc bootbus set single_hs x1 x4
mmc bootpart enable 1 1 /dev/mmcblk1
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk1boot0

After reboot, nothing happens, and there is nothing on UART.

I started to suspect that U-Boot doesn't get loaded at all, so I decided to make a minimal bootloader which only turns on the led, and then goes into an infinite loop. You can get it from here:

Again, if I write this to the board with
dd if=boot0.bin of=/dev/mmcblk1 bs=1024 seek=8
it works - the green LED turns on and nothing else happens (as expected).
If I write it to the boot blocks with:
dd if=boot0.bin of=/dev/mmcblk1boot0
the LED doesn't turn on.

I think that either I'm writing to the wrong sector, or my mmc settings are wrong or there is some hardware incompatibility between the A20 and the emmc chip. Have you ever seen a setup like this one working? Any help is appreciated.


What? Booting from eMMC can be done via executing a single script inside the Olimage.

Just use the olinuxino-sd-to-emmc script, for more information read this guide:

Sources of the script can be found at our GitHub, but basically it involves first booting from the SPI flash before switching to the eMMC.
Technical support and documentation manager at Olimex


Hello, @LubOlimex
I've a somewhat similar problem as @ardavast, on my A20-OLinuXino-LIME2-e16Gs16M. For testing, it works fine when booted from SD card, with debian bullseye and yunohost installed. However, I'd like for production to move to something more reliable than the SD card. like booting from SSD or eMMC.

olinuxino-sd-to-emmc calls another script (u-boot-install, which I had to download from another place on GitHub) which is not working.
Also it seems to look for an SPI flash memory, not available on this version of Lime2.
I tried olinuxino-sd-to-ssd but it presents the same dependency on SPI.
When I tried to follow the steps described by @ardavast, on my dev computer, the last make instruction failed because the include of <openssl/evp.h> in image.h was missing.
So I couldn't complete the compile.
Any advice how to go further ?


Your version of LIME2 has 16MB SPI flash on-board (suffix -s16M- means 16MB SPI).

Just use the ready Olimex image and try with it to confirm it is working. Once you've tried it with Olimage Linux, try to analyze our scripts and sources to transfer to other distributions or own builds.
Technical support and documentation manager at Olimex


Indeed, when booted on Olimage all works well. Many thanks  :)


Thank you for your questions and answers. I have fixed my problem