summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-08-08 15:03:25 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-08-08 15:58:46 +0000
commit445697fd48a2e12d5d2c891ee2e863b6658a6eeb (patch)
treefbc5cf2446e8df194217a60f214db7132fd9d12d
parent6deec513842ada3fdd5e5a544e1535cd5a05abf4 (diff)
downloadjenkins-scripts-445697fd48a2e12d5d2c891ee2e863b6658a6eeb.tar.gz
jenkins-helpers.sh: Fix and improve uses of print_gnu_target
Change-Id: I80bbc452bf0c10d25220dffe5e03252d06d4c668
-rw-r--r--jenkins-helpers.sh15
-rw-r--r--round-robin.sh14
-rwxr-xr-xtcwg_bmk-build.sh7
-rwxr-xr-xtcwg_kernel-build.sh10
4 files changed, 29 insertions, 17 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 2b089799..56c33e8a 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -1060,14 +1060,23 @@ print_gnu_target ()
set -euf -o pipefail
local target="$1"
- if [ x"$target" = x"native" ]; then
- target=$(uname -m)
- fi
case "$target" in
"aarch64") target="aarch64-linux-gnu" ;;
"arm_eabi") target="arm-eabi" ;;
"arm"*) target="arm-linux-gnueabihf" ;;
"x86_64") target="x86_64-linux-gnu" ;;
+ "native")
+ case "$(uname -m)" in
+ "aarch64") target="aarch64-unknown-linux-gnu" ;;
+ "armv7l") target="armv7l-unknown-linux-gnueabihf" ;;
+ "armv8l") target="armv8l-unknown-linux-gnueabihf" ;;
+ "x86_64") target="x86_64-pc-linux-gnu" ;;
+ *)
+ echo "ERROR: Unknown native target $(uname -m)" >&2
+ exit 1
+ ;;
+ esac
+ ;;
*) echo "ERROR: Unknown target $target" >&2; exit 1 ;;
esac
echo "$target"
diff --git a/round-robin.sh b/round-robin.sh
index 48834ce8..94791172 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -357,9 +357,6 @@ build_abe ()
cd abe
- local gnu_target
- gnu_target=$(print_gnu_target ${rr[target]})
-
# Remove previous build directories and .stamp files.
# (we rely on ccache for fast rebuilds)
# These stamp files tell ABE whether it needs to re-run
@@ -390,7 +387,7 @@ build_abe ()
ccache -z
local target_opt=""
if [ x"${rr[target]}" != x"native" ]; then
- target_opt="--target $gnu_target"
+ target_opt="--target $(print_gnu_target ${rr[target]})"
# Disable TSan execution tests when using QEMU.
# QEMU can't handle TSan's shadow memory and it sends host machine
@@ -462,9 +459,10 @@ clean_sysroot ()
(
set -euf -o pipefail
- local gnu_target sysroot
+ local gnu_host gnu_target sysroot
+ gnu_host=$(print_gnu_target native)
gnu_target=$(print_gnu_target ${rr[target]})
- sysroot="$(pwd)/abe/builds/destdir/x86_64-pc-linux-gnu/$gnu_target/libc"
+ sysroot="$(pwd)/abe/builds/destdir/$gnu_host/$gnu_target/libc"
rm -rf "$sysroot"
)
@@ -517,7 +515,9 @@ EOF
local binutils_incdir
# Freshen up build and install directories. We rely on ccache for fast rebuilds.
if $use_abe; then
- rsync -a --del abe/builds/destdir/x86_64-pc-linux-gnu/ llvm-install/
+ local gnu_host
+ gnu_host=$(print_gnu_target native)
+ rsync -a --del abe/builds/destdir/$gnu_host/ llvm-install/
binutils_incdir=$(pwd)/binutils/include
else
rm -rf llvm-install
diff --git a/tcwg_bmk-build.sh b/tcwg_bmk-build.sh
index 6bd60a12..2c8e90f4 100755
--- a/tcwg_bmk-build.sh
+++ b/tcwg_bmk-build.sh
@@ -200,9 +200,10 @@ benchmark ()
;;
esac
- local bench_list bin cc gnu_target sysroot toolchain
+ local bench_list bin cc gnu_host gnu_target sysroot toolchain
+ gnu_host=$(print_gnu_target native)
gnu_target=$(print_gnu_target ${rr[target]})
- sysroot="$(pwd)/abe/builds/destdir/x86_64-pc-linux-gnu/$gnu_target/libc"
+ sysroot="$(pwd)/abe/builds/destdir/$gnu_host/$gnu_target/libc"
case "${rr[toolchain]}" in
llvm)
local llvm_target
@@ -222,7 +223,7 @@ benchmark ()
;;
gnu|gnu_eabi)
bmk_ldflags="$bmk_flags"
- bin="$(pwd)/abe/builds/destdir/x86_64-pc-linux-gnu/bin"
+ bin="$(pwd)/abe/builds/destdir/$gnu_host/bin"
cc="$bin/$gnu_target-"
toolchain="gnu"
;;
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh
index bb923767..1b0010da 100755
--- a/tcwg_kernel-build.sh
+++ b/tcwg_kernel-build.sh
@@ -106,9 +106,10 @@ build_linux_1 ()
rm -rf "$(pwd)"/bin
mkdir "$(pwd)"/bin
- local abe_bin cc ld_opt=""
+ local gnu_host abe_bin cc ld_opt=""
- abe_bin="$(pwd)/abe/builds/destdir/x86_64-pc-linux-gnu/bin"
+ gnu_host=$(print_gnu_target native)
+ abe_bin="$(pwd)/abe/builds/destdir/$gnu_host/bin"
# Use binutils $abe_bin for both GNU and LLVM builds.
# For LLVM builds at the very least we need target assembler, since,
# otherwise, clang will try to use /usr/bin/as for cases that integrated
@@ -213,8 +214,9 @@ boot_linux ()
*) assert false ;;
esac
- local qemu
- qemu="$(pwd)/abe/builds/hosttools/x86_64-pc-linux-gnu/bin/qemu-system-${rr[target]}"
+ local gnu_host qemu
+ gnu_host=$(print_gnu_target native)
+ qemu="$(pwd)/abe/builds/hosttools/$gnu_host/bin/qemu-system-${rr[target]}"
timeout --foreground 60s "$qemu" \
-kernel $image -machine virt $cpu -m 512 \