ci/get-binary-toolchains: rewrite, slightly
PATCH 1/3 ci/get-binary-toolchains: rewrite, slightly
Add set -e so errors are fatal.
Allow HOST_ARCH and VER to be overridden by the environment, for testing.
Pull the tarball basename into a variable to reduce duplication.
Turn the wget call into a function to reduce duplication.
Drop the big-endian binaries as we never use those.
Signed-off-by Ross Burton <[email protected]>
--- ci/get-binary-toolchains | 42 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 19 deletions(-)
ci/get-binary-toolchains +23 -19
@@ -1,8 +1,9 @@ #!/bin/bash -set -u +set -u -e -HOST_ARCH=$(uname -m) -VER="10.3-2021.07" +BASENAME=gcc-arm +VER=${VER:-10.3-2021.07} +HOST_ARCH=${HOST_ARCH:-$(uname -m)} DOWNLOAD_DIR=$1 TOOLCHAIN_DIR=$2
@@ -11,36 +12,39 @@ TOOLCHAIN_LINK_DIR=$3 # These should be already created by .gitlab-ci.yml, but do here if run outside of that env mkdir -p $DOWNLOAD_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR +download() { + TRIPLE=$1 + URL=https://developer.arm.com/-/media/Files/downloads/gnu-a/$VER/binrel/$BASENAME-$VER-$HOST_ARCH-$TRIPLE.tar.xz + wget -P $DOWNLOAD_DIR -nc $URL +} + if [ $HOST_ARCH = "aarch64" ]; then - #AArch64 Linux hosted cross compilers + # AArch64 Linux hosted cross compilers - #AArch32 target with hard float (arm-none-linux-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf elif [ $HOST_ARCH = "x86_64" ]; then - #x86_64 Linux hosted cross compilers - - #AArch32 target with hard float (arm-linux-none-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # x86_64 Linux hosted cross compilers - #AArch64 GNU/Linux target (aarch64-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf - #AArch64 GNU/Linux target (aarch64_be-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz + # AArch64 GNU/Linux target + download aarch64-none-linux-gnu else echo "ERROR - Unknown build arch of $HOST_ARCH" exit 1 fi -for i in arm aarch64 aarch64_be; do - if [ ! -d $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then - if [ ! -f $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then +for i in arm aarch64; do + if [ ! -d $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then + if [ ! -f $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then continue fi - tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz + tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz fi # Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location) - ln -s $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i + ln -s $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i done
Signature · 1 line
2.34.1
PATCH 2/3 CI: add patches to fix perf with clang
Apply two in-flight patches to fix the build of perf with clang.
Signed-off-by Ross Burton <[email protected]>
--- 0001-linux-yocto-fix-perf-with-clang.patch | 132 +++++++++++++++++++++ ci/clang.yml | 5 + 2 files changed, 137 insertions(+) create mode 100644 0001-linux-yocto-fix-perf-with-clang.patch
0001-linux-yocto-fix-perf-with-clang.patch new file +132 -0
@@ -0,0 +1,132 @@ +From fc2e155f4127935d11a6fc2de2af934f379b5416 Mon Sep 17 00:00:00 2001 +From: Ross Burton <[email protected]> +Date: Mon, 19 Dec 2022 12:25:06 +0000 +Subject: [PATCH] linux-yocto: fix perf with clang + +Signed-off-by: Ross Burton <[email protected]> +--- + ...hon-Account-for-multiple-words-in-CC.patch | 98 +++++++++++++++++++ + meta/recipes-kernel/linux/linux-yocto_5.15.bb | 2 + + 2 files changed, 100 insertions(+) + create mode 100644 meta/recipes-kernel/linux/files/0001-perf-python-Account-for-multiple-words-in-CC.patch + +diff --git a/meta/recipes-kernel/linux/files/0001-perf-python-Account-for-multiple-words-in-CC.patch b/meta/recipes-kernel/linux/files/0001-perf-python-Account-for-multiple-words-in-CC.patch +new file mode 100644 +index 00000000000..e9f5ab9d836 +--- /dev/null ++++ b/meta/recipes-kernel/linux/files/0001-perf-python-Account-for-multiple-words-in-CC.patch +@@ -0,0 +1,98 @@ ++https://lore.kernel.org/linux-perf-users/[email protected]/T/ ++https://lore.kernel.org/bpf/[email protected]/T/ ++ ++Upstream-Status: Submitted ++Signed-off-by: Ross Burton <[email protected]> ++ ++From ec36ad2d4842fa324d532fe49ff2aa67f7e3e939 Mon Sep 17 00:00:00 2001 ++From: Khem Raj <[email protected]> ++Date: Sun, 4 Dec 2022 18:50:39 -0800 ++Subject: [PATCH 1/2] libbpf: Fix build warning on ref_ctr_off ++ ++Clang warns on 32-bit ARM on this comparision ++ ++libbpf.c:10497:18: error: result of comparison of constant 4294967296 with expression of type 'size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] ++ if (ref_ctr_off >= (1ULL << PERF_UPROBE_REF_CTR_OFFSET_BITS)) ++ ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++ ++Check for platform long int to be larger than 32-bits before enabling ++this check, it false on 32bit anyways. ++ ++Cc: Alexei Starovoitov <[email protected]> ++Cc: Daniel Borkmann <[email protected]> ++Cc: Song Liu <[email protected]> ++Cc: Yonghong Song <[email protected]> ++Cc: Jiri Olsa <[email protected]> ++Cc: Paul Walmsley <[email protected]> ++Cc: Palmer Dabbelt <[email protected]> ++Cc: Nathan Chancellor <[email protected]> ++Cc: Nick Desaulniers <[email protected]> ++ ++Signed-off-by: Khem Raj <[email protected]> ++--- ++ tools/lib/bpf/libbpf.c | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c ++index 050622649797..596d9a335652 100644 ++--- a/tools/lib/bpf/libbpf.c +++++ b/tools/lib/bpf/libbpf.c ++@@ -9185,7 +9185,7 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name, ++ char errmsg[STRERR_BUFSIZE]; ++ int type, pfd, err; ++ ++- if (ref_ctr_off >= (1ULL << PERF_UPROBE_REF_CTR_OFFSET_BITS)) +++ if (BITS_PER_LONG > 32 && ref_ctr_off >= (1ULL << PERF_UPROBE_REF_CTR_OFFSET_BITS)) ++ return -EINVAL; ++ ++ type = uprobe ? determine_uprobe_perf_type() ++-- ++2.34.1 ++ ++ ++From 08bdb3dba2ace03bc48e25b9a6136fc48e1991c9 Mon Sep 17 00:00:00 2001 ++From: Khem Raj <[email protected]> ++Date: Sun, 4 Dec 2022 18:55:34 -0800 ++Subject: [PATCH 2/2] perf python: Account for multiple words in CC ++ ++Sometimes build systems may append options e.g. --sysroot etc. to CC ++variable especially in cross-compile environments like yocto project ++where CC varable is composed of cross-compiler name and some needed ++options for it to work in a relocatable environment. Therefore separate ++out the compiler name from rest of the options in CC, then add the ++options via second argument to Popen() API ++ ++Cc: Adrian Hunter <[email protected]> ++Cc: Fangrui Song <[email protected]> ++Cc: Florian Fainelli <[email protected]> ++Cc: Ian Rogers <[email protected]> ++Cc: Jiri Olsa <[email protected]> ++Cc: John Keeping <[email protected]> ++Cc: Leo Yan <[email protected]> ++Cc: Michael Petlan <[email protected]> ++Cc: Namhyung Kim <[email protected]> ++Cc: Nathan Chancellor <[email protected]> ++Cc: Nick Desaulniers <[email protected]> ++Cc: Sedat Dilek <[email protected]> ++Signed-off-by: Khem Raj <[email protected]> ++Reviewed-by: Florian Fainelli <[email protected]> ++--- ++ tools/perf/util/setup.py | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py ++index c255a2c90cd6..3699b3f8d2d7 100644 ++--- a/tools/perf/util/setup.py +++++ b/tools/perf/util/setup.py ++@@ -7,7 +7,7 @@ cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stde ++ src_feature_tests = getenv('srctree') + '/tools/build/feature' ++ ++ def clang_has_option(option): ++- cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() +++ cc_output = Popen([cc.split()[0], str(cc.split()[1:]) + option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() ++ return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ] ++ ++ if cc_is_clang: ++-- ++2.34.1 ++ +diff --git a/meta/recipes-kernel/linux/linux-yocto_5.15.bb b/meta/recipes-kernel/linux/linux-yocto_5.15.bb +index d5f21daf35b..d9535e65a97 100644 +--- a/meta/recipes-kernel/linux/linux-yocto_5.15.bb ++++ b/meta/recipes-kernel/linux/linux-yocto_5.15.bb +@@ -37,6 +37,8 @@ KBRANCH:class-devupstream = "v5.15/base" + SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}" + ++SRC_URI += "file://0001-perf-python-Account-for-multiple-words-in-CC.patch" ++ + LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + LINUX_VERSION ?= "5.15.78" + +-- +2.34.1 +
ci/clang.yml +5 -0
@@ -4,6 +4,11 @@ header: repos: meta-clang: url: https://github.com/kraj/meta-clang + poky: + patches: + perf: + repo: meta-arm + path: 0001-linux-yocto-fix-perf-with-clang.patch local_conf_header: clang: |
Signature · 1 line
2.34.1
PATCH 3/3 arm-bsp/linux-yocto: temporarily downgrade juno to 5.15.72
In reply to Ross BurtonThe mailbox patches don't apply to 5.15.78 so until they can be rebased and retested, pin the kernel to 5.15.72.
Signed-off-by Ross Burton <[email protected]>
--- meta-arm-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 meta-arm-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend
meta-arm-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend new file +3 -0
@@ -0,0 +1,3 @@ +# This is only needed until the juno patches are updated to the latest 5.15 release. +LINUX_VERSION:juno = "5.15.72" +SRCREV_machine:juno = "0b628306d1f9ea28c0e86369ce9bb87a47893c9c"
Signature · 1 line
2.34.1