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