aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames King <james.king@arm.com>2016-05-06 18:50:51 +0100
committerRyan Harkin <ryan.harkin@linaro.org>2016-05-11 20:18:59 +0100
commit2eaceeb60946cd3177a52a99f7747a69035a87a1 (patch)
tree4f98a821fa0d0b2a47206a6415ff8d885c8e3973
parente3eacf408a73a4af4cce512cbc38fb1e55ee3d5f (diff)
Rebase build scripts and variant filesarmlt-20160518-001armlt-20160512-002armlt-20160512-001
Rebase the build scripts to the latest scritps from ARM. Since starting to use these scripts, they diverged quite a bit, so this is a squashed commit use to catch up both the ARM tree and the ARMLT tree. Change-Id: Ifbaf62fb0168852f7579f82dc87178554c415349 Signed-off-by: James King <james.king@arm.com>
-rw-r--r--.gitignore1
-rwxr-xr-xbuild-all.sh41
-rwxr-xr-xbuild-android.sh156
-rwxr-xr-xbuild-arm-tf.sh33
-rwxr-xr-xbuild-busybox.sh36
-rwxr-xr-xbuild-linux.sh48
-rwxr-xr-xbuild-oe-binaries.sh (renamed from build-ramdisk.sh)62
-rwxr-xr-xbuild-optee-os.sh65
-rwxr-xr-xbuild-scp.sh123
-rwxr-xr-xbuild-target-bins.sh510
-rwxr-xr-xbuild-uefi.sh57
-rwxr-xr-xframework.sh33
-rw-r--r--readme.txt78
-rw-r--r--variants/fvp-android30
-rw-r--r--variants/fvp-busybox93
-rw-r--r--variants/fvp-oe23
-rw-r--r--variants/fvp-uefi19
-rw-r--r--variants/juno-android22
-rw-r--r--variants/juno-busybox127
-rw-r--r--variants/juno-oe50
-rw-r--r--variants/juno-uefi19
-rw-r--r--variants/tc2-android12
-rw-r--r--variants/tc2-busybox57
-rw-r--r--variants/tc2-oe19
-rw-r--r--variants/tc2-uefi18
25 files changed, 1261 insertions, 471 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fb05f39
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+arm
diff --git a/build-all.sh b/build-all.sh
index 04d06d0..0786b0a 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -57,15 +57,34 @@ if [ "$FINAL_BUILD_STEP" != "" ]; then
echo "Done."
fi
-# Now to execute each component build in turn
-for build in $BUILD_SCRIPTS; do
- echo "***********************************"
- echo "Execute $CMD for $build on $VARIANT"
- $DIR/$build $VARIANT $CMD
- if [ "$?" -ne 0 ]; then
- echo "Command failed: $CMD for $build on $VARIANT"
- exit 1
+# $1 - cmd to execute
+__do_build_all()
+{
+ # Now to execute each component build in turn
+ for build in $BUILD_SCRIPTS; do
+ echo "***********************************"
+ echo "Execute $1 for $build on $VARIANT"
+ ${DIR}/$build $VARIANT $1
+ if [ "$?" -ne 0 ]; then
+ echo "Command failed: $1 for $build on $VARIANT"
+ exit 1
+ fi
+ echo "Execute $1 for $build on $VARIANT done."
+ echo "-----------------------------------"
+ done
+
+ if [ "$1" = "clean" ]; then
+ echo "Finishing clean by removing $OUTDIR and $PLATDIR"
+ rm -rf $OUTDIR
+ rm -rf $PLATDIR
fi
- echo "Execute $CMD for $build on $VARIANT done."
- echo "-----------------------------------"
-done
+}
+
+if [ "$CMD" != "all" ]; then
+ __do_build_all $CMD
+else
+ __do_build_all clean
+ __do_build_all build
+ __do_build_all package
+
+fi
diff --git a/build-android.sh b/build-android.sh
new file mode 100755
index 0000000..adc9685
--- /dev/null
+++ b/build-android.sh
@@ -0,0 +1,156 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# Neither the name of ARM nor the names of its contributors may be used
+# to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+#
+# This script uses the following environment variables from the variant
+#
+# VARIANT - build variant name
+# TOP_DIR - workspace root directory
+# ANDROID_BUILD_ENABLED - Flag to enable building Android
+# ANDROID_SOURCE_PATH - sub-directory containing Android
+# ANDROID_BINARIES_PATH - sub-directory containing Android prebuilt bins
+# ANDROID_LUNCH_TARGET - Lunch target to build
+# ANDROID_IMAGE_SIZE - Size of the image to generate
+# UBOOT_MKIMAGE - path to uboot mkimage
+# LINUX_ARCH - the arch
+# UBOOT_BUILD_ENABLED - flag to indicate the need for uimages.
+# ANDROID_BINS_VARIANTS - list of binary distros
+# ANDROID_SOURCE_VARIANT - the output name for the build
+# TARGET_{plat} - array of platform parameters, indexed by
+# ramdisk - the address of the ramdisk per platform
+
+
+do_build ()
+{
+ if [ "$ANDROID_BUILD_ENABLED" == "1" ]; then
+ if [ -d "$TOP_DIR/$ANDROID_SOURCE_PATH" ]; then
+ pushd $TOP_DIR/$ANDROID_SOURCE_PATH
+
+ echo "Android source build starting."
+ source build/envsetup.sh
+ lunch ${ANDROID_LUNCH_TARGET}
+ make -j $PARALLELISM TARGET_NO_KERNEL=true \
+ BUILD_KERNEL_MODULES=false \
+ TARGET_PREBUILT_KERNEL=yes \
+ systemimage userdataimage ramdisk
+
+ popd
+ else
+ echo "Android binary build. Skipping."
+ fi
+ fi
+}
+
+do_clean ()
+{
+ if [ "$ANDROID_BUILD_ENABLED" == "1" ]; then
+ if [ -d "$TOP_DIR/$ANDROID_SOURCE_PATH" ]; then
+ pushd $TOP_DIR/$ANDROID_SOURCE_PATH
+ echo "Cleaning Android source build..."
+ rm -rf out
+ popd
+ else
+ echo "Android binary build. Skipping."
+ fi
+ fi
+}
+
+do_package ()
+{
+ if [ "$ANDROID_BUILD_ENABLED" == "1" ]; then
+ echo "Packaging Android... $VARIANT";
+
+ mkdir -p ${PLATDIR}
+
+ if [ -d "$TOP_DIR/$ANDROID_SOURCE_PATH" ]; then
+ pushd $TOP_DIR/$ANDROID_SOURCE_PATH
+ echo "Packaging Android source build..."
+
+ # Setup lunch option to have access to env variables
+ source build/envsetup.sh
+ lunch ${ANDROID_LUNCH_TARGET}
+
+ # ANDROID_PRODUCT_OUT env variable is exported by android build system,
+ # when 'lunch <target>' is run.
+ local product_out=${ANDROID_PRODUCT_OUT}
+ local make_ext4fs=${TOP_DIR}/${ANDROID_SOURCE_PATH}/out/host/linux-x86/bin/make_ext4fs
+
+ pushd ${product_out}
+ # Create an image file
+ MAKE_EXT4FS=${make_ext4fs} \
+ IMG=${PLATDIR}/${ANDROID_SOURCE_VARIANT}-android.img \
+ $TOP_DIR/build-scripts/android-image.sh
+
+ # Copy the ramdisk
+ cp ${product_out}/ramdisk.img \
+ ${PLATDIR}/${ANDROID_SOURCE_VARIANT}-ramdisk-android.img
+ ANDROID_BINS_VARIANTS=${ANDROID_SOURCE_VARIANT}
+ popd
+ else
+ pushd ${TOP_DIR}/${ANDROID_BINARIES_PATH}
+ echo "Packaging Android binary build..."
+
+ for item in $ANDROID_BINS_VARIANTS; do
+ pushd $item
+ # Create an image file
+ if [ -e "system.img" ]; then
+ IMG=${PLATDIR}/${item}-android.img \
+ ${TOP_DIR}/build-scripts/android-image.sh
+ elif [ -e "${item}.img" ]; then
+ # platform image already created
+ cp ${item}.img ${PLATDIR}/${item}-android.img
+ else
+ echo "Error: no system image available for ${item}"
+ fi
+ # Copy the ramdisk
+ cp ramdisk.img ${PLATDIR}/${item}-ramdisk-android.img
+ popd
+ done
+ popd
+ fi
+ if [ "$UBOOT_BUILD_ENABLED" == "1" ]; then
+ # Android ramdisks for uboot
+ pushd ${PLATDIR}
+ for var in $ANDROID_BINS_VARIANTS; do
+ local addr=TARGET_$var[ramdisk]
+ ${UBOOT_MKIMG} -A $LINUX_ARCH -O linux -C none \
+ -T ramdisk -n ramdisk \
+ -a ${!addr} -e ${!addr} \
+ -n "Android ramdisk" \
+ -d ${var}-ramdisk-android.img \
+ ${var}-uInitrd-android.${!addr}
+ done
+ popd
+ fi
+ fi
+}
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source $DIR/framework.sh $1 $2
diff --git a/build-arm-tf.sh b/build-arm-tf.sh
index db8a011..32a3a77 100755
--- a/build-arm-tf.sh
+++ b/build-arm-tf.sh
@@ -39,29 +39,34 @@
# ARM_TF_PLATS - List of platforms to be built (from available in arm-tf/plat)
# ARM_TF_DEBUG_ENABLED - 1 = debug, 0 = release build
# ARM_TF_BUILD_FLAGS - Additional build flags to pass on the build command line
-# OPTEE_RAM_LOCATION - optee load location (dram/tsram/carveout)
+# ARM_TF_TBBR_BUILD_FLAGS - command line options to enable TBBR in ARM TF build
+# TBBR_{plat} - array of platform parameters, indexed by
+# tbbr - flag to indicate if TBBR is enabled
+# OPTEE_{plat} - array of platform parameters, indexed by
+# optee - flag to indicate if optee is enabled
#
do_build ()
{
if [ "$ARM_TF_BUILD_ENABLED" == "1" ]; then
- export ARM_TSP_RAM_LOCATION=$OPTEE_RAM_LOCATION
- #if trusted board boot(TBBR) enabled, set corresponding compiliation flags
- if [ "$ARM_TBBR_ENABLED" == "1" ]; then
- ARM_TF_BUILD_FLAGS="$ARM_TF_BUILD_FLAGS $ARM_TF_TBBR_BUILD_FLAGS"
- fi
pushd $TOP_DIR/$ARM_TF_PATH
for plat in $ARM_TF_PLATS; do
- local build_cmd="make -j $PARALLELISM PLAT=$plat DEBUG=$ARM_TF_DEBUG_ENABLED $ARM_TF_BUILD_FLAGS all"
- echo $build_cmd
- $build_cmd
+ local atf_build_flags=$ARM_TF_BUILD_FLAGS
+ local atf_tbbr_enabled=TBBR_$plat[tbbr]
+ local atf_optee_enabled=OPTEE_$plat[optee]
+ if [ "${!atf_tbbr_enabled}" == "1" ]; then
+ #if trusted board boot(TBBR) enabled, set corresponding compiliation flags
+ atf_build_flags="${atf_build_flags} $ARM_TF_TBBR_BUILD_FLAGS"
+ fi
+ if [ "${!atf_optee_enabled}" == "1" ]; then
+ #if optee enabled, set corresponding compiliation flags
+ atf_build_flags="${atf_build_flags} ARM_TSP_RAM_LOCATION=$OPTEE_RAM_LOCATION SPD=opteed"
+ fi
+ make -j $PARALLELISM PLAT=$plat DEBUG=$ARM_TF_DEBUG_ENABLED ${atf_build_flags} all
done
- # tool to create certificates
- if [ "$ARM_TBBR_ENABLED" == "1" ]; then
- make certtool
- fi
-
+ # make tools
+ make certtool
make fiptool
popd
fi
diff --git a/build-busybox.sh b/build-busybox.sh
index 5bae582..eec3e9a 100755
--- a/build-busybox.sh
+++ b/build-busybox.sh
@@ -33,10 +33,16 @@
#
# VARIANT - build variant name
# TOP_DIR - workspace root directory
-# CROSS_COMPILE - PATH to GCC including CROSS-COMPILE prefix
+# LINUX_COMPILER - PATH to GCC including CROSS-COMPILE prefix
# BUSYBOX_BUILD_ENABLED - Flag to enable building BusyBox
# BUSYBOX_PATH - sub-directory containing BusyBox code
# BUSYBOX_ARCH - Build architecture (arm)
+# BUSYBOX_RAMDISK_PATH - path to where we build the ramdisk
+# BUSYBOX_RAMDISK_LINUX_GEN_CPIO - tool to generate the RD
+# BUSYBOX_RAMDISK_BUSYBOX_PATH - path to the BB binary
+# TARGET_BINS_PLATS - the platforms to create binaries for
+# TARGET_{plat} - array of platform parameters, indexed by
+# ramdisk - the address of the ramdisk per platform
do_build ()
{
@@ -59,7 +65,9 @@ do_clean ()
pushd $TOP_DIR/$BUSYBOX_PATH
make clean
-
+ popd
+ pushd $TOP_DIR/$BUSYBOX_RAMDISK_PATH
+ rm -f ramdisk.img busybox
popd
fi
}
@@ -68,6 +76,30 @@ do_package ()
{
if [ "$BUSYBOX_BUILD_ENABLED" == "1" ]; then
echo "Packaging BUSYBOX... $VARIANT";
+ # create the ramdisk
+ pushd $TOP_DIR/$BUSYBOX_RAMDISK_PATH
+ cp $TOP_DIR/$BUSYBOX_RAMDISK_BUSYBOX_PATH .
+ $TOP_DIR/$BUSYBOX_RAMDISK_LINUX_GEN_CPIO files.txt > ramdisk.img
+ popd
+ # Copy binary to output folder
+ pushd $TOP_DIR
+ mkdir -p ${OUTDIR}
+ cp $BUSYBOX_RAMDISK_PATH/ramdisk.img \
+ ${PLATDIR}/ramdisk-busybox.img
+ popd
+ if [ "$UBOOT_BUILD_ENABLED" == "1" ]; then
+ pushd ${PLATDIR}
+ for target in $TARGET_BINS_PLATS; do
+ local addr=TARGET_$target[ramdisk]
+ ${UBOOT_MKIMG} -A $LINUX_ARCH -O linux -C none \
+ -T ramdisk -n ramdisk \
+ -a ${!addr} -e ${!addr} \
+ -n "BusyBox ramdisk" \
+ -d ramdisk-busybox.img \
+ uInitrd-busybox.${!addr}
+ done
+ popd
+ fi
fi
}
diff --git a/build-linux.sh b/build-linux.sh
index ae94692..326d1d8 100755
--- a/build-linux.sh
+++ b/build-linux.sh
@@ -40,6 +40,14 @@
# LINUX_ARCH - Build architecture (arm64)
# LINUX_DEFCONFIG - Single Linux defconfig to build. Ignored if LINUX_CONFIGS set
# LINUX_CONFIGS - List of Linaro config fragments to use to build
+# TARGET_BINS_PLATS - the platforms to create binaries for
+# TARGET_{plat} - array of platform parameters, indexed by
+# fdts - the fdt pattern used by the platform
+# UBOOT_UIMAGE_ADDRS - address at which to link UBOOT image
+# UBOOT_MKIMAGE - path to uboot mkimage
+# LINUX_ARCH - the arch
+# UBOOT_BUILD_ENABLED - flag to indicate the need for uimages.
+#
# LINUX_IMAGE_TYPE - Image or zImage (Image is the default if not specified)
LINUX_IMAGE_TYPE=${LINUX_IMAGE_TYPE:-Image}
@@ -56,17 +64,8 @@ do_build ()
for config in $LINUX_CONFIGS; do
CONFIG=$CONFIG"linaro/configs/${config}.conf "
done
- EXTRA_CONFIGS=$(mktemp ./.tmp.EXTRA_CONFIGS.XXXXXXXXXX)
- echo "CONFIG_GATOR=y" >>${EXTRA_CONFIGS}
-
- if [ "$OPTEE_BUILD_ENABLED" == "1" ]; then
- # OPTEE requires modules to be able to compile the linux driver
- echo "CONFIG_MODULES=y" >>${EXTRA_CONFIGS}
- fi
-
mkdir -p $LINUX_OUT_DIR
- scripts/kconfig/merge_config.sh -O $LINUX_OUT_DIR $CONFIG $EXTRA_CONFIGS
- rm $EXTRA_CONFIGS
+ scripts/kconfig/merge_config.sh -O $LINUX_OUT_DIR $CONFIG
else
echo "Building using defconfig..."
make O=$LINUX_OUT_DIR $LINUX_DEFCONFIG
@@ -94,9 +93,34 @@ do_package ()
echo "Packaging Linux... $VARIANT";
# Copy binary to output folder
pushd $TOP_DIR
- mkdir -p ${OUTDIR}/$LINUX_PATH/$VARIANT
- cp $LINUX_PATH/$LINUX_OUT_DIR/arch/$LINUX_ARCH/boot/$LINUX_IMAGE_TYPE ${OUTDIR}/$LINUX_PATH/$VARIANT/.
+ mkdir -p ${OUTDIR}/$LINUX_PATH/
+
+ for plat in $TARGET_BINS_PLATS; do
+ local fd=TARGET_$plat[fdts]
+ for target in ${!fd}; do
+ for item in $target; do
+ discoveredDTB=$(find $LINUX_PATH/$LINUX_OUT_DIR/arch/$LINUX_ARCH/boot/dts/ -name ${item}.dtb)
+ if [ "${discoveredDTB}" = "" ]; then
+ echo "skipping dtb $item"
+ else
+ cp ${discoveredDTB} ${OUTDIR}/$LINUX_PATH/.
+ fi
+ done
+ done
+ done
+
+ cp $LINUX_PATH/$LINUX_OUT_DIR/arch/$LINUX_ARCH/boot/$LINUX_IMAGE_TYPE ${OUTDIR}/$LINUX_PATH/.
popd
+ if [ "$UBOOT_BUILD_ENABLED" == "1" ]; then
+ pushd ${OUTDIR}/$LINUX_PATH/
+ for addr in $UBOOT_UIMAGE_ADDRS; do
+ ${UBOOT_MKIMG} -A $LINUX_ARCH -O linux -C none \
+ -T kernel -n Linux \
+ -a $addr -e $addr \
+ -n "Linux" -d $LINUX_IMAGE_TYPE uImage.$addr
+ done
+ popd
+ fi
fi
}
diff --git a/build-ramdisk.sh b/build-oe-binaries.sh
index 7545af0..9450583 100755
--- a/build-ramdisk.sh
+++ b/build-oe-binaries.sh
@@ -33,44 +33,62 @@
#
# VARIANT - build variant name
# TOP_DIR - workspace root directory
-# RAMDISK_BUILD_ENABLED - Flag to enable building ramdisk
-# RAMDISK_PATH - sub-directory containing ramdisk code
-# RAMDISK_LINUX_GEN_CPIO - path to gen_init_cpio tool
-# RAMDISK_BUSYBOX_PATH - path to built busybox image
+# OE_BINARIES_BUILD_ENABLED - Flag to enable this script
+# OE_BINARIES_PATH - sub-directory where to store Android binaries
+# UBOOT_MKIMAGE - path to uboot mkimage
+# LINUX_ARCH - the arch
+# UBOOT_BUILD_ENABLED - flag to indicate the need for uimages.
+# TARGET_BINS_PLATS - the platforms to create binaries for
+# TARGET_{plat} - array of platform parameters, indexed by
+# ramdisk - the address of the ramdisk per platform
+#
do_build ()
{
- if [ "$RAMDISK_BUILD_ENABLED" == "1" ]; then
- echo "Building... $VARIANT";
+ if [ "$OE_BINARIES_BUILD_ENABLED" == "1" ]; then
+ :
fi
}
do_clean ()
{
- if [ "$RAMDISK_BUILD_ENABLED" == "1" ]; then
- pushd $TOP_DIR/$RAMDISK_PATH
- rm -f ramdisk.img busybox
- popd
+ if [ "$OE_BINARIES_BUILD_ENABLED" == "1" ]; then
+ :
fi
}
do_package ()
{
- RAMDISK_LINUX_GEN_CPIO=${RAMDISK_LINUX_GEN_CPIO:-$LINUX_PATH/$LINUX_OUT_DIR/usr/gen_init_cpio}
+ if [ "$OE_BINARIES_BUILD_ENABLED" == "1" ]; then
+ echo "Packaging OE... $VARIANT"
+
+ mkdir -p ${PLATDIR}
+
+ pushd ${TOP_DIR}/${OE_BINARIES_PATH}
+
+ # Copy the binaries
+ cp *.img ${PLATDIR}
- if [ "$RAMDISK_BUILD_ENABLED" == "1" ]; then
- echo "Packaging ramdisk... $VARIANT";
- # create the ramdisk
- pushd $TOP_DIR/$RAMDISK_PATH
- cp $TOP_DIR/$RAMDISK_BUSYBOX_PATH .
- $TOP_DIR/$RAMDISK_LINUX_GEN_CPIO files.txt > ramdisk.img
- popd
- # Copy binary to output folder
- pushd $TOP_DIR
- mkdir -p ${OUTDIR}
- cp $RAMDISK_PATH/ramdisk.img ${OUTDIR}/
popd
fi
+ if [ "$OE_RAMDISK_BUILD_ENABLED" == "1" ]; then
+ if [ "$UBOOT_BUILD_ENABLED" == "1" ]; then
+ pushd ${PLATDIR}
+ # OpenEmbedded ramdisks
+ mkdir -p oe
+ touch oe/initrd
+ echo oe/initrd | cpio -ov > ramdisk-oe.img
+ for target in $TARGET_BINS_PLATS; do
+ local addr=TARGET_$target[ramdisk]
+ ${UBOOT_MKIMG} -A $LINUX_ARCH -O linux -C none \
+ -T ramdisk -n ramdisk \
+ -a ${!addr} -e ${!addr} \
+ -n "Dummy ramdisk" \
+ -d ramdisk-oe.img uInitrd-oe.${!addr}
+ done
+ popd
+ fi
+ fi
}
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
diff --git a/build-optee-os.sh b/build-optee-os.sh
index 87aba38..e05984f 100755
--- a/build-optee-os.sh
+++ b/build-optee-os.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -33,37 +33,39 @@
#
# OUTDIR - output dir for final packaging
# TOP_DIR - workspace root directory
-# OPTEE_ARCH - OPTEE OS execution mode
# OPTEE_BUILD_ENABLED - Flag to enable building optee
# OPTEE_OS_PATH - path to optee os code
-# OPTEE_PLATFORM - Platform for which to build optee for
-# OPTEE_PLATFORM_FLAVOR - Platform flavour for optee build
# OPTEE_OS_CROSS_COMPILE - gcc for compiling tee (optee os)
# OPTEE_OS_BIN_NAME - name of the optee os executable bin
# OPTEE_CORE_LOG_LEVEL - 1-> least debug logs, 4-> most debug logs
+# OPTEE_$plat[plat] - optee platform
+# OPTEE_$plat[flavor] - optee platform flavor
+# OPTEE_PLATS - List of platforms to be built
+#
do_build ()
{
if [ "$OPTEE_BUILD_ENABLED" == "1" ]; then
- #setup the environment
- #only aarch32 mode supported currently for optee execution
- if [ "$OPTEE_ARCH" == "aarch32" ]; then
- echo "Building OPTEE for $PLATFORM_FLAVOR"
+ for plat in $OPTEE_PLATS; do
+ echo "Building OPTEE for OPTEE_plat[$plat]"
+ local optee_plat=OPTEE_$plat[plat]
+ local optee_plat_flavor=OPTEE_$plat[flavor]
export CROSS_COMPILE=$OPTEE_OS_CROSS_COMPILE
- export PLATFORM=$OPTEE_PLATFORM
- export PLATFORM_FLAVOR=$OPTEE_PLATFORM_FLAVOUR
+ export PLATFORM=${!optee_plat}
+ export PLATFORM_FLAVOR=${!optee_plat_flavor}
export CFG_TEE_CORE_LOG_LEVEL=$OPTEE_CORE_LOG_LEVEL
- else
- echo
- echo "OPTEE: unsupported ARCH"
- echo
- exit 1;
- fi
-
- pushd $TOP_DIR/$OPTEE_OS_PATH
- make -j$PARALLELISM
- ## temp patch: to be fixed by proper memory mapping of TEE
- ${CROSS_COMPILE}objcopy -O binary out/arm-plat-${PLATFORM}/core/tee.elf out/arm-plat-${PLATFORM}/core/tee.bin
+ pushd $TOP_DIR/$OPTEE_OS_PATH
+ make -j$PARALLELISM
+ ## temp patch: to be fixed by proper memory mapping of TEE
+ mkdir -p out/arm-plat-${PLATFORM_FLAVOR}/core
+ ${CROSS_COMPILE}objcopy -O binary out/arm-plat-${PLATFORM}/core/tee.elf out/arm-plat-${PLATFORM_FLAVOR}/core/${OPTEE_OS_BIN_NAME}
+ popd
+ done
+ # optee client build
+ # temp patch: this will be removed once we have the client built in the LCR/OE
+ echo "Build optee client.."
+ pushd $TOP_DIR/optee/optee_client
+ make -j$PARALLELISM CROSS_COMPILE=${OPTEE_CLIENT_CROSS_COMPILE}
popd
fi
}
@@ -73,17 +75,32 @@ do_clean ()
if [ "$OPTEE_BUILD_ENABLED" == "1" ]; then
pushd $TOP_DIR/$OPTEE_OS_PATH
make clean
+ popd
+ pushd $TOP_DIR/optee/optee_client
+ make clean
+ popd
fi
}
do_package ()
{
if [ "$OPTEE_BUILD_ENABLED" == "1" ]; then
- pushd $TOP_DIR/$OPTEE_OS_PATH
- for plat in $ARM_TF_PLATS; do
+ for plat in $OPTEE_PLATS; do
+ local optee_plat_flavor=OPTEE_$plat[flavor]
+ export PLATFORM_FLAVOR=${!optee_plat_flavor}
+ pushd $TOP_DIR/$OPTEE_OS_PATH
mkdir -p ${OUTDIR}/$plat
- cp out/arm-plat-${OPTEE_PLATFORM}/core/${OPTEE_OS_BIN_NAME} ${OUTDIR}/$plat/tf-bl32.bin
+ cp out/arm-plat-${PLATFORM_FLAVOR}/core/${OPTEE_OS_BIN_NAME} ${OUTDIR}/$plat/${OPTEE_OS_BIN_NAME}
+ popd
done
+ # optee client is independent of platform config,
+ # packaging to plat independent location
+ echo "packaging optee client.."
+ mkdir -p ${OUTDIR}/optee/rootfs/usr/lib/
+ mkdir -p ${OUTDIR}/optee/rootfs/usr/bin/
+ pushd $TOP_DIR/optee/optee_client
+ find out/ -name "*.so*" -exec cp {} ${OUTDIR}/optee/rootfs/usr/lib/ \;
+ cp out/tee-supplicant/tee-supplicant ${OUTDIR}/optee/rootfs/usr/bin/
popd
fi
}
diff --git a/build-scp.sh b/build-scp.sh
new file mode 100755
index 0000000..dcfb093
--- /dev/null
+++ b/build-scp.sh
@@ -0,0 +1,123 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# Neither the name of ARM nor the names of its contributors may be used
+# to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+#
+# This script uses the following environment variables from the variant
+#
+# VARIANT - build variant name
+# TOP_DIR - workspace root directory
+# SCP_BUILD_ENABLED - Flag to enable building SCP
+# SCP_PATH - sub-directory containing SCP code
+# SCP_ARM_COMPILER_PATH - PATH to ARMCC compiler binaries, not needed if
+# SCP_GCC_COMPILER_PREFIX is used.
+# SCP_GCC_COMPILER_PREFIX - Prefix for gcc binaries
+# SCP_PLATFORMS - List of images to build in format <PLATFORM>-<PLAT>
+# SCP_BUILD_MODE - release or debug
+# SCP_BYPASS_ROM_SUPPORT - Mapping of platforms that require bypass ROM support
+
+do_build ()
+{
+ if [ "$SCP_BUILD_ENABLED" == "1" ]; then
+ pushd $TOP_DIR/$SCP_PATH
+ PATH=$SCP_ARM_COMPILER_PATH:$PATH
+ for item in $SCP_PLATFORMS; do
+ p1=${item%%_*}
+ p2=${item#*_}
+ local outdir=$TOP_DIR/$SCP_PATH/output/$item
+ mkdir -p ${outdir}
+
+ local COMPILER_OPTIONS=""
+ if [ ! -z "$SCP_GCC_COMPILER_PREFIX" ] ; then
+ COMPILER_OPTIONS="TOOLCHAIN=GCC GCC32_TOOLCHAIN=$SCP_GCC_COMPILER_PREFIX"
+ fi
+
+ make -j $PARALLELISM PLATFORM=$p1 PLAT=$p2 MODE=$SCP_BUILD_MODE ${COMPILER_OPTIONS}
+
+ if [ "${SCP_BYPASS_ROM_SUPPORT[$p1]}" = true ]; then
+ make -j $PARALLELISM PLATFORM=$p1 PLAT=$p2 MODE=$SCP_BUILD_MODE ${COMPILER_OPTIONS} scp-bypassrom
+ fi
+ cp -r build/artefacts/* ${outdir}/
+ done
+ popd
+ fi
+}
+
+do_clean ()
+{
+ if [ "$SCP_BUILD_ENABLED" == "1" ]; then
+ pushd $TOP_DIR/$SCP_PATH
+ for item in $SCP_PLATFORMS; do
+ p1=${item%%_*}
+ p2=${item#*_}
+ local outdir=$TOP_DIR/$SCP_PATH/output/$item
+ make PLATFORM=$p1 clean
+ rm -rf ${outdir}
+ done
+ popd
+ fi
+}
+
+do_package ()
+{
+ pushd $TOP_DIR
+ for plat in $SCP_PLATFORMS; do
+ if [ "$SCP_BUILD_ENABLED" == "1" ]; then
+ mkdir -p ${OUTDIR}/${plat}
+ cp ./${SCP_PATH}/output/${plat}/scp/ramfw.bin ${OUTDIR}/${plat}/scp-ram.bin
+ cp ./${SCP_PATH}/output/${plat}/scp/romfw.bin ${OUTDIR}/${plat}/scp-rom.bin
+ if [ -d ${TOP_DIR}/${SCP_PATH}/output/${plat}/mcp ]; then
+ cp ./${SCP_PATH}/output/${plat}/mcp/ramfw.bin ${OUTDIR}/${plat}/mcp-ram.bin
+ cp ./${SCP_PATH}/output/${plat}/mcp/romfw.bin ${OUTDIR}/${plat}/mcp-rom.bin
+ fi
+
+ p1=${plat%%_*}
+ if [ "${SCP_BYPASS_ROM_SUPPORT[$p1]}" = true ]; then
+ cp ./${SCP_PATH}/output/${plat}/scp/romfw_bypass.bin ${OUTDIR}/${plat}/scp-rom-bypass.bin
+ fi
+
+ else
+ mkdir -p ${OUTDIR}/${plat}
+ local var=SCP_PREBUILT_RAMFW_${plat}
+ local fw=${!var}
+ if [ -e "$fw" ]; then
+ cp $fw ${OUTDIR}/${plat}/scp-ram.bin
+ fi
+ var=SCP_PREBUILT_ROMFW_BYPASS_${plat}
+ fw=${!var}
+ if [ -e "$fw" ]; then
+ cp ${fw} ${OUTDIR}/${plat}/scp-rom-bypass.bin
+ fi
+ fi
+ done
+ popd
+}
+
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source $DIR/framework.sh $1 $2
diff --git a/build-target-bins.sh b/build-target-bins.sh
index cddf9be..a5136e3 100755
--- a/build-target-bins.sh
+++ b/build-target-bins.sh
@@ -35,77 +35,28 @@
# TOP_DIR - workspace root directory
# ARM_TF_PATH - for the fip tool / output images
# UBOOT_PATH - for mkimage / output images
-# TARGET_BINS_PLATS - the platforms to create binaries for
-# TARGET_ARM_TF_### - the arm-tf output directory, where ### is the arm-tf plat name
-# TARGET_SCP_### - the scp output directory, where ### is the scp plat name
-# TARGET_UBOOT_### - the uboot output directory, where ### is the boot plat name
-# TARGET_UEFI_### - the uefi output directory, where ### is the uefi plat name.
-# TARGET_BINS_UIMAGE_ADDRS - the uImage load addresses
-# TARGET_BINS_UINITRD_ADDRS - the uInitrd load addresses
# TARGET_BINS_HAS_ANDROID - whether we have android enabled
# TARGET_BINS_HAS_OE - whether we have OE enabled
# TARGET_BINS_HAS_DTB_RAMDISK - whether create dtbs with ramdisk chosen node
-# TARGET_BINS_RAMDISK_ADDR - address in RAM that ramdisk is loaded. Required if TARGET_BINS_HAS_DTB_RAMDISK=1
# LINUX_ARCH - the architecure to build the output for (arm or arm64)
-# DEVTREE_LINUX_PATH - Path to Linux tree containing DT compiler
-# LINUX_IMAGE_TYPE - Image or zImage (defaults to Image if not specified)
-LINUX_IMAGE_TYPE=${LINUX_IMAGE_TYPE:-Image}
-
-populate_variant()
-{
- local outdir=$1
- local boot_type=$2
-
- # copy ramdisk to the variant
- if [ "$TARGET_BINS_HAS_OE" = "1" ]; then
- if [ "$boot_type" = "uboot" ]; then
- cp ${OUTDIR}/uInitrd-oe.$TARGET_BINS_UINITRD_ADDRS $outdir/ramdisk.img
- else
- cp ${OUTDIR}/ramdisk.img $outdir/ramdisk.img
- fi
- elif [ "$TARGET_BINS_HAS_BUSYBOX" = "1" ]; then
- if [ "$boot_type" = "uboot" ]; then
- cp ${OUTDIR}/uInitrd-busybox.$TARGET_BINS_UINITRD_ADDRS $outdir/ramdisk.img
- else
- cp ${OUTDIR}/ramdisk.img $outdir/ramdisk.img
- fi
- elif [ "$TARGET_BINS_HAS_ANDROID" = "1" ]; then
- if [ "$boot_type" = "uboot" ]; then
- cp ${OUTDIR}/uInitrd-android.$TARGET_BINS_UINITRD_ADDRS $outdir/ramdisk.img
- else
- plat=`echo $VARIANT | cut -d "-" -f 1`
- cp ${TOP_DIR}/prebuilts/android/$plat/ramdisk.img $outdir/ramdisk.img
- fi
- fi
-
- if [ "$LINUX_BUILD_ENABLED" == "1" ]; then
- # copy the kernel Image and *.dtb to the variant
- if [ "$TARGET_BINS_UIMAGE_ADDRS" != "" ]; then
- for addr in $TARGET_BINS_UIMAGE_ADDRS; do
- cp ${OUTDIR}/$LINUX_PATH/$VARIANT/uImage.$addr $outdir
- done
- else
- cp ${OUTDIR}/$LINUX_PATH/$VARIANT/$LINUX_IMAGE_TYPE $outdir
- fi
- for ((i=0;i<${#DEVTREE_TREES[@]};++i)); do
- if [ "$TARGET_BINS_HAS_DTB_RAMDISK" = "1" ]; then
- chosen="-chosen"
- fi
- if [ "${DEVTREE_TREES_RENAME[i]}" == "" ]; then
- newname=${DEVTREE_TREES[i]}.dtb
- else
- newname=${DEVTREE_TREES_RENAME[i]}
- fi
- dts_dir=${TOP_DIR}/$LINUX_PATH/$LINUX_OUT_DIR/arch/${LINUX_ARCH}/boot/dts/arm/
- if [ ! -e ${TOP_DIR}/$LINUX_PATH/$LINUX_OUT_DIR/arch/${LINUX_ARCH}/boot/dts/arm/ ]; then
- dts_dir=${TOP_DIR}/$LINUX_PATH/$LINUX_OUT_DIR/arch/${LINUX_ARCH}/boot/dts/
- fi
-
- cp ${dts_dir}/${DEVTREE_TREES[i]}${chosen}.dtb $outdir/${newname} 2>/dev/null || :
- done
- fi
-}
-
+# DEVTREE_DTC_PATH - Path to Linux tree containing DT compiler
+# TARGET_BINS_PLATS - the platforms to create binaries for
+# TARGET_{plat} - array of platform parameters, indexed by
+# arm-tf - where to find the arm-tf binaries
+# scp - the scp output directory
+# uboot - the uboot output directory
+# uefi - the uefi output directory
+# fdts - the fdt pattern used by the platform
+# linux - the linux image / uImage for a platform
+# ramdisk - the address of the ramdisk per platform
+# tbbr - flag to indicate if TBBR is enabled
+# TARGET_BINS_COPY_ENABLED - whether we have extra copy steps
+# TARGET_BINS_COPY_LIST - an array of "src dest" strings that
+# can be fed into a cp command. Zero based index.
+# ARM_TF_ROT_KEY - Root Key location for COT generation
+# TARGET_BINS_EXTRA_TAR_LIST - Extra folders that are to be tarred
+# OPTEE_OS_BIN_NAME - optee os binary name
+#
do_build()
{
if [ "$TARGET_BINS_BUILD_ENABLED" == "1" ]; then
@@ -122,234 +73,285 @@ do_clean()
append_chosen_node()
{
- # $1 = dtb name
+ # $1 = new dtb name
# $2 = ramdisk file
- local ramdisk_end=$(($TARGET_BINS_RAMDISK_ADDR + $(wc -c < $2)))
- local DTC=$TOP_DIR/$LINUX_PATH/$LINUX_OUT_DIR/scripts/dtc/dtc
- local tmp=linux/tmp
- local devtree_path=$TOP_DIR/$LINUX_PATH/$LINUX_OUT_DIR/arch/arm64/boot/dts/arm
- local devtree=$devtree_path/$1
-
- if [ ! -e $devtree_path ]; then
- # take into account that the DTS dir added and "arm" sub-dir between 3.10 and 4.1
- devtree_path=$TOP_DIR/$LINUX_PATH/$LINUX_OUT_DIR/arch/arm64/boot/dts
- devtree=$devtree_path/$1
+ # $3 = original dtb name
+ # $4 = ramdisk address
+ local ramdisk_end=$(($4 + $(wc -c < $2)))
+ local DTC=$TOP_DIR/$DEVTREE_DTC_PATH/scripts/dtc/dtc
+ # Decode the DTB
+ ${DTC} -Idtb -Odts -o$1.dts linux/$3.dtb
+
+ echo "" >> $1.dts
+ echo "/ {" >> $1.dts
+ echo " chosen {" >> $1.dts
+ echo " linux,initrd-start = <$4>;" >> $1.dts
+ echo " linux,initrd-end = <${ramdisk_end}>;" >> $1.dts
+ echo " };" >> $1.dts
+ echo "};" >> $1.dts
+
+ # Recode the DTB
+ ${DTC} -Idts -Odtb -olinux/$1.dtb $1.dts
+
+ # And clean up
+ rm $1.dts
+}
+
+relative_path()
+{
+ # both $1 and $2 are absolute paths beginning with /
+ # returns relative path to $2/$target from $1/$source
+ source=$2
+ target=$1
+
+ common_part=$source # for now
+ result="" # for now
+
+ while [[ "${target#$common_part}" == "${target}" ]]; do
+ # no match, means that candidate common part is not correct
+ # go up one level (reduce common part)
+ common_part="$(dirname $common_part)"
+ # and record that we went back, with correct / handling
+ if [[ -z $result ]]; then
+ result=".."
+ else
+ result="../$result"
+ fi
+ done
+
+ if [[ $common_part == "/" ]]; then
+ # special case for root (no common path)
+ result="$result/"
fi
- if [ -e ${devtree}.dtb ]; then
- cp ${devtree}.dtb ${tmp}.dtb
-
- # Decode the DTB
- ${DTC} -Idtb -Odts -o${tmp}.dts ${devtree}.dtb
-
- echo "" >> ${tmp}.dts
- echo "/ {" >> ${tmp}.dts
- echo " chosen {" >> ${tmp}.dts
- echo " linux,initrd-start = <$TARGET_BINS_RAMDISK_ADDR>;" >> ${tmp}.dts
- echo " linux,initrd-end = <${ramdisk_end}>;" >> ${tmp}.dts
- echo " };" >> ${tmp}.dts
- echo "};" >> ${tmp}.dts
-
- # Recode the DTB
- ${DTC} -Idts -Odtb -o${devtree}-chosen.dtb ${tmp}.dts
-
- # And clean up
- rm ${tmp}.dts
- else
- echo ""
- echo ""
- echo "********************************************************************************"
- echo "ERROR: Missing file: ${devtree}.dtb"
- echo " Continuing to process other .dtb files"
- echo "********************************************************************************"
- echo ""
- echo ""
+ # since we now have identified the common part,
+ # compute the non-common part
+ forward_part="${target#$common_part}"
+
+ # and now stick all parts together
+ if [[ -n $result ]] && [[ -n $forward_part ]]; then
+ result="$result$forward_part"
+ elif [[ -n $forward_part ]]; then
+ # extra slash removal
+ result="${forward_part:1}"
fi
+ echo ${result}
}
-do_package()
+# $1: TARGET_blah from variant
+# $2: target from variant
+# $3: file pattern
+create_tgt_symlinks()
{
- if [ "$TARGET_BINS_BUILD_ENABLED" == "1" ]; then
- # Create uImages and uInitrds
- local uboot_mkimage=${TOP_DIR}/${UBOOT_PATH}/output/tools/mkimage
- local common_flags="-A $LINUX_ARCH -O linux -C none"
- if [ "$LINUX_BUILD_ENABLED=" == "1" ]; then
- pushd ${OUTDIR}/$LINUX_PATH
- for addr in $TARGET_BINS_UIMAGE_ADDRS; do
- ${uboot_mkimage} ${common_flags} -T kernel -n Linux -a $addr -e $addr -n "Linux" -d $LINUX_IMAGE_TYPE uImage.$addr
- done
- popd
- fi
- pushd ${OUTDIR}
- if [ "$TARGET_BINS_HAS_ANDROID" = "1" ]; then
- for addr in $TARGET_BINS_UINITRD_ADDRS; do
- plat=`echo $VARIANT | cut -d "-" -f 1`
- ${uboot_mkimage} ${common_flags} -T ramdisk -n ramdisk -a $addr -e $addr -n "Android ramdisk" -d ${TOP_DIR}/prebuilts/android/$plat/ramdisk.img uInitrd-android.$addr
- done
- fi
- if [ "$TARGET_BINS_HAS_OE" = "1" ]; then
- mkdir -p oe
- touch oe/initrd ; echo oe/initrd | cpio -ov > ramdisk.img
- for addr in $TARGET_BINS_UINITRD_ADDRS; do
- ${uboot_mkimage} ${common_flags} -T ramdisk -n ramdisk -a $addr -e $addr -n "Dummy ramdisk" -d ramdisk.img uInitrd-oe.$addr
- done
- fi
- if [ "$TARGET_BINS_HAS_BUSYBOX" = "1" ]; then
- mkdir -p busybox
- for addr in $TARGET_BINS_UINITRD_ADDRS; do
- ${uboot_mkimage} ${common_flags} -T ramdisk -n ramdisk -a $addr -e $addr -n "BusyBox ramdisk" -d ${OUTDIR}/ramdisk.img uInitrd-busybox.$addr
- done
+ shopt -s nullglob
+
+ if [[ "${OUTDIR}/$1" != "${PLATDIR}/$2" ]]; then
+ mkdir -p ${PLATDIR}/$2
+ for bin in ${OUTDIR}/$1/$3; do
+ local dirlink=$(relative_path $(dirname ${bin}) ${PLATDIR}/$1)
+ local filename=$(basename ${bin})
+ ln -sf ${dirlink}/${filename} ${PLATDIR}/$2/${filename}
+ done
+ fi
+}
+
+# $1: ramdisk address
+# $2: devtree
+# $3: plat name
+update_devtree()
+{
+ if [ "$TARGET_BINS_HAS_ANDROID" = "1" ]; then
+ if [ -e ${PLATDIR}/$3-ramdisk-android.img ]; then
+ append_chosen_node $2-chosen-android \
+ ${PLATDIR}/$3-ramdisk-android.img $2 $1
+ else
+ echo "Skipping non-existing android RD for $3."
fi
- popd
+ elif [ "$TARGET_BINS_HAS_OE" = "1" ]; then
+ append_chosen_node $2-chosen-oe ${PLATDIR}/ramdisk-oe.img $2 $1
+ fi
+ append_chosen_node $2-chosen ${PLATDIR}/ramdisk-busybox.img $2 $1
+}
+do_package()
+{
+ if [ "$TARGET_BINS_BUILD_ENABLED" == "1" ]; then
+ echo "Packaging target binaries $VARIANT";
# Add chosen node for ramdisk to dtbs
-
if [ "$TARGET_BINS_HAS_DTB_RAMDISK" = "1" ]; then
pushd ${OUTDIR}
- for ((i=0;i<${#DEVTREE_TREES[@]};++i)); do
- item=${DEVTREE_TREES[i]}
- if [ "$TARGET_BINS_HAS_ANDROID" = "1" ]; then
- plat=`echo $VARIANT | cut -d "-" -f 1`
- append_chosen_node ${item} ${TOP_DIR}/prebuilts/android/$plat/ramdisk.img
- fi
- if [ "$TARGET_BINS_HAS_OE" = "1" ]; then
- append_chosen_node ${item} ramdisk.img
- fi
- if [ "$TARGET_BINS_HAS_BUSYBOX" = "1" ]; then
- append_chosen_node ${item} ramdisk.img
- fi
+ rm -f linux/*chosen*.dtb
+ for plat in $TARGET_BINS_PLATS; do
+ local fd=TARGET_$plat[fdts]
+ for target in ${!fd}; do
+ local data=`ls linux/${target}.dtb || echo ""`
+ for item in $data; do
+ local tempy=TARGET_$plat[ramdisk]
+ # remove dir and extension..
+ x="$item"
+ y=${x%.dtb}
+ z=${y##*/}
+ update_devtree ${!tempy} $z $plat
+ done
+ done
done
- popd
fi
- echo "Packaging target binaries $VARIANT";
- # Create FIPs
- for target in $TARGET_BINS_PLATS; do
- local tf_out="TARGET_ARM_TF_"$target
- local scp_out="TARGET_SCP_"$target
- local uboot_out="TARGET_UBOOT_"$target
- local uefi_out="TARGET_UEFI_"$target
- local bl2_param="--tb-fw ${OUTDIR}/${!tf_out}/tf-bl2.bin"
- local bl31_param="--soc-fw ${OUTDIR}/${!tf_out}/tf-bl31.bin"
- local bl30_param=
- local bl32_param=
-
- if [ "${!scp_out}" != "" ]; then
- bl30_param="--scp-fw ${TOP_DIR}/${!scp_out}/bl30.bin"
- fi
+ if [ "$ARM_TF_PATH" != "" ]; then
+ # Now do the platform stuff...
+ local fip_tool=$TOP_DIR/$ARM_TF_PATH/tools/fip_create/fip_create
+
+ # From LT release 16.01 onwards, fip tool param identifiers have changed
+ # To maintain backward compatibility within build script, dynamically
+ # select identifiers
- if [ -e "${OUTDIR}/${!tf_out}/tf-bl32.bin" ]; then
- bl32_param="--tos-fw ${OUTDIR}/${!tf_out}/tf-bl32.bin"
+ if(${fip_tool} --help | grep "\-\-scp-fwu-cfg")
+ then
+ echo "Using TBBR spec terminology for image name identifiers"
+ local bl2_param_id="--tb-fw"
+ local bl30_param_id="--scp-fw"
+ local bl31_param_id="--soc-fw"
+ local bl32_param_id="--tos-fw"
+ local bl33_param_id="--nt-fw"
+ else
+ echo "Using legacy terminology for image name identifiers"
+ local bl2_param_id="--bl2"
+ local bl30_param_id="--bl30"
+ local bl31_param_id="--bl31"
+ local bl32_param_id="--bl32"
+ local bl33_param_id="--bl33"
fi
- local common_param="${bl2_param} ${bl31_param} ${bl30_param} ${bl32_param}"
- if [ "$ARM_TBBR_ENABLED" == "1" ]; then
- local trusted_key_cert_param="--trusted-key-cert ${OUTDIR}/${!tf_out}/trusted_key.crt"
- local bl30_tbbr_param="--scp-fw-key-cert ${OUTDIR}/${!tf_out}/bl30_key.crt --scp-fw-cert ${OUTDIR}/${!tf_out}/bl30.crt"
- local bl31_tbbr_param="--soc-fw-key-cert ${OUTDIR}/${!tf_out}/bl31_key.crt --soc-fw-cert ${OUTDIR}/${!tf_out}/bl31.crt"
- local bl32_tbbr_param=
- local bl33_tbbr_param="--nt-fw-key-cert ${OUTDIR}/${!tf_out}/bl33_key.crt --nt-fw-cert ${OUTDIR}/${!tf_out}/bl33.crt"
- local bl2_tbbr_param="--tb-fw-cert ${OUTDIR}/${!tf_out}/bl2.crt"
+ for target in $TARGET_BINS_PLATS; do
+ local tf_out=TARGET_$target[arm-tf]
+ local scp_out=TARGET_$target[scp]
+ local uboot_out=TARGET_$target[uboot]
+ local uefi_out=TARGET_$target[uefi]
+ local fdt_pattern=TARGET_$target[fdts]
+ local linux_bins=TARGET_$target[linux]
+ local bl2_fip_param="${bl2_param_id} ${OUTDIR}/${!tf_out}/tf-bl2.bin"
+ local bl31_fip_param="${bl31_param_id} ${OUTDIR}/${!tf_out}/tf-bl31.bin"
+ local bl32_fip_param=
+ local bl30_fip_param=
+ local bl30_tbbr_param=
+ local cert_tool_param=
+ local atf_tbbr_enabled=TARGET_$target[tbbr]
+ local optee_enabled=TARGET_$target[optee]
+
+ if [ "${!scp_out}" != "" ]; then
+ bl30_fip_param="${bl30_param_id} ${OUTDIR}/${!scp_out}/scp-ram.bin"
+ fi
#only if a TEE implementation is available and built
- if [ -e "${OUTDIR}/${!tf_out}/tf-bl32.bin" ]; then
- bl32_tbbr_param="--tos-fw-key-cert ${OUTDIR}/${!tf_out}/bl32_key.crt --tos-fw-cert ${OUTDIR}/${!tf_out}/bl32.crt"
+ if [ "${!optee_enabled}" == "1" ]; then
+ echo ${OUTDIR}/${!tf_out}/
+ bl32_fip_param="${bl32_param_id} ${OUTDIR}/${!tf_out}/${OPTEE_OS_BIN_NAME}"
fi
- # add the cert related params to be used by fip_create as well as cert_create
- common_param="${common_param} ${trusted_key_cert_param} \
- ${bl30_tbbr_param} ${bl31_tbbr_param} \
- ${bl32_tbbr_param} ${bl33_tbbr_param} \
- ${bl2_tbbr_param}"
+ local fip_param="${bl2_fip_param} ${bl31_fip_param} ${bl30_fip_param} ${bl32_fip_param}"
+ echo "fip_param is $fip_param"
- #fip_create tool and cert_create tool take almost identical params
- local cert_tool_param="${common_param} --rot-key ${ROT_KEY} -n --tfw-nvctr 31 --ntfw-nvctr 223"
+ if [ "${!atf_tbbr_enabled}" == "1" ]; then
+ local trusted_key_cert_param="--trusted-key-cert ${OUTDIR}/${!tf_out}/trusted_key.crt"
+ if [ "${!scp_out}" != "" ]; then
+ local bl30_tbbr_param="${bl30_param_id}-key-cert ${OUTDIR}/${!tf_out}/bl30_key.crt ${bl30_param_id}-cert ${OUTDIR}/${!tf_out}/bl30.crt"
+ fi
+ local bl31_tbbr_param="${bl31_param_id}-key-cert ${OUTDIR}/${!tf_out}/bl31_key.crt ${bl31_param_id}-cert ${OUTDIR}/${!tf_out}/bl31.crt"
+ local bl32_tbbr_param=
+ local bl33_tbbr_param="${bl33_param_id}-key-cert ${OUTDIR}/${!tf_out}/bl33_key.crt ${bl33_param_id}-cert ${OUTDIR}/${!tf_out}/bl33.crt"
+ local bl2_tbbr_param="${bl2_param_id}-cert ${OUTDIR}/${!tf_out}/bl2.crt"
- fi
+ #only if a TEE implementation is available and built
+ if [ "${!optee_enabled}" == "1" ]; then
+ bl32_tbbr_param="${bl32_param_id}-key-cert ${OUTDIR}/${!tf_out}/bl32_key.crt ${bl32_param_id}-cert ${OUTDIR}/${!tf_out}/bl32.crt"
+ fi
+
+ # add the cert related params to be used by fip_create as well as cert_create
+ fip_param="${fip_param} ${trusted_key_cert_param} \
+ ${bl30_tbbr_param} ${bl31_tbbr_param} \
+ ${bl32_tbbr_param} ${bl33_tbbr_param} \
+ ${bl2_tbbr_param}"
+
+ #fip_create tool and cert_create tool take almost identical params
+ cert_tool_param="${fip_param} --rot-key ${ARM_TF_ROT_KEY} -n --tfw-nvctr 31 --ntfw-nvctr 223"
- if [ "$BOOTMON_BUILD_ENABLED" == "1" ]; then
- local outdir=${OUTDIR}/${VARIANT}/bootmon
- mkdir -p ${outdir}
- populate_variant $outdir bootmon
- if [ "$BOOTMON_SCRIPT" != "" ]; then
- script_src=${TOP_DIR}/vexpress-firmware/SOFTWARE/bootkern.txt
- script_file=${outdir}/${BOOTMON_SCRIPT}
fi
- fi
- if [ "$UBOOT_BUILD_ENABLED" == "1" ]; then
if [ "${!uboot_out}" != "" ]; then
# remove existing fip
- local outdir=${OUTDIR}/${VARIANT}/uboot
- local outfile=${outdir}/fip.bin
- rm -f $outfile
- mkdir -p ${outdir}
+ rm -f ${PLATDIR}/$target/fip-uboot.bin
+ mkdir -p ${PLATDIR}/$target
+
# if TBBR is enabled, generate certificates
- if [ "$ARM_TBBR_ENABLED" == "1" ]; then
+ if [ "${!atf_tbbr_enabled}" == "1" ]; then
$TOP_DIR/$ARM_TF_PATH/tools/cert_create/cert_create \
${cert_tool_param} \
- --nt-fw ${OUTDIR}/${!uboot_out}/uboot.bin
-
- fi
- if [ "$ARM_TF_BUILD_ENABLED" == "1" ]; then
- $TOP_DIR/$ARM_TF_PATH/tools/fip_create/fip_create --dump \
- ${common_param} \
- --nt-fw ${OUTDIR}/${!uboot_out}/uboot.bin \
- $outfile
- cp ${OUTDIR}/${!tf_out}/tf-bl1.bin $outdir/bl1.bin
- else
- cp ${OUTDIR}/${!uboot_out}/uboot.bin ${OUTDIR}/${VARIANT}/uboot/$UBOOT_OUTPUT_FILENAME
- fi
- if [ "$BOOTMON_SCRIPT" != "" ]; then
- script_src=${TOP_DIR}/vexpress-firmware/SOFTWARE/bootuefi.txt
- script_file=${outdir}/${BOOTMON_SCRIPT}
+ ${bl33_param_id} ${OUTDIR}/${!uboot_out}/uboot.bin
fi
- populate_variant $outdir uboot
+
+ ${fip_tool} --dump \
+ ${fip_param} \
+ ${bl33_param_id} ${OUTDIR}/${!uboot_out}/uboot.bin \
+ ${PLATDIR}/$target/fip-uboot.bin
+
+ local outfile=${outdir}/fip.bin
+ rm -f $outfile
fi
- fi
- if [ "$UEFI_BUILD_ENABLED" == "1" ]; then
if [ "${!uefi_out}" != "" ]; then
# remove existing fip
- local outdir=${OUTDIR}/${VARIANT}/uefi
- local outfile=${outdir}/fip.bin
- rm -f $outfile
- mkdir -p ${outdir}
+ rm -f ${PLATDIR}/$target/fip-uefi.bin
+ mkdir -p ${PLATDIR}/$target
# if TBBR is enabled, generate certificates
- if [ "$ARM_TBBR_ENABLED" == "1" ]; then
+ if [ "${!atf_tbbr_enabled}" == "1" ]; then
$TOP_DIR/$ARM_TF_PATH/tools/cert_create/cert_create \
${cert_tool_param} \
- --nt-fw ${OUTDIR}/${!uefi_out}/uefi.bin
-
- fi
- if [ "$ARM_TF_BUILD_ENABLED" == "1" ]; then
- $TOP_DIR/$ARM_TF_PATH/tools/fip_create/fip_create --dump \
- ${common_param} \
- --nt-fw ${OUTDIR}/${!uefi_out}/uefi.bin \
- $outfile
- cp ${OUTDIR}/${!tf_out}/tf-bl1.bin $outdir/bl1.bin
- else
- cp ${OUTDIR}/${!uefi_out}/uefi.bin ${OUTDIR}/${VARIANT}/uefi/$UEFI_OUTPUT_FILENAME
+ ${bl33_param_id} ${OUTDIR}/${!uefi_out}/uefi.bin
fi
- if [ "$BOOTMON_SCRIPT" != "" ]; then
- script_src=${TOP_DIR}/vexpress-firmware/SOFTWARE/bootuefi.txt
- script_file=${outdir}/${BOOTMON_SCRIPT}
- fi
- populate_variant $outdir uefi
+
+ ${fip_tool} --dump \
+ ${fip_param} \
+ ${bl33_param_id} ${OUTDIR}/${!uefi_out}/uefi.bin \
+ ${PLATDIR}/$target/fip-uefi.bin
fi
- fi
- if [ "$BOOTMON_SCRIPT" != "" ]; then
- cp ${script_src} ${script_file}
- fi
- done
- # clean up unwanted artifacts left in output directory
- pushd ${OUTDIR}
- rm -f uInitrd-* || :
- rm -f ramdisk*.img || :
- rm -rf linux || :
- rm -rf ${TARGET_BINS_PLATS} || :
- rm -rf oe || :
- rm -rf busybox || :
- popd
+ # Create symlinks to common binaries
+ if [ "${!tf_out}" != "" ]; then
+ create_tgt_symlinks ${!tf_out} ${target} "tf-*"
+ fi
+ if [ "${!scp_out}" != "" ]; then
+ create_tgt_symlinks ${!scp_out} ${target} "*cp-*"
+ fi
+ if [ "${!uboot_out}" != "" ]; then
+ create_tgt_symlinks ${!uboot_out} ${target} "uboot*"
+ fi
+ if [ "${!uefi_out}" != "" ]; then
+ create_tgt_symlinks ${!uefi_out} ${target} "uefi*"
+ fi
+ for tgt in ${!fdt_pattern}; do
+ create_tgt_symlinks linux ${target} "${tgt}*"
+ done
+ for item in ${!linux_bins}; do
+ create_tgt_symlinks linux ${target} $item
+ done
+ done
+ fi
+ fi
+
+ if [ "$TARGET_BINS_COPY_ENABLED" == "1" ] ; then
+ local array_length=${#TARGET_BINS_COPY_LIST[@]}
+ for (( i=0; i<${array_length}; i++ )); do
+ local copy_params=(${TARGET_BINS_COPY_LIST[$i]})
+ destdir=`dirname "${copy_params[1]}"`
+ test -d $destdir || mkdir -p $destdir
+ cmd="cp -r ${TARGET_BINS_COPY_LIST[$i]}"
+ echo $cmd
+ $cmd
+ done
fi
+ for tarDir in $TARGET_BINS_EXTRA_TAR_LIST ; do
+ tarname=$(basename $tarDir).tar.gz
+ pushd $tarDir
+ tar -czf ../$tarname *
+ popd
+ done
}
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
diff --git a/build-uefi.sh b/build-uefi.sh
index 4146022..98a2564 100755
--- a/build-uefi.sh
+++ b/build-uefi.sh
@@ -37,20 +37,44 @@
# PARALLELISM - number of cores to build across
# UEFI_BUILD_ENABLED - Flag to enable building UEFI
# UEFI_PATH - sub-directory containing UEFI code
-# UEFI_PLATFORMS - List of platform Makefiles to run
# UEFI_BUILD_MODE - DEBUG or RELEASE
-# UEFI_TOOLCHAIN - supported Toolchain, eg: GCC49, GCC48 or GCC47
-# UEFI_OUTPUT_PLATFORMS - list of outputs to export
-# UEFI_BINARY - the filename of the UEFI binary
+# UEFI_TOOLCHAIN - Toolchain supported by Linaro uefi-tools: GCC49, GCC48 or GCC47
+# UEFI_PLATFORMS - List of platforms to build
+# UEFI_PLAT_{platform name} - array of platform parameters:
+# - platname - the name of the platform used by the build
+# - makefile - the makefile to execute for this platform
+# - output - where to store the files in packaging phase
+# - defines - extra platform defines during the build
+# - binary - what to call the final output binary
+# UEFI_ACPICA_PATH - Path to ACPICA tools containing the iasl command
+
do_build ()
{
if [ "$UEFI_BUILD_ENABLED" == "1" ]; then
pushd $TOP_DIR/$UEFI_ACPICA_PATH
+ unset HOST
make iasl
popd
pushd $TOP_DIR/$UEFI_PATH
+ CROSS_COMPILE_DIR=$(dirname $CROSS_COMPILE)
+ PATH="$PATH:$CROSS_COMPILE_DIR"
+ source ./edksetup.sh
+ make -C BaseTools
+ export EDK2_TOOLCHAIN=$UEFI_TOOLCHAIN
+ export ${UEFI_TOOLCHAIN}_AARCH64_PREFIX=$CROSS_COMPILE
+ local vars=
for item in $UEFI_PLATFORMS; do
- IASL_PREFIX=${TOP_DIR}/${UEFI_ACPICA_PATH}/bin/ ${TOP_DIR}/${UEFI_TOOLS_PATH}/uefi-build.sh -b $UEFI_BUILD_MODE -D EDK_OUT_DIR=$UEFI_OUTPUT_PLATFORMS $item
+ makefile=UEFI_PLAT_$item[makefile]
+ if [ "${!makefile}" != "" ]; then
+ vars=UEFI_PLAT_$item[defines]
+ export EDK2_MACROS="-n $PARALLELISM ${!vars}"
+ vars=UEFI_PLAT_$item[platname]
+ export EDK2_PLATFORM=${!vars}
+ IASL_PREFIX=${TOP_DIR}/${UEFI_ACPICA_PATH}/bin/ make -f ${!makefile} EDK2_BUILD=$UEFI_BUILD_MODE
+ else
+ outdir=UEFI_PLAT_$item[platname]
+ IASL_PREFIX=${TOP_DIR}/${UEFI_ACPICA_PATH}/bin/ ${TOP_DIR}/${UEFI_TOOLS_PATH}/uefi-build.sh -D EDK2_OUT_DIR=Build/${!outdir} -b $UEFI_BUILD_MODE $item
+ fi
done
popd
fi
@@ -60,15 +84,14 @@ do_clean ()
{
if [ "$UEFI_BUILD_ENABLED" == "1" ]; then
pushd $TOP_DIR/$UEFI_PATH
+ CROSS_COMPILE_DIR=$(dirname $CROSS_COMPILE)
+ PATH="$PATH:$CROSS_COMPILE_DIR"
source ./edksetup.sh
make -C BaseTools clean
- export EDK2_TOOLCHAIN=$UEFI_TOOLCHAIN
- export ${UEFI_TOOLCHAIN}_AARCH64_PREFIX=$CROSS_COMPILE
- export EDK2_MACROS="-n $PARALLELISM"
for item in $UEFI_PLATFORMS; do
- rm -rf Build/$UEFI_OUTPUT_PLATFORMS
+ name=UEFI_PLAT_$item[platname]
+ rm -rf Build/${!name}
done
- rm -rf Build
popd
pushd $TOP_DIR/$UEFI_ACPICA_PATH
make veryclean
@@ -82,10 +105,16 @@ do_package ()
echo "Packaging uefi... $VARIANT";
# Copy binaries to output folder
pushd $TOP_DIR
- for item in $UEFI_OUTPUT_PLATFORMS; do
- mkdir -p ${OUTDIR}/${UEFI_OUTPUT_DESTS[$item]}
- cp ./$UEFI_PATH/Build/$item/${UEFI_BUILD_MODE}_${UEFI_TOOLCHAIN}/FV/${UEFI_BINARY} \
- ${OUTDIR}/${UEFI_OUTPUT_DESTS[$item]}/uefi.bin
+ local name=
+ local outp=
+ local bins=
+ for item in $UEFI_PLATFORMS; do
+ bins=UEFI_PLAT_$item[binary]
+ outp=UEFI_PLAT_$item[output]
+ name=UEFI_PLAT_$item[platname]
+ mkdir -p ${OUTDIR}/${!outp}
+ cp ./$UEFI_PATH/Build/${!name}/${UEFI_BUILD_MODE}_${UEFI_TOOLCHAIN}/FV/${!bins} \
+ ${OUTDIR}/${!outp}/uefi.bin
done
popd
diff --git a/framework.sh b/framework.sh
index b5077ad..0486ed8 100755
--- a/framework.sh
+++ b/framework.sh
@@ -48,7 +48,7 @@ trap handle_error ERR
if [ "$PARALLELISM" != "" ]; then
echo "Parallelism set in environment to $PARALLELISM, not overridding"
else
- PARALLELISM=`grep -c processor /proc/cpuinfo`
+ PARALLELISM=`getconf _NPROCESSORS_ONLN`
fi
VARIANT=$1
@@ -59,12 +59,13 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
pushd $DIR/..
TOP_DIR=`pwd`
popd
-OUTDIR=${TOP_DIR}/output
+PLATDIR=${TOP_DIR}/output
+OUTDIR=${PLATDIR}/components
LINUX_OUT_DIR=out/$VARIANT
usage_exit ()
{
- echo "Usage: $0 {variant} {build|clean|package}"
+ echo "Usage: $0 {variant} {build|clean|package|all}"
exit 1
}
@@ -72,12 +73,28 @@ if [ $# -lt 1 ]; then
usage_exit
fi
-# Load the variables from the variant if it exists...
-if [ -f $TOP_DIR/build-scripts/variants/$VARIANT ]; then
- source $TOP_DIR/build-scripts/variants/$VARIANT $VARIANT
-else
- echo "Variant $VARIANT doesn't exist in build-scripts/variants"
+# Load the variables from the variant if it exists. We support single nested
+# variant folders which will override the top level variant files. But if
+# multiple subfolders contain the same variant file we'll just use the first
+# found
+VARIANT_FILE=""
+for VDIR in $TOP_DIR/build-scripts/*/variants ; do
+ # Look for variant in that folder
+ if [ -f $VDIR/$VARIANT ]; then
+ VARIANT_FILE="$VDIR/$VARIANT"
+ break
+ fi
+done
+if [ "$VARIANT_FILE" == "" ]; then
+ if [ -f $TOP_DIR/build-scripts/variants/$VARIANT ]; then
+ VARIANT_FILE="$TOP_DIR/build-scripts/variants/$VARIANT"
+ fi
+fi
+if [ "$VARIANT_FILE" == "" ]; then
+ echo "Variant $VARIANT doesn't exist"
exit 1
+else
+ source $VARIANT_FILE $VARIANT
fi
case "$CMD" in
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..ae4e0ff
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,78 @@
+Build-scripts - readme.
+
+1/ The Theory.
+~~~~~~~~~~~~~~
+
+Building software should be repeatable and straightforward.
+Engineers building the same code in different ways will yield different results, making the development process less deterministic.
+
+These simple build scripts aim to remove the randomness from development and provide a simple framework that can be used by the developer on the desktop and by and automated build and test system.
+
+ARM should be moving to single binaries built from common source wherever possible, these build scripts take the concept further enabling a single build to create binaries for a number (if not all) of similar platforms in one go. The scripts will also provide a mechanism for building a single platform where they need to be delivered in isolation.
+
+Any change which breaks the ability to build multiple platforms is bad, so will be rejected at code review!
+
+The build is controlled by a variant file (see build-scripts/variants), the variant specifies which components need to be build and provide configuration parameters for each component. Variants either describe a single platform (e.g. Juno) or all platforms for a segment (e.g. juno-busybox, which includes Juno). There arethen derived variants for the particular rootfs you want (OE, Android, Busybox).
+
+The scripts also provide for a build-all that will build all components, but also provide for building invidual components in isolation.
+
+The build scripts provide the following functions:
+- clean - clean out the build objects
+- build - perform a build
+- package - package up the built binaries
+- all - do a clean, build and package in one go!
+
+2/ Structure
+~~~~~~~~~~~~
+
+There are 2 special files - framework.sh and build-all.sh
+
+framework.sh - this file contains helper environment variable and is responsible for makeing the calls in the individual build scripts, it also provides error handling so that each build script doens't need to.
+
+build-all.sh - this scripts is resonsible for checking the arguments pased to the build, loading framework.sh and then executing the individual build scripts.
+
+There are then a series of individual build scripts for each component, each script contains 3 functions :
+- do_build() - the build stage
+- do_clean() - the clean stage
+- do_package() - the package stage.
+Each function must be protected with a "component_BUILD_ENABLED" variable to enable the variant to control if the build for a component is to be executed by that variant.
+
+Each script must include a description of the variables it uses, but also must
+ include the following lines at the botton to enable it to work with the build framework:
+ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+ source $DIR/framework.sh $1 $2
+
+build-target-bins.sh is a special script that must be run last, it is responsible for collecting together the build output and putting it in platform specific directories ready for testing or release.
+
+3/ running the build
+~~~~~~~~~~~~~~~~~~~~
+
+You can either build everything or an individual component, you can call the build script from anywhere withing workspace (i.e. from the root or further in).
+
+<path to build-scripts>/build-all.sh <variant> {cmd}
+<path to build-scripts>/build-linux.sh <variant> {cmd}
+
+where:
+<variant> is any of the filename in build-scripts/variants
+<cmd> is one of build, clean, package, all - if you clean cmd blank the script will call 'build'.
+
+Examples:
+
+./build-scripts/build-all.sh juno-busybox
+./build-scripts/build-all.sh juno-busybox clean
+./build-scripts/build-all.sh juno-busybox package
+./build-scripts/build-all.sh juno-busybox all
+
+4/ Variants
+~~~~~~~~~~~
+
+Variant files provide configuration parameters for all the platforms and components supported by that variant.
+
+They consist of a series of variables that configure the individual build scripts. Variables required for a particular component are defined at the top of each build script.
+
+Variants also declare the compilers and tools required for each build step so that the build scripts can be used by multiple types of build (32 and 64bit for example).
+
+5/ Results of the build
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Built binaries will be stored in ./output in subfolders per platform (and not per variant).
diff --git a/variants/fvp-android b/variants/fvp-android
index b42c6bf..6c5387b 100644
--- a/variants/fvp-android
+++ b/variants/fvp-android
@@ -28,9 +28,29 @@
source $DIR/variants/fvp-busybox
-VARIANT_DESC="FVP kernel for Android Software Stack"
-LINUX_CONFIGS="linaro-base android vexpress64 $BL_SUPPORT"
-BUSYBOX_BUILD_ENABLED=
-RAMDISK_BUILD_ENABLED=
-TARGET_BINS_HAS_BUSYBOX=
+VARIANT_DESC="FVP Android Software Stack"
+
+ANDROID_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-android.sh "
+ANDROID_SOURCE_PATH=android
+ANDROID_LUNCH_TARGET=fvp-userdebug
+ANDROID_SOURCE_VARIANT="fvp"
+ANDROID_IMAGE_SIZE=$((1024*1024*1024))
+LINUX_CONFIGS="linaro-base $BL_SUPPORT android vexpress64"
+
+ANDROID_BINARIES_PATH=prebuilts/android
+ANDROID_BINS_VARIANTS="fvp"
+
TARGET_BINS_HAS_ANDROID=1
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+FVP_UBOOT_FOLDER=$PLATDIR/fvp-android/uboot
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/Image ${FVP_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/foundation-v8-gicv3-chosen-android.dtb ${FVP_UBOOT_FOLDER}/foundation-v8-gicv3.dtb"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/linux/fvp-base-aemv8a-aemv8a-chosen-android.dtb ${FVP_UBOOT_FOLDER}/fvp-base-aemv8a-aemv8a.dtb"
+TARGET_BINS_COPY_LIST[3]="${OUTDIR}/fvp/tf-bl1.bin ${FVP_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[4]="${PLATDIR}/fvp-uInitrd-android.0x84000000 ${FVP_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[5]="${PLATDIR}/fvp/fip-uboot.bin ${FVP_UBOOT_FOLDER}/fip.bin"
diff --git a/variants/fvp-busybox b/variants/fvp-busybox
index 5982446..d70d3d7 100644
--- a/variants/fvp-busybox
+++ b/variants/fvp-busybox
@@ -31,14 +31,15 @@ VARIANT_DESC="FVP kernel for BusyBox Software Stack"
# Absolute path to the aarch64 GCC compoiler binaries (plus prefix)
# If you wish to specify a path relative to the workspace root, prefix it with "$TOP_DIR/"
# If your compiler is on your path, you can simply add the prefix, as per the default example.
-export CROSS_COMPILE=${CROSS_COMPILE:-aarch64-linux-gnu-}
+export CROSS_COMPILE=${TOP_DIR}/tools/gcc/gcc-linaro-4.9-2015.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
+export CROSS_COMPILE_32=${TOP_DIR}/tools/gcc/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
BUILD_SCRIPTS=""
LINUX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-linux.sh "
LINUX_PATH=linux
source $DIR/big-LITTLE-conf.sh
-LINUX_CONFIGS="linaro-base vexpress64 $BL_SUPPORT"
+LINUX_CONFIGS="linaro-base $BL_SUPPORT vexpress64"
LINUX_DEFCONFIG=defconfig
LINUX_ARCH=arm64
DEVTREE_TREES=(fvp-base-aemv8a-aemv8a foundation-v8-gicv3)
@@ -47,20 +48,51 @@ UBOOT_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uboot.sh "
UBOOT_PATH=u-boot
UBOOT_ARCH=aarch64
+UBOOT_MKIMG=${TOP_DIR}/${UBOOT_PATH}/output/tools/mkimage
+UBOOT_UIMAGE_ADDRS="0x80080000"
UBOOT_BOARDS="vexpress_aemv8a_dram"
+declare -A UBOOT_OUTPUT_DESTS
UBOOT_OUTPUT_DESTS[vexpress_aemv8a_dram]=fvp
-UEFI_BUILD_ENABLED=0
+UEFI_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uefi.sh "
UEFI_PATH=uefi/edk2
+UEFI_BUILD_MODE=DEBUG
+UEFI_TOOLCHAIN=GCC49
UEFI_TOOLS_PATH=tools/uefi-tools
UEFI_ACPICA_PATH=tools/acpica/generate/unix
UEFI_PLATFORMS="fvp"
-UEFI_BINARY="FVP_AARCH64_EFI.fd"
-UEFI_BUILD_MODE=DEBUG
-UEFI_TOOLCHAIN=GCC49
-UEFI_OUTPUT_PLATFORMS="ArmVExpress-FVP-AArch64"
-UEFI_OUTPUT_DESTS[fvp]=fvp
+declare -A UEFI_PLAT_fvp
+UEFI_PLAT_fvp[platname]="ArmVExpress-FVP-AArch64"
+UEFI_PLAT_fvp[output]=fvp
+UEFI_PLAT_fvp[defines]=
+UEFI_PLAT_fvp[binary]="FVP_AARCH64_EFI.fd"
+
+# TBBR related definitions, used when TBBR is enabled in TARGET_$plat array at the bottom
+# of this file
+ARM_TF_ROT_KEY=$TOP_DIR/$ARM_TF_PATH/plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
+ARM_TF_MBEDTLS_DIR=$TOP_DIR/mbedtls
+ARM_TF_TBBR_BUILD_FLAGS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 CREATE_KEYS=1 ARM_ROTPK_LOCATION=devel_rsa ROT_KEY=${ARM_TF_ROT_KEY} MBEDTLS_DIR=${ARM_TF_MBEDTLS_DIR}"
+#declare -A TBBR_fvp
+#TBBR_fvp[tbbr]=1
+
+# OPTEE build setup
+# OPTEE OS
+OPTEE_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-optee-os.sh "
+# set trusted firmware to use dram for TEE
+OPTEE_RAM_LOCATION=dram
+OPTEE_ARCH="aarch32"
+OPTEE_PLATS="fvp"
+OPTEE_OS_CROSS_COMPILE=${CROSS_COMPILE_32}
+OPTEE_CLIENT_CROSS_COMPILE=${CROSS_COMPILE}
+OPTEE_OS_PATH=optee/optee_os
+OPTEE_CORE_LOG_LEVEL=4
+OPTEE_OS_BIN_NAME="tee.bin"
+declare -A OPTEE_fvp
+OPTEE_fvp[optee]=1
+OPTEE_fvp[plat]="vexpress"
+OPTEE_fvp[flavor]="fvp"
ARM_TF_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-arm-tf.sh "
@@ -68,31 +100,40 @@ ARM_TF_PATH=arm-tf
ARM_TF_PLATS="fvp"
ARM_TF_DEBUG_ENABLED=${ARM_TF_DEBUG_ENABLED:-1}
-# trusted board boot
-ARM_TBBR_ENABLED=1
-ROT_KEY=$TOP_DIR/$ARM_TF_PATH/plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
-MBEDTLS_DIR=$TOP_DIR/mbedtls
-ARM_TF_TBBR_BUILD_FLAGS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 CREATE_KEYS=1 ARM_ROTPK_LOCATION=devel_rsa ROT_KEY=${ROT_KEY} MBEDTLS_DIR=${MBEDTLS_DIR}"
-
BUSYBOX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-busybox.sh "
BUSYBOX_PATH=busybox
BUSYBOX_ARCH=arm
+BUSYBOX_RAMDISK_PATH=ramdisk
+BUSYBOX_RAMDISK_LINUX_GEN_CPIO=$LINUX_PATH/$LINUX_OUT_DIR/usr/gen_init_cpio
+BUSYBOX_RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
-RAMDISK_BUILD_ENABLED=1
-BUILD_SCRIPTS=$BUILD_SCRIPTS"build-ramdisk.sh "
-RAMDISK_PATH=ramdisk
-RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
# this must be the last step for low level code.
TARGET_BINS_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-target-bins.sh "
-TARGET_BINS_UINITRD_ADDRS="0x84000000"
-TARGET_BINS_PLATS="fvp"
-TARGET_BINS_HAS_BUSYBOX=1
+FINAL_BUILD_STEP="build-target-bins.sh"
TARGET_BINS_HAS_DTB_RAMDISK=1
-TARGET_BINS_RAMDISK_ADDR=0x84000000
+DEVTREE_DTC_PATH=$LINUX_PATH/$LINUX_OUT_DIR
+
+TARGET_BINS_PLATS="fvp"
+declare -A TARGET_fvp
+TARGET_fvp[arm-tf]="fvp"
+TARGET_fvp[scp]=""
+TARGET_fvp[uboot]="fvp"
+TARGET_fvp[uefi]="fvp"
+TARGET_fvp[fdts]="fvp-base-aemv8a-aemv8a foundation-v8-gicv3"
+TARGET_fvp[linux]="Image uImage.0x80080000"
+TARGET_fvp[ramdisk]=0x84000000
+#TARGET_fvp[ttbr]=1
+#TARGET_fvp[optee]=1
-TARGET_ARM_TF_fvp="fvp"
-TARGET_UBOOT_fvp="fvp"
-TARGET_UEFI_fvp="fvp"
-TARGET_SCP_fvp="recovery/SOFTWARE"
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+declare -a TARGET_BINS_COPY_LIST
+FVP_UBOOT_FOLDER=$PLATDIR/fvp-busybox/uboot
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/Image ${FVP_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/fvp-base-aemv8a-aemv8a-chosen.dtb ${FVP_UBOOT_FOLDER}/fvp-base-aemv8a-aemv8a.dtb"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/linux/foundation-v8-gicv3-chosen.dtb ${FVP_UBOOT_FOLDER}/foundation-v8-gicv3.dtb"
+TARGET_BINS_COPY_LIST[3]="${OUTDIR}/fvp/tf-bl1.bin ${FVP_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[4]="${PLATDIR}/uInitrd-busybox.0x84000000 ${FVP_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[5]="${PLATDIR}/fvp/fip-uboot.bin ${FVP_UBOOT_FOLDER}/fip.bin"
diff --git a/variants/fvp-oe b/variants/fvp-oe
index fc75504..dc28a1a 100644
--- a/variants/fvp-oe
+++ b/variants/fvp-oe
@@ -29,8 +29,23 @@
source $DIR/variants/fvp-busybox
VARIANT_DESC="FVP LSK kernel for OpenEmbedded Software Stack"
-LINUX_CONFIGS="linaro-base distribution vexpress64 $BL_SUPPORT"
-TARGET_BINS_HAS_BUSYBOX=
-BUSYBOX_BUILD_ENABLED=
-RAMDISK_BUILD_ENABLED=
+LINUX_CONFIGS="linaro-base $BL_SUPPORT distribution vexpress64"
+
+OE_BINARIES_BUILD_ENABLED=0
+OE_RAMDISK_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-oe-binaries.sh "
+OE_BINARIES_PATH=prebuilts/oe
+
TARGET_BINS_HAS_OE=1
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+FVP_UBOOT_FOLDER=$PLATDIR/fvp-oe/uboot
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/Image ${FVP_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/fvp-base-aemv8a-aemv8a-chosen.dtb ${FVP_UBOOT_FOLDER}/fvp-base-aemv8a-aemv8a.dtb"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/linux/foundation-v8-gicv3-chosen.dtb ${FVP_UBOOT_FOLDER}/foundation-v8-gicv3.dtb"
+TARGET_BINS_COPY_LIST[3]="${OUTDIR}/fvp/tf-bl1.bin ${FVP_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[4]="${PLATDIR}/uInitrd-oe.0x84000000 ${FVP_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[5]="${PLATDIR}/fvp/fip-uboot.bin ${FVP_UBOOT_FOLDER}/fip.bin"
diff --git a/variants/fvp-uefi b/variants/fvp-uefi
index 40fa202..e9749c7 100644
--- a/variants/fvp-uefi
+++ b/variants/fvp-uefi
@@ -35,4 +35,23 @@ LINUX_BUILD_ENABLED=
RAMDISK_BUILD_ENABLED=
UBOOT_BUILD_ENABLED=
OPTEE_BUILD_ENABLED=
+BOOTMON_BUILD_ENABLED=
UEFI_BUILD_ENABLED=1
+
+TARGET_fvp[fdts]=""
+TARGET_fvp[uboot]=""
+
+UEFI_PLATFORMS="fvp"
+declare -A UEFI_PLAT_fvp
+UEFI_PLAT_fvp[platname]="ArmVExpress-FVP-AArch64"
+UEFI_PLAT_fvp[output]=fvp
+UEFI_PLAT_fvp[defines]=
+UEFI_PLAT_fvp[binary]="FVP_AARCH64_EFI.fd"
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+FVP_UEFI_FOLDER=$PLATDIR/fvp-uefi/uefi
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/fvp/tf-bl1.bin ${FVP_UEFI_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[1]="${PLATDIR}/fvp/fip-uefi.bin ${FVP_UEFI_FOLDER}/fip.bin"
diff --git a/variants/juno-android b/variants/juno-android
index 9750fdb..76bfe5c 100644
--- a/variants/juno-android
+++ b/variants/juno-android
@@ -28,9 +28,25 @@
source $DIR/variants/juno-busybox
-VARIANT_DESC="Juno kernel for Android Software Stack"
+VARIANT_DESC="Juno Android Software Stack"
-LINUX_CONFIGS="linaro-base android vexpress64 $BL_SUPPORT"
+ANDROID_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-android.sh "
+ANDROID_SOURCE_PATH=source-build-disabled
+ANDROID_BINARIES_PATH=prebuilts/android
+ANDROID_BINS_VARIANTS="juno"
+LINUX_CONFIGS="linaro-base $BL_SUPPORT android vexpress64"
-TARGET_BINS_HAS_BUSYBOX=
TARGET_BINS_HAS_ANDROID=1
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+declare -a TARGET_BINS_COPY_LIST
+JUNO_UBOOT_FOLDER=$PLATDIR/juno-android/uboot
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/Image ${JUNO_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/juno.dtb ${JUNO_UBOOT_FOLDER}/juno.dtb"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/linux/juno-r1.dtb ${JUNO_UBOOT_FOLDER}/juno-r1.dtb"
+TARGET_BINS_COPY_LIST[3]="${OUTDIR}/linux/juno-r2.dtb ${JUNO_UBOOT_FOLDER}/juno-r2.dtb"
+TARGET_BINS_COPY_LIST[4]="${OUTDIR}/juno/tf-bl1.bin ${JUNO_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[5]="${PLATDIR}/juno-uInitrd-android.0x84000000 ${JUNO_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[6]="${PLATDIR}/juno/fip-uboot.bin ${JUNO_UBOOT_FOLDER}/fip.bin"
diff --git a/variants/juno-busybox b/variants/juno-busybox
index 9e69712..9696919 100644
--- a/variants/juno-busybox
+++ b/variants/juno-busybox
@@ -31,36 +31,56 @@ VARIANT_DESC="Juno kernel for BusyBox Software Stack"
# Absolute path to the aarch64 GCC compoiler binaries (plus prefix)
# If you wish to specify a path relative to the workspace root, prefix it with "$TOP_DIR/"
# If your compiler is on your path, you can simply add the prefix, as per the default example.
-export CROSS_COMPILE=${CROSS_COMPILE:-aarch64-linux-gnu-}
+export CROSS_COMPILE=${TOP_DIR}/tools/gcc/gcc-linaro-4.9-2015.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
+export CROSS_COMPILE_32=${TOP_DIR}/tools/gcc/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
BUILD_SCRIPTS=""
LINUX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-linux.sh "
LINUX_PATH=linux
source $DIR/big-LITTLE-conf.sh
-LINUX_CONFIGS="linaro-base vexpress64 $BL_SUPPORT"
+LINUX_CONFIGS="linaro-base $BL_SUPPORT vexpress64"
LINUX_DEFCONFIG=defconfig
LINUX_ARCH=arm64
-DEVTREE_TREES=(juno juno-r1 juno-r2)
UBOOT_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uboot.sh "
UBOOT_PATH=u-boot
UBOOT_ARCH=aarch64
+UBOOT_MKIMG=${TOP_DIR}/${UBOOT_PATH}/output/tools/mkimage
+UBOOT_UIMAGE_ADDRS="0x80080000"
UBOOT_BOARDS="vexpress_aemv8a_juno"
+declare -A UBOOT_OUTPUT_DESTS
UBOOT_OUTPUT_DESTS[vexpress_aemv8a_juno]=juno
-UEFI_BUILD_ENABLED=0
+UEFI_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uefi.sh "
UEFI_PATH=uefi/edk2
+UEFI_BUILD_MODE=DEBUG
+UEFI_TOOLCHAIN=GCC49
UEFI_TOOLS_PATH=tools/uefi-tools
UEFI_ACPICA_PATH=tools/acpica/generate/unix
UEFI_PLATFORMS="juno"
-UEFI_BINARY="BL33_AP_UEFI.fd"
-UEFI_BUILD_MODE=DEBUG
-UEFI_TOOLCHAIN=GCC49
-UEFI_OUTPUT_PLATFORMS="ArmJuno"
-UEFI_OUTPUT_DESTS[juno]=juno
+declare -A UEFI_PLAT_juno
+UEFI_PLAT_juno[platname]="ArmJuno"
+UEFI_PLAT_juno[output]=juno
+UEFI_PLAT_juno[defines]=
+UEFI_PLAT_juno[binary]="BL33_AP_UEFI.fd"
+
+SCP_BUILD_ENABLED=0
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-scp.sh "
+SCP_PATH=scp
+#SCP_ARM_COMPILER_PATH=/usr/local/DS-5_v5.21.0/sw/ARMCompiler5.05u1/bin
+#SCP_ARM_COMPILER_PATH=/arm/tools/arm/ds-5/5.21.0/sw/ARMCompiler5.05u1/bin/
+SCP_GCC_COMPILER_PREFIX=${TOP_DIR}/tools/gcc/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-
+SCP_PLATFORMS="juno_SILICON"
+SCP_PREBUILT_ROMFW_BYPASS_juno_SILICON=${TOP_DIR}/recovery/SOFTWARE/bl0.bin
+SCP_PREBUILT_RAMFW_juno_SILICON=${TOP_DIR}/recovery/SOFTWARE/bl30.bin
+#Build SCP in release mode, or Juno may have boot issues in the kernel
+#(timeouts are not handled gracefully at the moment)
+SCP_BUILD_MODE=release
+declare -A SCP_BYPASS_ROM_SUPPORT
+SCP_BYPASS_ROM_SUPPORT[juno]=true
ARM_TF_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-arm-tf.sh "
@@ -68,51 +88,66 @@ ARM_TF_PATH=arm-tf
ARM_TF_PLATS="juno"
ARM_TF_DEBUG_ENABLED=${ARM_TF_DEBUG_ENABLED:-1}
-ARM_TBBR_ENABLED=1
-ROT_KEY=$TOP_DIR/$ARM_TF_PATH/plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
-MBEDTLS_DIR=$TOP_DIR/mbedtls
-ARM_TF_TBBR_BUILD_FLAGS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 CREATE_KEYS=1 ARM_ROTPK_LOCATION=devel_rsa ROT_KEY=${ROT_KEY} MBEDTLS_DIR=${MBEDTLS_DIR}"
+# TBBR related definitions, used when TBBR is enabled in TARGET_$plat array at the bottom
+# of this file
+ARM_TF_ROT_KEY=$TOP_DIR/$ARM_TF_PATH/plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
+ARM_TF_MBEDTLS_DIR=$TOP_DIR/mbedtls
+ARM_TF_TBBR_BUILD_FLAGS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 CREATE_KEYS=1 ARM_ROTPK_LOCATION=devel_rsa ROT_KEY=${ARM_TF_ROT_KEY} MBEDTLS_DIR=${ARM_TF_MBEDTLS_DIR}"
+declare -A TBBR_juno
+TBBR_juno[tbbr]=1
+
+# OPTEE build setup
+# OPTEE OS
+OPTEE_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-optee-os.sh "
+# set trusted firmware to use dram for TEE
+OPTEE_RAM_LOCATION=dram
+OPTEE_ARCH="aarch32"
+OPTEE_PLATS="juno"
+OPTEE_OS_CROSS_COMPILE=${CROSS_COMPILE_32}
+OPTEE_CLIENT_CROSS_COMPILE=${CROSS_COMPILE}
+OPTEE_OS_PATH=optee/optee_os
+OPTEE_CORE_LOG_LEVEL=4
+OPTEE_OS_BIN_NAME="tee.bin"
+declare -A OPTEE_juno
+OPTEE_juno[optee]=1
+OPTEE_juno[plat]="vexpress"
+OPTEE_juno[flavor]="juno"
BUSYBOX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-busybox.sh "
BUSYBOX_PATH=busybox
BUSYBOX_ARCH=arm
-
-RAMDISK_BUILD_ENABLED=1
-BUILD_SCRIPTS=$BUILD_SCRIPTS"build-ramdisk.sh "
-RAMDISK_PATH=ramdisk
-RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
-
-OPTEE_BUILD_ENABLED=1
-if [ "$OPTEE_BUILD_ENABLED" == "1" ]; then
- BUILD_SCRIPTS=$BUILD_SCRIPTS"build-optee-os.sh build-optee-linuxdriver.sh build-optee-client.sh "
- # set trusted firmware to use dram for TEE
- OPTEE_RAM_LOCATION=dram
- ARM_TF_BUILD_FLAGS="$ARM_TF_BUILD_FLAGS ARM_TSP_RAM_LOCATION=$OPTEE_RAM_LOCATION SPD=opteed"
- OPTEE_ARCH="aarch32"
- OPTEE_OS_CROSS_COMPILE=arm-linux-gnueabihf-
- OPTEE_OS_PATH=optee/optee_os
- OPTEE_PLATFORM=vexpress
- OPTEE_PLATFORM_FLAVOUR=juno
- OPTEE_CORE_LOG_LEVEL=4
- OPTEE_OS_BIN_NAME="tee.bin"
-
- # OPTEE linux driver
- OPTEE_LINUXDRIVER_PATH=optee/optee_linuxdriver
-
- #client API
- OPTEE_CLIENT_CROSS_COMPILE=$CROSS_COMPILE
- OPTEE_CLIENT_PATH=optee/optee_client
-fi
+BUSYBOX_RAMDISK_PATH=ramdisk
+BUSYBOX_RAMDISK_LINUX_GEN_CPIO=$LINUX_PATH/$LINUX_OUT_DIR/usr/gen_init_cpio
+BUSYBOX_RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
# this must be the last step for low level code.
TARGET_BINS_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-target-bins.sh "
-TARGET_BINS_UINITRD_ADDRS="0x84000000"
+FINAL_BUILD_STEP="build-target-bins.sh"
+
TARGET_BINS_PLATS="juno"
-TARGET_BINS_HAS_BUSYBOX=1
+declare -A TARGET_juno
+TARGET_juno[arm-tf]="juno"
+TARGET_juno[scp]="juno_SILICON"
+TARGET_juno[uboot]="juno"
+TARGET_juno[uefi]="juno"
+TARGET_juno[fdts]="juno juno-r1 juno-r2"
+TARGET_juno[linux]="Image uImage.0x80080000"
+TARGET_juno[ramdisk]=0x84000000
+TARGET_juno[tbbr]=1
+TARGET_juno[optee]=1
-TARGET_ARM_TF_juno="juno"
-TARGET_SCP_juno="recovery/SOFTWARE"
-TARGET_UBOOT_juno="juno"
-TARGET_UEFI_juno="juno"
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+JUNO_UBOOT_FOLDER=$PLATDIR/juno-busybox/uboot
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/Image ${JUNO_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/juno.dtb ${JUNO_UBOOT_FOLDER}/juno.dtb"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/linux/juno-r1.dtb ${JUNO_UBOOT_FOLDER}/juno-r1.dtb"
+TARGET_BINS_COPY_LIST[3]="${OUTDIR}/linux/juno-r2.dtb ${JUNO_UBOOT_FOLDER}/juno-r2.dtb"
+TARGET_BINS_COPY_LIST[4]="${OUTDIR}/juno/tf-bl1.bin ${JUNO_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[5]="${PLATDIR}/uInitrd-busybox.0x84000000 ${JUNO_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[6]="${PLATDIR}/juno/fip-uboot.bin ${JUNO_UBOOT_FOLDER}/fip.bin"
diff --git a/variants/juno-oe b/variants/juno-oe
index 0e40baa..b622f20 100644
--- a/variants/juno-oe
+++ b/variants/juno-oe
@@ -29,6 +29,52 @@
source $DIR/variants/juno-busybox
VARIANT_DESC="Juno LSK kernel for OpenEmbedded Software Stack"
-LINUX_CONFIGS="linaro-base distribution vexpress64 $BL_SUPPORT"
-TARGET_BINS_HAS_BUSYBOX=
+LINUX_CONFIGS="linaro-base $BL_SUPPORT distribution vexpress64"
+
+OE_BINARIES_BUILD_ENABLED=0
+OE_RAMDISK_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-oe-binaries.sh "
+OE_BINARIES_PATH=prebuilts/oe
+
TARGET_BINS_HAS_OE=1
+
+#Copy binaries into the format we need to copy them onto the eMMC
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+#First copy Linaro binaries in
+UEFI_EMMC_FOLDER=$PLATDIR/juno/eMMC-uefi
+TARGET_BINS_COPY_LIST[0]="${TOP_DIR}/recovery $UEFI_EMMC_FOLDER"
+#Then paste our output over the top
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/juno_SILICON/scp-rom-bypass.bin ${UEFI_EMMC_FOLDER}/SOFTWARE/bl0.bin"
+TARGET_BINS_COPY_LIST[2]="${OUTDIR}/juno/tf-bl1.bin ${UEFI_EMMC_FOLDER}/SOFTWARE/bl1.bin"
+TARGET_BINS_COPY_LIST[3]="${PLATDIR}/juno/fip-uefi.bin ${UEFI_EMMC_FOLDER}/SOFTWARE/fip.bin"
+TARGET_BINS_COPY_LIST[4]="${PLATDIR}/juno/fip-uboot.bin ${UEFI_EMMC_FOLDER}/SOFTWARE/fip-uboot.bin"
+TARGET_BINS_COPY_LIST[5]="${OUTDIR}/linux/*.dtb ${UEFI_EMMC_FOLDER}/SOFTWARE/"
+TARGET_BINS_COPY_LIST[6]="${OUTDIR}/linux/Image ${UEFI_EMMC_FOLDER}/SOFTWARE/Image"
+TARGET_BINS_COPY_LIST[7]="${PLATDIR}/ramdisk-oe.img ${UEFI_EMMC_FOLDER}/SOFTWARE/ramdisk.img"
+
+#Copy linaro binaries again for a uboot option
+UBOOT_EMMC_FOLDER=$PLATDIR/juno/eMMC-uboot
+TARGET_BINS_COPY_LIST[8]="${TOP_DIR}/recovery $UBOOT_EMMC_FOLDER"
+#Then paste our output over the top
+TARGET_BINS_COPY_LIST[9]="${OUTDIR}/juno_SILICON/scp-rom-bypass.bin ${UBOOT_EMMC_FOLDER}/SOFTWARE/bl0.bin"
+TARGET_BINS_COPY_LIST[10]="${OUTDIR}/juno/tf-bl1.bin ${UBOOT_EMMC_FOLDER}/SOFTWARE/bl1.bin"
+TARGET_BINS_COPY_LIST[11]="${PLATDIR}/juno/fip-uboot.bin ${UBOOT_EMMC_FOLDER}/SOFTWARE/fip.bin"
+TARGET_BINS_COPY_LIST[12]="${PLATDIR}/juno/fip-uefi.bin ${UBOOT_EMMC_FOLDER}/SOFTWARE/fip-uefi.bin"
+TARGET_BINS_COPY_LIST[13]="${OUTDIR}/linux/*.dtb ${UBOOT_EMMC_FOLDER}/SOFTWARE/"
+TARGET_BINS_COPY_LIST[14]="${OUTDIR}/linux/Image ${UBOOT_EMMC_FOLDER}/SOFTWARE/Image"
+TARGET_BINS_COPY_LIST[15]="${PLATDIR}/uInitrd-oe.0x84000000 ${UBOOT_EMMC_FOLDER}/SOFTWARE/ramdisk.img"
+
+#Copy the binaries into the ARM Platforms Release folder
+JUNO_UBOOT_FOLDER=$PLATDIR/juno-oe/uboot
+TARGET_BINS_COPY_LIST[16]="${OUTDIR}/linux/Image ${JUNO_UBOOT_FOLDER}/Image"
+TARGET_BINS_COPY_LIST[17]="${OUTDIR}/linux/juno.dtb ${JUNO_UBOOT_FOLDER}/juno.dtb"
+TARGET_BINS_COPY_LIST[18]="${OUTDIR}/linux/juno-r1.dtb ${JUNO_UBOOT_FOLDER}/juno-r1.dtb"
+TARGET_BINS_COPY_LIST[19]="${OUTDIR}/linux/juno-r2.dtb ${JUNO_UBOOT_FOLDER}/juno-r2.dtb"
+TARGET_BINS_COPY_LIST[20]="${OUTDIR}/juno/tf-bl1.bin ${JUNO_UBOOT_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[21]="${PLATDIR}/uInitrd-oe.0x84000000 ${JUNO_UBOOT_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[22]="${PLATDIR}/juno/fip-uboot.bin ${JUNO_UBOOT_FOLDER}/fip.bin"
+
+#Extra tarring
+TARGET_BINS_EXTRA_TAR_LIST="$UBOOT_EMMC_FOLDER $UEFI_EMMC_FOLDER"
diff --git a/variants/juno-uefi b/variants/juno-uefi
index 0b257a8..320b482 100644
--- a/variants/juno-uefi
+++ b/variants/juno-uefi
@@ -35,4 +35,23 @@ LINUX_BUILD_ENABLED=
RAMDISK_BUILD_ENABLED=
UBOOT_BUILD_ENABLED=
OPTEE_BUILD_ENABLED=
+BOOTMON_BUILD_ENABLED=
UEFI_BUILD_ENABLED=1
+
+TARGET_juno[fdts]=""
+TARGET_juno[uboot]=""
+
+UEFI_PLATFORMS="juno"
+declare -A UEFI_PLAT_juno
+UEFI_PLAT_juno[platname]="ArmJuno"
+UEFI_PLAT_juno[output]=juno
+UEFI_PLAT_juno[defines]=
+UEFI_PLAT_juno[binary]="BL33_AP_UEFI.fd"
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+JUNO_UEFI_FOLDER=$PLATDIR/juno-uefi/uefi
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/juno/tf-bl1.bin ${JUNO_UEFI_FOLDER}/bl1.bin"
+TARGET_BINS_COPY_LIST[1]="${PLATDIR}/juno/fip-uefi.bin ${JUNO_UEFI_FOLDER}/fip.bin"
diff --git a/variants/tc2-android b/variants/tc2-android
index 1ea3a0d..64498ff 100644
--- a/variants/tc2-android
+++ b/variants/tc2-android
@@ -30,7 +30,17 @@ source $DIR/variants/tc2-busybox
VARIANT_DESC="TC2 kernel for Android Software Stack"
-LINUX_CONFIGS="linaro-base android vexpress $BL_SUPPORT"
+LINUX_CONFIGS="linaro-base $BL_SUPPORT android vexpress"
TARGET_BINS_HAS_BUSYBOX=
TARGET_BINS_HAS_ANDROID=1
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+TC2_FOLDER=$PLATDIR/tc2-android/bootmon
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/zImage ${TC2_FOLDER}/zImage"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/vexpress-v2p-ca15_a7.dtb ${TC2_FOLDER}/tc2.dtb"
+TARGET_BINS_COPY_LIST[2]="${TOP_DIR}/prebuilts/android/tc2/ramdisk.img ${TC2_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[3]="${TOP_DIR}/vexpress-firmware/SOFTWARE/bootkern.txt ${TC2_FOLDER}/bootscr.txt"
diff --git a/variants/tc2-busybox b/variants/tc2-busybox
index 16b3e98..475ba80 100644
--- a/variants/tc2-busybox
+++ b/variants/tc2-busybox
@@ -31,43 +31,45 @@ VARIANT_DESC="TC2 kernel for BusyBox Software Stack"
# Absolute path to the GCC compiler binaries (plus prefix)
# If you wish to specify a path relative to the workspace root, prefix it with "$TOP_DIR/"
# If your compiler is on your path, you can simply add the prefix, as per the default example.
-export CROSS_COMPILE=${CROSS_COMPILE:-arm-linux-gnueabihf-}
+export CROSS_COMPILE=${TOP_DIR}/tools/gcc/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
+export CROSS_COMPILE_32=${CROSS_COMPILE}
BUILD_SCRIPTS=""
LINUX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-linux.sh "
LINUX_PATH=linux
source $DIR/big-LITTLE-conf.sh
-LINUX_CONFIGS="linaro-base vexpress $BL_SUPPORT"
+LINUX_CONFIGS="linaro-base $BL_SUPPORT vexpress"
LINUX_DEFCONFIG=defconfig
LINUX_ARCH=arm
LINUX_IMAGE_TYPE=zImage
-DEVTREE_TREES=(vexpress-v2p-ca15_a7)
-DEVTREE_TREES_RENAME=(tc2.dtb)
BOOTMON_BUILD_ENABLED=1
BOOTMON_SCRIPT="bootscr.txt"
-UBOOT_BUILD_ENABLED=0
+UBOOT_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uboot.sh "
UBOOT_PATH=u-boot
UBOOT_ARCH=arm
+UBOOT_MKIMG=${TOP_DIR}/${UBOOT_PATH}/output/tools/mkimage
+UBOOT_UIMAGE_ADDRS="0x80080000"
UBOOT_BOARDS="vexpress_ca15_tc2"
-UBOOT_OUTPUT_DESTS[vexpress_ca15_tc2_defconfig]=tc2
-UBOOT_OUTPUT_FILENAME=boot-tc2.bin
+declare -A UBOOT_OUTPUT_DESTS
+UBOOT_OUTPUT_DESTS[vexpress_ca15_tc2]=tc2
UEFI_BUILD_ENABLED=0
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-uefi.sh "
UEFI_PATH=uefi/edk2
+UEFI_BUILD_MODE=RELEASE
+UEFI_TOOLCHAIN=GCC49
UEFI_TOOLS_PATH=tools/uefi-tools
UEFI_ACPICA_PATH=tools/acpica/generate/unix
UEFI_PLATFORMS="tc2"
-UEFI_BINARY="ARM_VEXPRESS_CTA15A7_EFI.fd"
-UEFI_BUILD_MODE=RELEASE
-UEFI_TOOLCHAIN=GCC49
-UEFI_OUTPUT_PLATFORMS="ArmVExpress-CTA15-A7"
-UEFI_OUTPUT_DESTS[ArmVExpress-CTA15-A7]=tc2
-UEFI_OUTPUT_FILENAME=boot-tc2.bin
+declare -A UEFI_PLAT_tc2
+UEFI_PLAT_tc2[platname]="ArmVExpress-CTA15-A7"
+UEFI_PLAT_tc2[output]=tc2
+UEFI_PLAT_tc2[defines]=
+UEFI_PLAT_tc2[binary]="ARM_VEXPRESS_CTA15A7_EFI.fd"
ARM_TF_BUILD_ENABLED=0
@@ -75,17 +77,30 @@ BUSYBOX_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-busybox.sh "
BUSYBOX_PATH=busybox
BUSYBOX_ARCH=arm
+BUSYBOX_RAMDISK_PATH=ramdisk
+BUSYBOX_RAMDISK_LINUX_GEN_CPIO=$LINUX_PATH/$LINUX_OUT_DIR/usr/gen_init_cpio
+BUSYBOX_RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
-RAMDISK_BUILD_ENABLED=1
-BUILD_SCRIPTS=$BUILD_SCRIPTS"build-ramdisk.sh "
-RAMDISK_PATH=ramdisk
-RAMDISK_BUSYBOX_PATH=$BUSYBOX_PATH/_install/bin/busybox
# this must be the last step for low level code.
TARGET_BINS_BUILD_ENABLED=1
BUILD_SCRIPTS=$BUILD_SCRIPTS"build-target-bins.sh "
-TARGET_BINS_UINITRD_ADDRS=""
+FINAL_BUILD_STEP="build-target-bins.sh"
+
TARGET_BINS_PLATS="tc2"
-TARGET_BINS_HAS_BUSYBOX=1
+declare -A TARGET_tc2
+TARGET_tc2[arm-tf]=""
+TARGET_tc2[scp]=""
+TARGET_tc2[uboot]=""
+TARGET_tc2[uefi]=""
+TARGET_tc2[fdts]="vexpress-v2p-ca15_a7"
+TARGET_tc2[linux]="zImage uImage.0x80080000"
+TARGET_tc2[ramdisk]=0x84000000
-TARGET_UBOOT_tc2=""
-TARGET_UEFI_tc2="tc2"
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+declare -a TARGET_BINS_COPY_LIST
+TC2_FOLDER=$PLATDIR/tc2-busybox/bootmon
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/zImage ${TC2_FOLDER}/zImage"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/vexpress-v2p-ca15_a7.dtb ${TC2_FOLDER}/tc2.dtb"
+TARGET_BINS_COPY_LIST[2]="${PLATDIR}/ramdisk-busybox.img ${TC2_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[3]="${TOP_DIR}/vexpress-firmware/SOFTWARE/bootkern.txt ${TC2_FOLDER}/bootscr.txt"
diff --git a/variants/tc2-oe b/variants/tc2-oe
index 977fdfe..cbf4730 100644
--- a/variants/tc2-oe
+++ b/variants/tc2-oe
@@ -29,6 +29,21 @@
source $DIR/variants/tc2-busybox
VARIANT_DESC="TC2 LSK kernel for OpenEmbedded Software Stack"
-LINUX_CONFIGS="linaro-base distribution vexpress $BL_SUPPORT"
-TARGET_BINS_HAS_BUSYBOX=
+LINUX_CONFIGS="linaro-base $BL_SUPPORT distribution vexpress"
+
+OE_BINARIES_BUILD_ENABLED=0
+OE_RAMDISK_BUILD_ENABLED=1
+BUILD_SCRIPTS=$BUILD_SCRIPTS"build-oe-binaries.sh "
+OE_BINARIES_PATH=prebuilts/oe
+
TARGET_BINS_HAS_OE=1
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+TC2_FOLDER=$PLATDIR/tc2-oe/bootmon
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/linux/zImage ${TC2_FOLDER}/zImage"
+TARGET_BINS_COPY_LIST[1]="${OUTDIR}/linux/vexpress-v2p-ca15_a7.dtb ${TC2_FOLDER}/tc2.dtb"
+TARGET_BINS_COPY_LIST[2]="${PLATDIR}/ramdisk-oe.img ${TC2_FOLDER}/ramdisk.img"
+TARGET_BINS_COPY_LIST[3]="${TOP_DIR}/vexpress-firmware/SOFTWARE/bootkern.txt ${TC2_FOLDER}/bootscr.txt"
diff --git a/variants/tc2-uefi b/variants/tc2-uefi
index 180c36a..8f3dcd6 100644
--- a/variants/tc2-uefi
+++ b/variants/tc2-uefi
@@ -37,3 +37,21 @@ UBOOT_BUILD_ENABLED=
OPTEE_BUILD_ENABLED=
BOOTMON_BUILD_ENABLED=
UEFI_BUILD_ENABLED=1
+
+TARGET_tc2[fdts]=""
+TARGET_tc2[uboot]=""
+
+UEFI_PLATFORMS="tc2"
+declare -A UEFI_PLAT_tc2
+UEFI_PLAT_tc2[platname]="ArmVExpress-CTA15-A7"
+UEFI_PLAT_tc2[output]=tc2
+UEFI_PLAT_tc2[defines]=
+UEFI_PLAT_tc2[binary]="ARM_VEXPRESS_CTA15A7_EFI.fd"
+
+#Copy binaries into the U-Boot folder
+TARGET_BINS_COPY_ENABLED=1
+unset TARGET_BINS_COPY_LIST
+declare -a TARGET_BINS_COPY_LIST
+TC2_UEFI_FOLDER=$PLATDIR/tc2-uefi/uefi
+TARGET_BINS_COPY_LIST[0]="${OUTDIR}/tc2/uefi.bin ${TC2_UEFI_FOLDER}/boot-tc2.bin"
+TARGET_BINS_COPY_LIST[1]="${TOP_DIR}/vexpress-firmware/SOFTWARE/bootuefi.txt ${TC2_UEFI_FOLDER}/bootscr.txt"