|
|
# 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 :
|
|
|
* S905X2 - SEI510 (Franklin) :
|
|
|
* S905D2 - X96 :
|
|
|
|
|
|
To make the initial flash, you may side load the bootloader using amlogic `update` tool:
|
|
|
<insert_url_here_to-flash_update>
|
|
|
|
|
|
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](http://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/aarch64-elf/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-elf.tar.xz)
|
|
|
* Compile
|
|
|
```shell
|
|
|
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 :
|
|
|
* 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:
|
|
|
- [linaro-aarch64-none-elf-4.8-2013.11_linux](https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz)
|
|
|
- [linaro-arm-none-eabi-4.8-2013.11_linux](https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz)
|
|
|
* Compile vendor u-boot:
|
|
|
```shell
|
|
|
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
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/build/scp_task/bl301.bin $TMP/
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/build/board/amlogic/${BOARDCFG}/firmware/bl21.bin $TMP/
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/build/board/amlogic/${BOARDCFG}/firmware/acs.bin $TMP/
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/fip/${SOCFAMILY}/aml_encrypt_${SOCFAMILY} $TMP/aml_encrypt
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/fip/acs_tool.pyc $TMP
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/bl2/bin/${SOCFAMILY}/bl2.bin $TMP/
|
|
|
cp ${BRDIR}/bootloader/uboot-repo/bl30/bin/${SOCFAMILY}/bl30.bin $TMP/
|
|
|
|
|
|
```
|
|
|
OR you can use this script [collect-aml-binaries-new.sh](uploads/afa7f471af14fad11783bf77f2c3a968/collect-aml-binaries-new.sh) which will do it for you
|
|
|
```
|
|
|
./collect-aml-binaries.sh <buildroot dir> <vendor-u-boot-path> gxl libretech-cc
|
|
|
```
|
|
|
|
|
|
## 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](uploads/425dd3fd9b999bbc08c3c3b5e95664e7/generate-bins-new.sh)
|
|
|
|
|
|
```shell
|
|
|
./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 is `user` -> `boot 0` -> `boot 1`.
|
|
|
* `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](uploads/0b4d640b26473a2783751482d1e311e8/write-u-boot.sh) |
|
|
\ No newline at end of file |