U-Boot for Amlogic Q200 (S912)

Q200 is a reference board manufactured by Amlogic with the following specifications:

  • Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz

  • ARM Mali T860 GPU

  • 2/3GB DDR4 SDRAM

  • 10/100/1000 Ethernet

  • HDMI 2.0 4K/60Hz display

  • 2x USB 2.0 Host

  • 1x USB 2.0 Device

  • 16GB/32GB/64GB eMMC

  • 2MB SPI Flash

  • microSD

  • SDIO Wifi Module, Bluetooth

  • IR receiver

U-Boot Compilation

$exportCROSS_COMPILE=aarch64-none-elf-
$makekhadas-vim2_defconfig
$make

U-Boot Signing with Pre-Built FIP repo

$gitclonehttps://github.com/LibreELEC/amlogic-boot-fip--depth=1
$cdamlogic-boot-fip
$mkdirmy-output-dir
$./build-fip.shq200/path/to/u-boot/u-boot.binmy-output-dir

U-Boot Manual Signing

Amlogic does not provide sources for the firmware and tools needed to create a bootloader image but sources have been shared by Linux development contractor, Baylibre:

$wgethttps://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
$wgethttps://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
$tarxvfJgcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
$tarxvfJgcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
$exportPATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
$gitclonehttps://github.com/BayLibre/u-boot.git-bn-amlogic-openlinux-20170606amlogic-u-boot
$cdamlogic-u-boot
$makegxm_q200_v1_defconfig
$make
$exportFIPDIR=$PWD/fip

Go back to the mainline U-Boot source tree then:

$mkdirfip
$cp$FIPDIR/gxl/bl2.binfip/
$cp$FIPDIR/gxl/acs.binfip/
$cp$FIPDIR/gxl/bl21.binfip/
$cp$FIPDIR/gxl/bl30.binfip/
$cp$FIPDIR/gxl/bl301.binfip/
$cp$FIPDIR/gxl/bl31.imgfip/
$cpu-boot.binfip/bl33.bin
$$FIPDIR/blx_fix.sh\
fip/bl30.bin\
fip/zero_tmp\
fip/bl30_zero.bin\
fip/bl301.bin\
fip/bl301_zero.bin\
fip/bl30_new.bin\
bl30
$python$FIPDIR/acs_tool.pycfip/bl2.binfip/bl2_acs.binfip/acs.bin0
$$FIPDIR/blx_fix.sh\
fip/bl2_acs.bin\
fip/zero_tmp\
fip/bl2_zero.bin\
fip/bl21.bin\
fip/bl21_zero.bin\
fip/bl2_new.bin\
bl2
$$FIPDIR/gxl/aml_encrypt_gxl--bl3enc--inputfip/bl30_new.bin
$$FIPDIR/gxl/aml_encrypt_gxl--bl3enc--inputfip/bl31.img
$$FIPDIR/gxl/aml_encrypt_gxl--bl3enc--inputfip/bl33.bin
$$FIPDIR/gxl/aml_encrypt_gxl--bl2sig--inputfip/bl2_new.bin--outputfip/bl2.n.bin.sig
$$FIPDIR/gxl/aml_encrypt_gxl--bootmk\
--outputfip/u-boot.bin\
--bl2fip/bl2.n.bin.sig\
--bl30fip/bl30_new.bin.enc\
--bl31fip/bl31.img.enc\
--bl33fip/bl33.bin.enc

Then write U-Boot to SD or eMMC with:

$DEV=/dev/boot_device
$ddif=fip/u-boot.bin.sd.binof=$DEVconv=fsync,notruncbs=512skip=1seek=1
$ddif=fip/u-boot.bin.sd.binof=$DEVconv=fsync,notruncbs=1count=440