For building U-Boot proper in allwinner A64/H5 ATF need to build
first and ATF binary need to be exported, since buildroot not taking
care of this process this script will do the same build during
post-build.

Signed-off-by: Jagan Teki <[email protected]>
---
 support/scripts/sunxi64-post-build.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 support/scripts/sunxi64-post-build.sh

diff --git a/support/scripts/sunxi64-post-build.sh 
b/support/scripts/sunxi64-post-build.sh
new file mode 100755
index 0000000..359bd1d
--- /dev/null
+++ b/support/scripts/sunxi64-post-build.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+#
+# sunxi64-post-build script
+#
+# Allwinner A64/H5 firmware consists of three parts:
+# 1) U-Boot's SPL
+# 2) ARM Trusted Firmware (ATF)
+# 3) U-Boot proper.
+#
+# The SPL will load both ATF and U-Boot proper along with the right device
+# tree blob (.dtb) and will pass execution to ATF (in EL3), which in turn will
+# drop into the U-Boot proper (in EL2).
+#
+# As the ATF binary will become part of the U-Boot image file, you will need
+# to build it first and export ATF variable to built U-Boot proper. Since
+# buildroot not take of building ATF first and export the binary, this 
post-build
+# script build the u-boot.itb
+
+# source .config
+source ${BR2_CONFIG}
+
+ATF_BUILD_DIR=arm-trusted-firmware-${BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION}/build
+ATF_PLAT_DIR=${ATF_BUILD_DIR}/${BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM}/release
+ATF_BIN_PATH=${ATF_PLAT_DIR}/${BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES}.bin
+UBOOT_BUILD_DIR=${BUILD_DIR}/uboot-${BR2_TARGET_UBOOT_VERSION}
+MKIMAGE=${UBOOT_BUILD_DIR}/tools/mkimage
+DTB_NAME=${BR2_LINUX_KERNEL_INTREE_DTS_NAME#*/}.dtb
+
+cd ${UBOOT_BUILD_DIR}
+export BL31=${BUILD_DIR}/${ATF_BIN_PATH}
+${UBOOT_BUILD_DIR}/board/sunxi/mksunxi_fit_atf.sh 
${UBOOT_BUILD_DIR}/arch/arm/dts/${DTB_NAME} > u-boot.its
+${MKIMAGE} -f u-boot.its -E $BINARIES_DIR/u-boot.itb
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to