[PATCH 2/2] tools: amlimage: Add support for GXBB eMMC header
Simon Glass
sjg at chromium.org
Sat Jan 4 20:31:16 CET 2025
Hi Jonas,
On Sat, 4 Jan 2025 at 10:59, Jonas Karlman <jonas at kwiboo.se> wrote:
>
> GXBB BL1 only tries to read boot image from sector 0 on eMMC and sector
> 1 on SD-card. GXL and newer read boot image from sector 1 on both eMMC
> and SD-card.
>
> Vendor BL2 have solved the issue with different offsets by considering
> where BL2 was loaded from to adjust the offset where BL3 is read from.
>
> This provide a different solution to create a boot image that can be
> booted from both eMMC and SD-card and where the offset for reading next
> stage loader can be shared for both boot options.
>
> Inject code, that relocate the payload located at 0x1200 offset in TZRAM
> to the expected offset of 0x1000, into the padding area at offset 0x200
> when a normal GXBB boot image is created. A special GXBB eMMC header can
> then be created that have the payload offset point to this relocate
> code, BL1 will jump to this relocate code when booted from eMMC instead
> of the normal payload start. One effect of this is that the payload size
> limit must be reduced by 512 bytes on GXBB.
>
> Example of how to use it:
> # Create a normal boot image
> tools/mkimage -T amlimage -n gxbb -d u-boot-spl.bin bl2.bin
>
> # Create a boot image with a special eMMC header
> tools/mkimage -T amlimage -n emmc -d bl2.bin bl2-emmc.bin
>
> # Write normal boot image to sector 1 of eMMC/SD-card
> dd if=bl2.bin of=/path/to/dev bs=512 seek=1
>
> # Write eMMC header, 112 bytes, to start of eMMC
> dd if=bl2-emmc.bin of=/path/to/dev bs=1 count=112
>
> Or with binman using something like:
> binman {
> multiple-images;
>
> u-boot-gxbb-sd {
> filename = "u-boot-gxbb-sd.bin";
> pad-byte = <0xff>;
>
> mkimage {
> filename = "bl2.bin";
> args = "-n", "gxbb", "-T", "amlimage";
>
> u-boot-spl {
> };
> };
> };
>
> u-boot-gxbb-emmc {
> filename = "u-boot-gxbb-emmc.bin";
> pad-byte = <0xff>;
>
> mkimage {
> filename = "bl2-emmc.bin";
> args = "-n", "emmc", "-T", "amlimage";
>
> blob-ext {
> filename = "bl2.bin";
> }
> };
> };
> };
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
> tools/amlimage-gxbb-relocate.c | 79 ++++++++++++++++++++++++++++++++++
> tools/amlimage.c | 37 ++++++++++++++++
> 2 files changed, 116 insertions(+)
> create mode 100644 tools/amlimage-gxbb-relocate.c
>
I sent [1] some years ago and would quite like to enable the odroid-c2
in my lab. Is that an older version of what you are supporting here?
I heard that there are people working on open source tools, but it has
been a few years and I'd be quite OK to just use vendor tools.
For your docs, could you put them in doc/ instead?
[..]
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/patch/20211124040954.699821-8-sjg@chromium.org/
More information about the U-Boot
mailing list