Skip to content

Commit

Permalink
scripts: add ci compile & pack scripts
Browse files Browse the repository at this point in the history
Change-Id: Ibc35811191d5c1a13cdeed0152807064dc07ef7f
Signed-off-by: Lior Levin <[email protected]>
Reviewed-on: http://vgitil04.il.marvell.com:8080/61066
  • Loading branch information
LiorLevin committed Nov 20, 2018
1 parent eb82b91 commit 3c9280d
Show file tree
Hide file tree
Showing 5 changed files with 385 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/ci/baseline.txt
Original file line number Diff line number Diff line change
@@ -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
175 changes: 175 additions & 0 deletions scripts/ci/compile.sh
Original file line number Diff line number Diff line change
@@ -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 -=^=^=^=^=^=^=^=^=^=^=^= ##
50 changes: 50 additions & 0 deletions scripts/ci/pack.sh
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions scripts/ci/pack_source.sh
Original file line number Diff line number Diff line change
@@ -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 -=^=^=^=^=^=^=^=^=^=^=^= ##
110 changes: 110 additions & 0 deletions scripts/ci/supported_builds.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3c9280d

Please sign in to comment.