Jerome Brunet | b050a30 | 2019-02-12 14:23:25 +0100 | [diff] [blame] | 1 | U-Boot for Amlogic U200 |
| 2 | ======================= |
| 3 | |
| 4 | U200 is a reference board manufactured by Amlogic with the following |
| 5 | specifications: |
| 6 | |
| 7 | - Amlogic S905D2 ARM Cortex-A53 quad-core SoC |
| 8 | - 2GB DDR4 SDRAM |
| 9 | - 10/100 Ethernet (Internal PHY) |
| 10 | - 1 x USB 3.0 Host |
| 11 | - eMMC |
| 12 | - SDcard |
| 13 | - Infrared receiver |
| 14 | - SDIO WiFi Module |
| 15 | - MIPI DSI Connector |
| 16 | - Audio HAT Connector |
| 17 | - PCI-E M.2 Connector |
| 18 | |
| 19 | Schematics are available from Amlogic on demand. |
| 20 | |
| 21 | Currently the u-boot port supports the following devices: |
| 22 | - serial |
| 23 | - Ethernet |
| 24 | - Regulators |
| 25 | - Clock controller |
| 26 | |
| 27 | u-boot compilation |
| 28 | ================== |
| 29 | |
| 30 | > export ARCH=arm |
| 31 | > export CROSS_COMPILE=aarch64-none-elf- |
| 32 | > make u200_defconfig |
| 33 | > make |
| 34 | |
| 35 | Image creation |
| 36 | ============== |
| 37 | |
| 38 | Amlogic doesn't provide sources for the firmware and for tools needed |
| 39 | to create the bootloader image, so it is necessary to obtain them from |
| 40 | the git tree published by the board vendor: |
| 41 | |
| 42 | > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 43 | > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 44 | > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz |
| 45 | > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz |
| 46 | > export PATH=$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 |
| 47 | > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot |
| 48 | > cd amlogic-u-boot |
| 49 | > make g12a_u200_v1_defconfig |
| 50 | > make |
| 51 | > export UBOOTDIR=$PWD |
| 52 | |
| 53 | Download the latest Amlogic Buildroot package, and extract it : |
| 54 | > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz |
| 55 | > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader |
| 56 | > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706 |
| 57 | > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip |
| 58 | |
| 59 | Go back to mainline U-Boot source tree then : |
| 60 | > mkdir fip |
| 61 | |
| 62 | > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh |
| 63 | > cp $UBOOTDIR/build/scp_task/bl301.bin fip/ |
| 64 | > cp $UBOOTDIR/build/board/amlogic/g12a_u200_v1/firmware/acs.bin fip/ |
| 65 | > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12a/bl2.bin fip/ |
| 66 | > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12a/bl30.bin fip/ |
| 67 | > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12a/bl31.img fip/ |
| 68 | > cp $FIPDIR/g12a/ddr3_1d.fw fip/ |
| 69 | > cp $FIPDIR/g12a/ddr4_1d.fw fip/ |
| 70 | > cp $FIPDIR/g12a/ddr4_2d.fw fip/ |
| 71 | > cp $FIPDIR/g12a/diag_lpddr4.fw fip/ |
| 72 | > cp $FIPDIR/g12a/lpddr4_1d.fw fip/ |
| 73 | > cp $FIPDIR/g12a/lpddr4_2d.fw fip/ |
| 74 | > cp $FIPDIR/g12a/piei.fw fip/ |
| 75 | > cp u-boot.bin fip/bl33.bin |
| 76 | |
| 77 | > sh fip/blx_fix.sh \ |
| 78 | fip/bl30.bin \ |
| 79 | fip/zero_tmp \ |
| 80 | fip/bl30_zero.bin \ |
| 81 | fip/bl301.bin \ |
| 82 | fip/bl301_zero.bin \ |
| 83 | fip/bl30_new.bin \ |
| 84 | bl30 |
| 85 | |
| 86 | > sh fip/blx_fix.sh \ |
| 87 | fip/bl2.bin \ |
| 88 | fip/zero_tmp \ |
| 89 | fip/bl2_zero.bin \ |
| 90 | fip/acs.bin \ |
| 91 | fip/bl21_zero.bin \ |
| 92 | fip/bl2_new.bin \ |
| 93 | bl2 |
| 94 | |
| 95 | > $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \ |
| 96 | --output fip/bl30_new.bin.g12a.enc \ |
| 97 | --level v3 |
| 98 | > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \ |
| 99 | --output fip/bl30_new.bin.enc \ |
| 100 | --level v3 --type bl30 |
| 101 | > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \ |
| 102 | --output fip/bl31.img.enc \ |
| 103 | --level v3 --type bl31 |
| 104 | > $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \ |
| 105 | --output fip/bl33.bin.enc \ |
| 106 | --level v3 --type bl33 |
| 107 | > $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \ |
| 108 | --output fip/bl2.n.bin.sig |
| 109 | > $FIPDIR/g12a/aml_encrypt_g12a --bootmk \ |
| 110 | --output fip/u-boot.bin \ |
| 111 | --bl2 fip/bl2.n.bin.sig \ |
| 112 | --bl30 fip/bl30_new.bin.enc \ |
| 113 | --bl31 fip/bl31.img.enc \ |
| 114 | --bl33 fip/bl33.bin.enc \ |
| 115 | --ddrfw1 fip/ddr4_1d.fw \ |
| 116 | --ddrfw2 fip/ddr4_2d.fw \ |
| 117 | --ddrfw3 fip/ddr3_1d.fw \ |
| 118 | --ddrfw4 fip/piei.fw \ |
| 119 | --ddrfw5 fip/lpddr4_1d.fw \ |
| 120 | --ddrfw6 fip/lpddr4_2d.fw \ |
| 121 | --ddrfw7 fip/diag_lpddr4.fw \ |
| 122 | --level v3 |
| 123 | |
| 124 | and then write the image to SD with: |
| 125 | |
| 126 | > DEV=/dev/your_sd_device |
| 127 | > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1 |
| 128 | > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444 |