afaerber / meson-tools

Tools for Amlogic Meson ARM platforms
GNU General Public License v2.0
43 stars 27 forks source link
amlogic arm atf meson

meson-tools

meson-tools is a collection of tools for use with the Amlogic Meson family of ARM based SoCs.

Name-wise it was inspired by sunxi-tools.

amlbootsig

Usage:

 amlbootsig boot_new.bin u-boot.img

This tool is supposed to provide equivalent output to:

 aml_encrypt_gxb --bootsig --input boot_new.bin --output u-boot.img

with the tool version distributed by Hardkernel for their Odroid-C2 board (S905 / Meson GXBaby).

How to compare output

 hexdump -C a/u-boot.img > a/u-boot.img.hex
 hexdump -C b/u-boot.img > b/u-boot.img.hex
 diff -u a/u-boot.img.hex b/u-boot.img.hex | less

This should result in a diff with only the following differences:

For testing identity of output files, modify the code to use the random bytes from the file you are testing against.

Known limitations

unamlbootsig

Usage:

unamlbootsig u-boot.img boot_new.bin

This tool is supposed to do the reverse of amlbootsig, i.e. drop the boot signature.

The output may differ from the original aml_encrypt_gxb --bootsig/amlbootsig input from 0xb000 to 0xbfff as well as in FIP TOC entry size 16-byte alignment.

Known limitations

See amlbootsig.

amlbootsig-gxl

Usage:

 amlbootsig-gxl bl2_new.bin bl2_new.bin.sig

This tool is supposed to provide equivalent output to:

 aml_encrypt_gxl --bl2sig --input bl2_new.bin --output bl2_new.bin.sig

with the tool version distributed by Amlogic in their 2018-07-06 Buildroot tarball.

How to compare output

 hexdump -C a/bl2_new.bin.sig > a/bl2_new.bin.sig.hex
 hexdump -C b/bl2_new.bin.sig > b/bl2_new.bin.sig.hex
 diff -u a/bl2_new.bin.sig.hex b/bl2_new.bin.sig.hex | less

This should result in a diff with only the following differences:

For testing identity of output files, modify the code to use the random bytes from the file you are testing against.

Known limitations

Specifically tailored to BL2.

Otherwise see amlbootsig.

amlbootenc-gxl

Usage:

 amlbootenc-gxl u-boot.bin u-boot.bin.enc

This tool is supposed to provide equivalent output to:

 aml_encrypt_gxl --bl3enc --input u-boot.bin --output u-boot.bin.enc

with the tool versions distributed by Amlogic in their 2018-07-06 Buildroot tarball.

How to compare output

 hexdump -C a/u-boot.bin.enc > a/u-boot.bin.enc.hex
 hexdump -C b/u-boot.bin.enc > b/u-boot.bin.enc.hex
 diff -u a/u-boot.bin.enc.hex b/u-boot.bin.enc.hex | less

This should result in a diff with the following differences:

For testing identity of output files, modify the code to use the key/IV bytes from the file you are testing against.

Known limitations

Specifically tailored to BL3x.

Otherwise see amlbootsig.

amlbootimg-gxl

Usage:

 fiptool --align 0x4000 --scp-fw bl30_new.bin.enc --soc-fw bl31.img.enc --nt-fw u-boot.bin.enc fip.bin
 amlbootenc-gxl fip.bin fip.bin.enc
 dd if=fip.bin.enc of=fip.enc.bin bs=512 count=31
 amlbootimg-gxl bl2_new.bin.sig fip.enc.bin bl30_new.bin.enc bl31.img.enc u-boot.bin.enc u-boot.img

This tool is supposed to provide equivalent output to:

 aml_encrypt_gxl --bootmk --bl2 bl2_new.bin.sig --bl30 bl30_new.bin.enc --bl31 bl31.img.enc --bl33 u-boot.bin.enc --output u-boot.img
 dd if=u-boot.img.sd.bin of=/dev/XXX bs=512 skip=1 seek=1

with the tool versions distributed by Amlogic in their 2018-07-06 Buildroot tarball.

To deploy the file to SD card:

 dd if=u-boot.img of=/dev/XXX bs=512 seek=1

How to compare output

 hexdump -C a/u-boot.img > a/u-boot.img.hex
 hexdump -C b/u-boot.img > b/u-boot.img.hex
 diff -u a/u-boot.img.hex b/u-boot.img.hex | less

This should result in a diff with the following differences:

Known limitations

Otherwise see amlbootsig.

amlinfo

Usage:

 amlinfo u-boot.img

This tool dumps info about an existing image file.

It supports the following inputs:

Known limitations