U-boot mainline for the G12a
Ready to flash Bootloaders:
If you don't want to build anything and you are just after some binaries you can flash, you can use:
- S905D2 - U200 : u200-emmc-uboot.bin
- S905X2 - SEI510 (Franklin) :
- S905D2 - X96 :
To make the initial flash, you may side load the bootloader using amlogic update
tool: https://drive.google.com/open?id=1ML3Np6Qvxx-x6hap4PEHJUt6OYNwKnKi
Then put the board in USB boot mode:
- Plug the USB cable in the appropriate port and in your computer
- Hard reset the device while pushing the
USB-BOOT
button - On the serial console, you should something like this :
G12A:BL:0253b8:61aa2d;FEAT:E0F97180:2000;POC:D;RCY:0;USB:0;
and nothing more. If it keeps on dumping u-boot traces, you failed to put the board in USB boot mode. - On the host do :
./update write u-boot.bin 0xfffa0000 0x10000
./update run 0xfffa0000
You should see a few traces from the bl2 running
sleep 8
./update bl2_boot u-boot.bin
You should be in u-boot now \o/
Build Mainline u-boot - bl33:
Like every other ARM64 device, u-boot is just one part of the bootloader, we need a few ATF binaries provided by Amlogic to make a functional u-boot bootloader This repository provides the means to generate the bl33 binary, which will be u-boot mainline
Build Mainline u-boot - bl33:
- Download the toolchain : gcc-linaro-7.2.1-2017.11-x86_64_aarch64-elf
- Compile
export PATH=<path-to-toolchain>/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-elf/bin:$PATH
export CROSS_COMPILE=aarch64-elf-
make u200_defconfig
make
- the
u-boot-bin
is the bl33
Get Amlogic FIP binaries:
The easy way - pre-packaged binaries:
The easiest way is to use the binaries we already packaged:
- S905D2 - U200 : fip-collect-g12a-g12a_u200_v1-20190110-184413.tar.xz
- S905X2 - SEI510 (Franklin) :
- S905D2 - X96 :
The hard way - packaging the binaries from Amlogic's buildroot:
The goal here is to collect the bl2, bl21, bl30, bl31, bl301 and acs.bin Some of these binaries are directly provided by the buildroot package of Amlogic, other must be generated from the vendor u-boot.
- Download the buildroot package: http://openlinux2.amlogic.com:8000/download/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_20180131.tar.gz
- Download the necessary toolchains:
- Compile vendor u-boot:
export PATH=<path-to-toolchain>/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:<path-to-toolchain>/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin/:$PATH
cd <amlogic-build-root>/bootloader/uboot-repo/
make libretech_cc_defconfig
make
- Finally, collect the binaries:
mkdir collect-dir
for bin in "bl2.bin acs.bin bl30.bin bl301.bin bl31.img"
do
cp ${BRDIR}/bootloader/uboot-repo/fip/build/${bin} collect-dir
done
for bin in "ddr4_1d.fw ddr4_2d.fw ddr3_1d.fw piei.fw lpddr4_1d.fw lpddr4_2d.fw diag_lpddr4.fw"
do
cp ${BRDIR}/bootloader/uboot-repo/fip/g12a/${bin} collect-dir
done
OR you can use this script collect-aml-binaries-new.sh which will do it for you
./collect-aml-binaries-new.sh <buildroot dir> g12a g12a_u200_v1
Package the Binaries
To package the binaries together and make something we can flash, we must follow some obscure procedure which you can read in the scripts that amlogic's buildroot uses. These tends to change betweeen soc and u-boot versions. Best is to just use what we previously packaged and this script generate-bins-new.sh
./generate-bins-new.sh <fip-collect-directory> <target-bl33-binary>
this will generate a directory with the following binaries
-
u-boot.bin
: binary to flash on the emmc or the spi:- emmc: remember skip the first sector:
mmc write $fileaddr 1 $bin_block_num
. You may choose to write the u-boot on the boot partitions of the eMMC. The boot order isuser
->boot 0
->boot 1
.
- emmc: remember skip the first sector:
-
u-boot.bin.sd.bin
: NO YET TESTED Binary to boot from an sdcard: remember to leave room for the MBR : write-u-boot.sh