Hi,

I am not sure this is widely known, at least I couldn't find anything
about it:

While looking at the eMMC content of the Eachlink H6 Mini TV box, I was
surprised to find an identical boot0 copy at offset 128KB of the eMMC
device, in addition to the usual version at 8K.
Some experiments later I can confirm:
- The BootROM in recent Allwinner SoCs (tested on H2+, A64, H5, H6) is
able to load an "eGON" boot image from sector 256 (128K) of an SD card
or eMMC device.
- The normal 8K copy takes precedence, so there must be either no or an
invalid eGON image at 8K for the 128K copy to be considered.
- The BootROM still observes the boot order, so it's roughly:
MMC0@8K, MMC0@128K, MMC2@8K, MMC2@128K, SPI@0, FEL (with NAND somewhere
in between).
- When booting such a "high" boot image, the boot source at offset 0x28
in SRAM A1 gets bit 4 set, so it's 0x10 for SD card and 0x12 for eMMC.
- I couldn't find any alternative offset in SPI flash (tested the first MB).
- Also I couldn't find any other possible location within the first MB
for MMC storage (tested in 8K steps within the first MB).
- I couldn't convince my BananaPi-M1 to boot from 128K, so I suppose it
does not work on the A20.
- I don't have real H3, but I assume the H2+ is close enough to assume
that the H3 is also able to boot "high".
- The same applies for TOC0 on boards with the secure boot bit set.

This helps with two things:
- With no need to put anything at 8KB, we can have a full length GPT on
an SD card or eMMC device. This should make images "more compatible".
- One image can hold both a TOC0 (secure boot) and an eGON image, the
BootROM will pick the matching one naturally.

I have a simple patch to tell U-Boot's SPL about bit 4 in boot source,
to let it continue loading. Technically it should be feasible to use
this information to automatically load U-Boot proper from 160K, but
SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is a compile time constant used by many
other platforms in generic SPL code, so it doesn't look easy to make
this dynamic, just for sunxi, without risking to break something else.
For now it works if one sets the symbol to 0x140 during compilation.
If one wants to support both versions, one could always put U-Boot at
160KB, using the said symbol.

Cheers,
Andre.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to