aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Murphy <dmurphy@ti.com>2020-03-26 15:15:39 -0500
committerDan Murphy <dmurphy@ti.com>2020-03-26 15:15:39 -0500
commit2cdb9f6db68cd4f480ea4d93e19b68c34e5475f2 (patch)
tree5136db98fe53530c1585021bb370b1b70a969fc9
parentc33852bd02cb6ce37420366654962cb42c65576b (diff)
downloadlinux-dt-2cdb9f6db68cd4f480ea4d93e19b68c34e5475f2.tar.gz
system_test: Add a build script and recipe
Add a way to repeat the system test builds from the commandline along with a recipe file for automation. Signed-off-by: Dan Murphy <dmurphy@ti.com>
-rwxr-xr-xsystem_test/build_system_test.sh261
-rw-r--r--system_test/system_test_recipe6
2 files changed, 267 insertions, 0 deletions
diff --git a/system_test/build_system_test.sh b/system_test/build_system_test.sh
new file mode 100755
index 0000000..d69f57c
--- /dev/null
+++ b/system_test/build_system_test.sh
@@ -0,0 +1,261 @@
+#!/bin/bash
+# Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
+# ALL RIGHTS RESERVED
+
+ARM64_DT_PATH="arch/arm64/boot/dts/ti"
+ARM_DT_PATH="arch/arm/boot/dts"
+
+# Template for temporary build files
+TMP_PREFIX=systest_builds$$
+TMP_TEMPLATE="$TMP_PREFIX"_XXXXX.tmp
+
+function usage {
+cat << EOF
+
+Required arguements:
+ -k - Kernel Source directory
+ -m - The map with the test suite name and the corresponding information
+ -d - The defconfig to be built from the defconfig builder.
+ -b - output directory for the build
+ -t - TestSuite to be built. This will also be appeneded to the output
+ build directory
+
+Optional arguements:
+ -a - Arch to build either "arm" or "arm64" this can also be exported as
+ an enviroment variable
+ -o - DT overlay target directory
+ -w - Working directory for the test scripts.
+
+Example:
+ ./build_system_test.sh -k ~/linux_kernel/upstream/ -b ~/Desktop/build_out
+ -t j7_usb_otg_high_speed -d ti_sdk_arm64_release -a arm64 -o usb_otg/j7/high_speed
+EOF
+}
+
+function prepare_for_exit() {
+ D=$(dirname "$SYSTEM_TEST_LOG")
+ rm -f "$D"/"$TMP_PREFIX"*.tmp
+ exit
+}
+
+function set_working_directory() {
+ if [ ! -d "$KERNEL_PATH" ]; then
+ KERNEL_PATH=$(pwd)
+ fi
+
+ ORIGINAL_DIR=$(pwd)
+ if [ "$ORIGINAL_DIR" != "$KERNEL_PATH" ]; then
+ cd "$KERNEL_PATH"
+ KERNEL_PATH=$(pwd)
+ fi
+}
+
+function build_defconfig() {
+ cd ${DEFCONFIG_DIR}
+ ${DEFCONFIG_DIR}/defconfig_builder.sh -k ${KERNEL_PATH} -o ${BUILD_OUTPUT} -t ${DEFCONFIG_BASE}
+}
+
+function copy_defconfig_to_kernel() {
+ cp -v ${BUILD_OUTPUT}/${DEFCONFIG} ${ARCH_PATH}/.
+}
+
+function remove_defconfig_from_kernel() {
+ rm ${ARCH_PATH}/${DEFCONFIG}
+}
+
+function check_for_compiler {
+ COMPILER_COMMAND=$(which "$CROSS_COMPILE""gcc")
+ if [ -x "$COMPILER_COMMAND" ]; then
+ echo "Found " "$CROSS_COMPILE"
+ else
+ echo "Invalid or non-existent compiler ""$COMPILER_COMMAND" > build_failure.txt
+ exit 1
+ fi
+
+ export CROSS_COMPILE=${CROSS_COMPILE}
+}
+
+function cross_make {
+ make -j"$BUILD_THREADS" $*
+}
+
+function build_the_kernel() {
+ cross_make ARCH=${ARCH} O=${KERNEL_OUT}
+ if [ "$?" -gt 0 ]; then
+ echo "Building the ${TESTSUITE} kernel failed"
+ exit 1
+ fi
+
+ cross_make ARCH=${ARCH} O=${KERNEL_OUT} dtbs
+ if [ "$?" -gt 0 ]; then
+ echo "Building the ${TESTSUITE} dtbs failed"
+ exit 1
+ fi
+
+ cross_make ARCH=${ARCH} O=${KERNEL_OUT} modules
+ if [ "$?" -gt 0 ]; then
+ echo "Building the ${TESTSUITE} modules failed"
+ exit 1
+ fi
+
+ cross_make ARCH=${ARCH} O=${KERNEL_OUT} tar-pkg
+ if [ "$?" -gt 0 ]; then
+ echo "Tar-pk for ${TESTSUITE} failed"
+ exit 1
+ fi
+
+}
+
+function clean_the_kernel() {
+ cross_make ARCH=${ARCH} O=${KERNEL_OUT} distclean
+}
+
+function build_the_overlays() {
+ cross_make LINUX=${KERNEL_PATH} LINUX_BUILD=${KERNEL_OUT} ARCH=${ARCH} O=${KERNEL_OUT} -C ${SYS_TEST_WORKING_DIR}
+}
+
+function copy_needed_files() {
+ mkdir -p ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/modules"
+ mkdir -p ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree"
+
+ TARBALL=$(ls ${KERNEL_OUT}/*.tar)
+ if [ ${ARCH} = "arm64" ]; then
+ if [ -f ${KERNEL_OUT}/arch/arm64/boot/Image ]; then
+ cp -v ${KERNEL_OUT}/arch/arm64/boot/Image ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/Image"
+ fi
+
+ if [ -f ${KERNEL_OUT}/arch/arm64/boot/vmlinux ]; then
+ cp -v ${KERNEL_OUT}/arch/arm64/boot/vmlinux ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/vmlinux"
+ fi
+
+ cp -v ${KERNEL_OUT}/${ARM64_DT_PATH}/*.dtb ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ cp -v ${KERNEL_OUT}/${ARM64_DT_PATH}/*.dtbo ${WORKSPACE}/build_output/${TEST_SUITE}"/device_tree/."
+ cp -v $TARBALL ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/modules/"${TESTSUITE}_64bit_modules.tar
+ else
+ if [ -f ${KERNEL_OUT}/arch/arm/boot/zImage ]; then
+ cp -v ${KERNEL_OUT}/arch/arm/boot/zImage ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/zImage"
+ fi
+
+ if [ -f ${KERNEL_OUT}/arch/arm/boot/vmlinux ]; then
+ cp -v ${KERNEL_OUT}/arch/arm/boot/vmlinux ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/vmlinux"
+ fi
+
+ cp -v ${KERNEL_OUT}/${ARM_DT_PATH}/*.dtb ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ cp -v ${KERNEL_OUT}/${ARM_DT_PATH}/*.dtbo ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ cp -v $TARBALL ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/modules/"${TESTSUITE}_modules.tar
+ fi
+ cp -v ${KERNEL_OUT}/.config ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/built_defconfig.txt"
+}
+
+function copy_overlay_files() {
+ # Need to re-copy the base DTB files as they are built now with symbols
+ if [ ${ARCH} = "arm64" ]; then
+ cp -v ${KERNEL_OUT}/${ARM64_DT_PATH}/*.dtb ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ cp -v ${KERNEL_OUT}/${ARM64_DT_PATH}/*.dtbo ${WORKSPACE}/build_output/${TEST_SUITE}"/device_tree/."
+ else
+ cp -v ${KERNEL_OUT}/${ARM_DT_PATH}/*.dtb ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ cp -v ${KERNEL_OUT}/${ARM_DT_PATH}/*.dtbo ${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/device_tree/."
+ fi
+ cp -v ${OVERLAY_DIR}/*.dtbo ${BASE_OUTPUT_DIR}"/"${TESTSUITE}/device_tree/.
+}
+
+while getopts "a:k:t:w:b:d:o:" OPTION
+do
+ case $OPTION in
+ a)
+ ARCH=$OPTARG;;
+ k)
+ KERNEL_PATH=$OPTARG;;
+ w)
+ SYS_TEST_WORKING_DIR=$OPTARG;;
+ b)
+ BASE_OUTPUT_DIR=$OPTARG;;
+ t)
+ TESTSUITE=$OPTARG;;
+ d)
+ DEFCONFIG_BASE=$OPTARG;;
+ o)
+ OVERLAY_BASE_DIR=$OPTARG;;
+ ?)
+ usage
+ exit;;
+ esac
+done
+
+trap prepare_for_exit SIGHUP EXIT SIGINT SIGTERM
+
+BUILD_THREADS=16
+
+if [ -z ${SYS_TEST_WORKING_DIR} ]; then
+ SYS_TEST_WORKING_DIR=$(pwd)
+fi
+DEFCONFIG_DIR=${SYS_TEST_WORKING_DIR}"/config"
+
+if [ -z ${KERNEL_PATH} ]; then
+ echo "Need a path to the Linux Kernel"
+ exit 1
+fi
+if [ -z ${CROSS_COMPILE} ]; then
+ echo ${CROSS_COMPILE}
+fi
+
+if [ -z ${ARCH} ]; then
+ echo "Please set and export ARCH to arm or arm64"
+ exit 1
+fi
+
+if [ -z ${TESTSUITE} ]; then
+ echo "Testsuite ${TESTSUITE} must be populated"
+ exit 1
+fi
+
+if [ -z ${DEFCONFIG_BASE} ]; then
+ echo "Defconfig Base must be populated"
+ exit 1
+fi
+
+DEFCONFIG=${DEFCONFIG_BASE}"_defconfig"
+KERNEL_OUT=${BASE_OUTPUT_DIR}"/"${TESTSUITE}"/kernel_out"
+
+if [ ${ARCH} = "arm64" ]; then
+ ARCH_PATH="${KERNEL_PATH}/arch/arm64/configs"
+ OVERLAY_DIR=${KERNEL_OUT}"/arch/arm64/boot/dts/ti/system_test/${OVERLAY_BASE_DIR}"
+else
+ ARCH_PATH="${KERNEL_PATH}/arch/arm/configs"
+ OVERLAY_DIR=${KERNEL_OUT}"/arch/arm/boot/dts/ti/system_test/${OVERLAY_BASE_DIR}"
+fi
+
+BUILD_OUTPUT=${BASE_OUTPUT_DIR}"/"${TESTSUITE}
+if [ ! -d ${BUILD_OUTPUT} ]; then
+ mkdir -p ${BUILD_OUTPUT}
+else
+ rm -rf ${BUILD_OUTPUT}
+ mkdir -p ${BUILD_OUTPUT}
+fi
+
+check_for_compiler
+
+build_defconfig
+
+copy_defconfig_to_kernel
+
+set_working_directory
+
+cross_make ARCH=${ARCH} O=${KERNEL_OUT} ${DEFCONFIG}
+
+remove_defconfig_from_kernel
+
+build_the_kernel
+
+copy_needed_files
+
+if [ ! -z ${OVERLAY_DIR} ]; then
+ build_the_overlays
+ copy_overlay_files
+fi
+
+cross_make ARCH=${ARCH} O=${KERNEL_OUT} distclean
+
+rm -rf ${KERNEL_OUT}
+
+exit 0
diff --git a/system_test/system_test_recipe b/system_test/system_test_recipe
new file mode 100644
index 0000000..ee41db5
--- /dev/null
+++ b/system_test/system_test_recipe
@@ -0,0 +1,6 @@
+arch: arm testsuite: am3_mmc_module output: am3_mmc defconfig: am3_eth_module_defconfig overlay_dir: none
+arch: arm testsuite: am4_mmc_module output: am4_mmc defconfig: am4_eth_module_defconfig overlay_dir: none
+arch: arm testsuite: am3_usbhost output: am3_usbhost defconfig: am3_pio_musb overlay_dir: none
+arch: arm64 testsuite: j7_usb_otg_full_speed output: j7_usb_otg_full_speed defconfig: ti_sdk_arm64_release dt_overlay: usb_otg/j7/full_speed
+arch: arm64 testsuite: j7_usb_otg_high_speed output: j7_usb_otg_high_speed defconfig: ti_sdk_arm64_release dt_overlay: usb_otg/j7/high_speed
+arch: arm64 testsuite: j7_pcie_ep output: j7_pcie_ep defconfig: ti_sdk_arm64_release dt_overlay: pcie/pcie_ep/dma/j7