From c59d98de5aa06c7715a9d008cd409bba8edeef96 Mon Sep 17 00:00:00 2001 From: Cupertino Miranda Date: Thu, 22 Aug 2024 21:05:08 +0100 Subject: [PATCH] add BPF GCC support for BPF CI Signed-off-by: Cupertino Miranda --- build-selftests/action.yml | 5 ++- build-selftests/build_selftests.sh | 8 +++++ setup-build-env/action.yml | 11 +++++- setup-build-env/install_bpf_gcc.sh | 54 ++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100755 setup-build-env/install_bpf_gcc.sh diff --git a/build-selftests/action.yml b/build-selftests/action.yml index e066398..4db5590 100644 --- a/build-selftests/action.yml +++ b/build-selftests/action.yml @@ -7,6 +7,9 @@ inputs: toolchain: description: 'what toolchain to use' default: 'gcc' + bpf-toolchain: + description: 'what bpf toolchain to use' + default: 'clang' kbuild-output: description: 'relative or absolute path to use for storing build artifacts' required: true @@ -29,6 +32,6 @@ runs: run: | kbuild_output="$(realpath ${{ inputs.kbuild-output }})" export LLVM_VERSION=${{ inputs.llvm-version }} - ${GITHUB_ACTION_PATH}/build_selftests.sh "${{ inputs.arch }}" "${{ inputs.kernel }}" "${{ inputs.toolchain }}" "${kbuild_output}" + ${GITHUB_ACTION_PATH}/build_selftests.sh "${{ inputs.arch }}" "${{ inputs.kernel }}" "${{ inputs.toolchain }}" "${kbuild_output}" "${{ inputs.bpf-toolchain }}" env: MAX_MAKE_JOBS: ${{ inputs.max-make-jobs }} diff --git a/build-selftests/build_selftests.sh b/build-selftests/build_selftests.sh index 91eaddc..7a9d0bf 100755 --- a/build-selftests/build_selftests.sh +++ b/build-selftests/build_selftests.sh @@ -10,9 +10,11 @@ TARGET_ARCH="$1" KERNEL="$2" TOOLCHAIN="$3" export KBUILD_OUTPUT="$4" +BPF_TOOLCHAIN="$5" ARCH="$(platform_to_kernel_arch ${TARGET_ARCH})" CROSS_COMPILE="" +BPF_GCC_BIN="${GITHUB_WORKSPACE}/install_bpf_gcc/bin/bpf-unknown-none-gcc" if [[ "${TARGET_ARCH}" != "$(uname -m)" ]] then @@ -51,6 +53,12 @@ MAKE_OPTS=$(cat <> $LOGFILE 2>&1 || { echo -e "\nerror: building $BINUTILS_TARBALL"; exit 1; } + echo done +fi + +if [ ! -f "${INSTALLDIR}/${GCC_BASENAME}.built" ]; then + echo -n "Building and installing $GCC_TARBALL... "; + (tar xJf $GCC_TARBALL; + cd ${GCC_BASENAME}; + ./contrib/download_prerequisites + mkdir build-bpf; + cd build-bpf && ../configure --target=bpf-unknown-none --prefix=$INSTALLDIR && make -j $(nproc) && make install && touch ${INSTALLDIR}/${GCC_BASENAME}.built; + ) >> $LOGFILE 2>&1 || { echo -e "\nerror: building $GCC_TARBALL"; exit 1; } + echo done +fi +foldable end install_bpf_gcc