From 3c9280d4dbea6443aaff5425c09141b6bdccdd8c Mon Sep 17 00:00:00 2001 From: Lior Levin Date: Tue, 4 Sep 2018 10:40:20 +0300 Subject: scripts: add ci compile & pack scripts Change-Id: Ibc35811191d5c1a13cdeed0152807064dc07ef7f Signed-off-by: Lior Levin Reviewed-on: http://vgitil04.il.marvell.com:8080/61066 --- scripts/ci/baseline.txt | 7 ++ scripts/ci/compile.sh | 175 ++++++++++++++++++++++++++++++++++++++++ scripts/ci/pack.sh | 50 ++++++++++++ scripts/ci/pack_source.sh | 43 ++++++++++ scripts/ci/supported_builds.txt | 110 +++++++++++++++++++++++++ 5 files changed, 385 insertions(+) create mode 100644 scripts/ci/baseline.txt create mode 100755 scripts/ci/compile.sh create mode 100755 scripts/ci/pack.sh create mode 100755 scripts/ci/pack_source.sh create mode 100644 scripts/ci/supported_builds.txt diff --git a/scripts/ci/baseline.txt b/scripts/ci/baseline.txt new file mode 100644 index 00000000..007a49fd --- /dev/null +++ b/scripts/ci/baseline.txt @@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses +# Copyright (C) 2018 Marvell International Ltd. +# +# commit id of base tag for this branch +7f6d8f49aa916a526c2ce227606cc51eebd0c950 Merge pull request #1358 from omasab/sgi575_mt_flag \ No newline at end of file diff --git a/scripts/ci/compile.sh b/scripts/ci/compile.sh new file mode 100755 index 00000000..acaaf038 --- /dev/null +++ b/scripts/ci/compile.sh @@ -0,0 +1,175 @@ +#!/bin/bash +# Copyright (C) 2018 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses +############################################################################### +## This is the compile script for atf ## +## This script is called by CI automated builds ## +## It may also be used interactively by users to compile the same way as CI ## +############################################################################### +## WARNING: Do NOT MODIFY the CI wrapper code segments. ## +## You can only modify the config and compile commands ## +############################################################################### + + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +set -euo pipefail +shopt -s extglob +##==================================== USAGE ================================## +function usage { + echo """ +Usage: compile [--no_configure] [--echo_only] BUILD_NAME + or: compile --list + or: compile --help + +Compiles atf similar to the given CI build + + -N, --no_configure Skip configuration steps (make distclean) + -e, --echo_only Print out the compilation sequence but do not execute it + -l, --list List all supported BUILD_NAME values and exit + -h, --help Display this help and exit + +Prerequisites: + CROSS_COMPILE path to cross compiler + BL33 path to u-boot or uefi binary + MV_DDR_PATH path to ddr source + SCP_BL2 path to FreeRTOS binary (optional) + WTMI_IMG path to FreeRTOS binary for armada-3700 (optional) + WTP path to a3700 utils source (optional) + + +""" + exit 0 +} +##============================ PARSE ARGUMENTS ==============================## +TEMP=`getopt -a -o Nelh --long no_configure,echo_only,list,help \ + -n 'compile' -- "$@"` + +if [ $? != 0 ] ; then + echo "Error: Failed parsing command options" >&2 + exit 1 +fi +eval set -- "$TEMP" + +no_configure= +echo_only= +list= + +while true; do + case "$1" in + -N | --no_configure ) no_configure=true; shift ;; + -e | --echo_only ) echo_only=true; shift ;; + -l | --list ) list=true; shift ;; + -h | --help ) usage; ;; + -- ) shift; break ;; + * ) break ;; + esac +done + +if [[ $list ]] ; then + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + echo "Supported build names:" + grep -v '^#' "$DIR/supported_builds.txt" + echo + echo + exit 0 +fi + +[[ $# -ne 1 ]] && usage +build_name=$1 + +grep ^$build_name$ ./scripts/ci/supported_builds.txt >&/dev/null || + ( echo "Error: Unsupported build ${build_name}"; exit -1 ) +echo "running compile.sh ${build_name}" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## + + +########################### U-BOOT CONFIGURATION ############################## +case $build_name in + *_a70x0_pcap ) platform="a70x0_pcac"; ;; + *_a70x0* ) platform="a70x0"; ;; + *_a7020_amc ) platform="a70x0_amc"; ;; + *_a80x0_mcbin* ) platform="a80x0_mcbin"; ;; + *_a80x0* ) platform="a80x0"; ;; + *_a3900_z1* ) platform="a3900_z1"; ;; + *_a3900_z2* ) platform="a3900_z2"; ;; + *_a3900* ) platform="a3900"; ;; + *_a37xx* ) platform="a3700"; ;; + * ) echo "Error: Could not configure platform." + "Unsupported build ${build_name}"; exit -1; ;; +esac + +case $build_name in + uefi* ) build_flags="USE_COHERENT_MEM=0 LOG_LEVEL=20 WORKAROUND_CVE_2018_3639=0"; ;; + *_a70x0* ) build_flags="DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=20 WORKAROUND_CVE_2018_3639=0"; ;; + *_a7020_amc ) build_flags="DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=20 WORKAROUND_CVE_2018_3639=0"; ;; + *_a80x0_mcbin_cve_2018_3639) build_flags="DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=20"; ;; + *_a80x0* ) build_flags="DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=20 WORKAROUND_CVE_2018_3639=0"; ;; + *_a3900* ) build_flags="DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=20 WORKAROUND_CVE_2018_3639=0 MV_DDR4_BUILD=y"; ;; + *_a37xx_ddr3_* ) build_flags="DDR_TYPE=DDR3 USE_COHERENT_MEM=0 LOG_LEVEL=20 DDR_TOPOLOGY=0"; ;; + *_a37xx_ddr4_v1_* ) build_flags="DDR_TYPE=DDR4 USE_COHERENT_MEM=0 LOG_LEVEL=20 DDR_TOPOLOGY=1"; ;; + *_a37xx_ddr4_v3_* ) build_flags="DDR_TYPE=DDR4 USE_COHERENT_MEM=0 LOG_LEVEL=20 DDR_TOPOLOGY=3"; ;; + *_a37xx_espressobin_ddr3_1cs_* ) build_flags="DDR_TYPE=DDR3 USE_COHERENT_MEM=0 LOG_LEVEL=20 DDR_TOPOLOGY=0"; ;; + *_a37xx_espressobin_ddr3_2cs_* ) build_flags="DDR_TYPE=DDR3 USE_COHERENT_MEM=0 LOG_LEVEL=20 DDR_TOPOLOGY=2"; ;; + * ) echo "Error: Could not configure build_flags. Unsupported build ${build_name}"; exit -1; ;; +esac + +pm_fw_export="" +if [[ $build_name =~ _a37xx_ ]]; then + case $build_name in + *a37xx_*_1000_800 ) build_flags="${build_flags} CLOCKSPRESET=CPU_1000_DDR_800"; ;; + *a37xx_*_1200_750 ) build_flags="${build_flags} CLOCKSPRESET=CPU_1200_DDR_750"; ;; + *a37xx_*_600_600 ) build_flags="${build_flags} CLOCKSPRESET=CPU_600_DDR_600"; ;; + *a37xx_*_800_800 ) build_flags="${build_flags} CLOCKSPRESET=CPU_800_DDR_800"; ;; + * ) echo "Error: Could not configure build_flags. Unsupported build ${build_name}"; exit -1; ;; + esac + [[ -z ${WTMI_IMG:-} ]] || pm_fw_export="WTMI_IMG=${WTMI_IMG}" +else + [[ -z ${SCP_BL2:-} ]] || pm_fw_export="SCP_BL2=${SCP_BL2}" +fi +############################################################################### + + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +cmd=""" +set -x +pwd""" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## + + +if [[ $build_name =~ _a3700_ ]]; then +##[ 3700 +##################################### CONFIG ################################## +[[ $no_configure ]] || cmd=$cmd""" +make distclean""" + +#################################### COMPILE ################################## +cmd=$cmd""" +make MV_DDR_PATH=$MV_DDR_PATH ${build_flags} PLAT=${platform} ${pm_fw_export} all fip""" +############################################################################### +##] + +else +##[ All other SOCs +##################################### CONFIG ################################## +[[ $no_configure ]] || cmd=$cmd""" +${pm_fw_export} +make distclean""" + +#################################### COMPILE ################################## +cmd=$cmd""" +make MV_DDR_PATH=$MV_DDR_PATH ${build_flags} PLAT=${platform} all fip""" +############################################################################### +##] +fi + + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +if [[ $echo_only ]]; then + echo "$cmd" + exit 0 +fi + +eval "$cmd" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## diff --git a/scripts/ci/pack.sh b/scripts/ci/pack.sh new file mode 100755 index 00000000..b763803e --- /dev/null +++ b/scripts/ci/pack.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses +# Copyright (C) 2018 Marvell International Ltd. +# +############################################################################### +## This is the pack script for atf ## +## This script is called by CI automated builds ## +############################################################################### +## WARNING: Do NOT MODIFY the CI wrapper code segments. ## +## You can only modify the config and compile commands ## +############################################################################### +## Prerequisites: DESTDIR is the path to the destination directory +## Usage: pack BUILD_NAME + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +set -exuo pipefail +shopt -s extglob + +build_name=$1 +echo "running pack.sh ${build_name}" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## + +case $build_name in + *_a70x0_pcap ) platform="a70x0_pcac"; ;; + *_a70x0* ) platform="a70x0"; ;; + *_a7020_amc ) platform="a70x0_amc"; ;; + *_a80x0_mcbin* ) platform="a80x0_mcbin"; ;; + *_a80x0* ) platform="a80x0"; ;; + *_a3900_z1* ) platform="a3900_z1"; ;; + *_a3900_z2* ) platform="a3900_z2"; ;; + *_a3900* ) platform="a3900"; ;; + *_a37xx* ) platform="a3700"; ;; + * ) echo "Error: Could not configure platform." + "Unsupported build ${build_name}"; exit -1; ;; +esac + +mkdir -p $DESTDIR/dev_images +module_file="build/${platform}/release/flash-image.bin" +cp $module_file $DESTDIR/ + +#echo 'atf.pack: copying .bin .elf .txt files' +find . -name *.bin | xargs cp -u --target-directory=$DESTDIR/dev_images/ +find . -name *.elf | xargs cp -u --target-directory=$DESTDIR/dev_images/ + +if [[ $platform == "a3700" ]]; then + #echo 'atf.pack: copying uart-images' + find . -name uart-images.tgz | \ + xargs cp --target-directory=$DESTDIR/dev_images/ +fi diff --git a/scripts/ci/pack_source.sh b/scripts/ci/pack_source.sh new file mode 100755 index 00000000..63a954ba --- /dev/null +++ b/scripts/ci/pack_source.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses +# Copyright (C) 2018 Marvell International Ltd. +# +############################################################################### +## This is the source packing script for atf ## +## This script is called by CI automated builds ## +############################################################################### +## WARNING: Do NOT MODIFY the CI wrapper code segments. ## +## You can only modify the config and compile commands ## +############################################################################### +## Prerequisites: DESTDIR is the path to the destination directory +## Usage: pack_source RELEASE_VER END_TAG +## Output: packname + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +set -exuo pipefail +shopt -s extglob + +release_ver=$1 +end_tag=$2 +echo "running pack_source.sh ${release_ver} ${end_tag}" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## + +packname="atf-v1.5-${release_ver}" +base_tag=`cat scripts/ci/baseline.txt | \ + perl -nae 'next if /^#/; print \$F[0]; exit'` +ref_to_ref="${base_tag}..${end_tag}" +srcpkg="sources-${packname}" +gitpkg="git-${packname}" + +file_list=`git diff --name-status $ref_to_ref | grep -v \"^D\" | cut -f2` +mkdir -p ${DESTDIR}/$srcpkg +cp --parents $file_list ${DESTDIR}/$srcpkg/ || true + +mkdir ${DESTDIR}/$gitpkg +git format-patch -o ${DESTDIR}/$gitpkg $ref_to_ref + + +## =v=v=v=v=v=v=v=v=v=v=v CI WRAPPER - Do not Modify! v=v=v=v=v=v=v=v=v=v=v= ## +echo "packname:$packname" +## =^=^=^=^=^=^=^=^=^=^=^=^ End of CI WRAPPER code -=^=^=^=^=^=^=^=^=^=^=^= ## diff --git a/scripts/ci/supported_builds.txt b/scripts/ci/supported_builds.txt new file mode 100644 index 00000000..b7e72f4d --- /dev/null +++ b/scripts/ci/supported_builds.txt @@ -0,0 +1,110 @@ +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses +# Copyright (C) 2018 Marvell International Ltd. +# +uboot_2017_a70x0 +uboot_2017_a70x0_B +uboot_2017_a70x0_C +uboot_2017_a70x0_D +uboot_2017_a70x0_E +uboot_2017_a70x0_pcac +uboot_2017_a7020_amc +uboot_2017_a70x0_kr +uboot_2017_a70x0_tee + +uboot_2017_a80x0 +uboot_2017_a80x0_B +uboot_2017_a80x0_C +uboot_2017_a80x0_D +uboot_2017_a80x0_E +uboot_2017_a80x0_kr +uboot_2017_a80x0_tee +uboot_2017_a80x0_pm +uboot_2017_a80x0_no_mss +uboot_2017_a80x0_mcbin +uboot_2017_a80x0_mcbin_cve_2018_3639 +uboot_2017_a80x0_mcbin_pm + +uboot_2017_a3900_A +uboot_2017_a3900_B +uboot_2017_a3900_z1 +uboot_2017_a3900_z1_nand +uboot_2017_a3900_z2 +uboot_2017_a3900_z2_nand + +uboot_2017_a37xx_ddr3_v2_A_1000_800 +uboot_2017_a37xx_ddr3_v2_A_1200_750 +uboot_2017_a37xx_ddr3_v2_A_600_600 +uboot_2017_a37xx_ddr3_v2_A_800_800 +uboot_2017_a37xx_ddr3_v2_B_1000_800 +uboot_2017_a37xx_ddr3_v2_B_1200_750 +uboot_2017_a37xx_ddr3_v2_B_600_600 +uboot_2017_a37xx_ddr3_v2_B_800_800 +uboot_2017_a37xx_ddr3_v2_C_1000_800 +uboot_2017_a37xx_ddr3_v2_C_1200_750 +uboot_2017_a37xx_ddr3_v2_C_800_800 +uboot_2017_a37xx_ddr4_v1_A_1000_800 +uboot_2017_a37xx_ddr4_v1_A_800_800 +uboot_2017_a37xx_ddr4_v3_A_1000_800 +uboot_2017_a37xx_ddr4_v3_A_800_800 +uboot_2017_a37xx_ddr4_v3_B_1000_800 +uboot_2017_a37xx_ddr4_v3_B_800_800 +uboot_2017_a37xx_espressobin_ddr3_1cs_1000_800 +uboot_2017_a37xx_espressobin_ddr3_2cs_1000_800 +uboot_2017_freertos_a37xx_ddr3_v2_A_1000_800 +uboot_2017_a37xx_ddr3_v2_A_800_800_tee + +uboot_2018_a70x0 +uboot_2018_a70x0_B +uboot_2018_a70x0_C +uboot_2018_a70x0_D +uboot_2018_a70x0_E +uboot_2018_a70x0_pcac +uboot_2018_a7020_amc +uboot_2018_a70x0_kr + +uboot_2018_a80x0 +uboot_2018_a80x0_B +uboot_2018_a80x0_C +uboot_2018_a80x0_D +uboot_2018_a80x0_E +uboot_2018_a80x0_kr +uboot_2018_a80x0_pm +uboot_2018_a80x0_mcbin +uboot_2018_a80x0_mcbin_cve_2018_3639 +uboot_2018_a80x0_mcbin_pm + +uboot_2018_a3900_A +uboot_2018_a3900_B + +uboot_2018_a37xx_ddr3_v2_A_1000_800 +uboot_2018_a37xx_ddr3_v2_A_1200_750 +uboot_2018_a37xx_ddr3_v2_A_600_600 +uboot_2018_a37xx_ddr3_v2_A_800_800 +uboot_2018_a37xx_ddr3_v2_B_1000_800 +uboot_2018_a37xx_ddr3_v2_B_1200_750 +uboot_2018_a37xx_ddr3_v2_B_600_600 +uboot_2018_a37xx_ddr3_v2_B_800_800 +uboot_2018_a37xx_ddr3_v2_C_1000_800 +uboot_2018_a37xx_ddr3_v2_C_1200_750 +uboot_2018_a37xx_ddr3_v2_C_800_800 +uboot_2018_a37xx_ddr4_v1_A_1000_800 +uboot_2018_a37xx_ddr4_v1_A_800_800 +uboot_2018_a37xx_ddr4_v3_A_1000_800 +uboot_2018_a37xx_ddr4_v3_A_800_800 +uboot_2018_a37xx_ddr4_v3_B_1000_800 +uboot_2018_a37xx_ddr4_v3_B_800_800 +uboot_2018_a37xx_espressobin_ddr3_1cs_1000_800 +uboot_2018_a37xx_espressobin_ddr3_2cs_1000_800 +uboot_2018_freertos_a37xx_ddr3_v2_A_1000_800 + +uefi26_a70x0 +uefi26_a80x0 +uefi26_a80x0_mcbin +uefi26_a37xx + +uefi27_a70x0 +uefi27_a80x0 +uefi27_a80x0_mcbin +uefi27_a37xx \ No newline at end of file -- cgit