From b50ea0523ca9cbe6e2f05917433524ec15023dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 17 May 2024 14:14:07 +0200 Subject: [PATCH] WIP --- src/ci/docker/host-x86_64/rfl/Dockerfile | 50 ++++++++++++++++++++++++ src/ci/docker/scripts/rfl-build.sh | 50 ++++++++++++++++++++++++ src/ci/github-actions/jobs.yml | 24 ++++++------ 3 files changed, 113 insertions(+), 11 deletions(-) create mode 100644 src/ci/docker/host-x86_64/rfl/Dockerfile create mode 100755 src/ci/docker/scripts/rfl-build.sh diff --git a/src/ci/docker/host-x86_64/rfl/Dockerfile b/src/ci/docker/host-x86_64/rfl/Dockerfile new file mode 100644 index 0000000000000..4d70a4e85c586 --- /dev/null +++ b/src/ci/docker/host-x86_64/rfl/Dockerfile @@ -0,0 +1,50 @@ +FROM ubuntu:23.10 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + g++ \ + gcc-multilib \ + make \ + ninja-build \ + file \ + curl \ + ca-certificates \ + python3 \ + git \ + cmake \ + sudo \ + gdb \ + flex \ + bison \ + bc \ + llvm-17-tools \ + llvm-17-dev \ + libedit-dev \ + libssl-dev \ + pkg-config \ + zlib1g-dev \ + xz-utils \ + && rm -rf /var/lib/apt/lists/* + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh + +# We are disabling CI LLVM since this builder is intentionally using a host +# LLVM, rather than the typical src/llvm-project LLVM. +ENV NO_DOWNLOAD_CI_LLVM 1 +ENV EXTERNAL_LLVM 1 + +# This is not the latest LLVM version, so some components required by tests may +# be missing. +ENV IS_NOT_LATEST_LLVM 1 + +# Using llvm-link-shared due to libffi issues -- see #34486 +ENV RUST_CONFIGURE_ARGS \ + --build=x86_64-unknown-linux-gnu \ + --llvm-root=/usr/lib/llvm-17 \ + --enable-llvm-link-shared \ + --set rust.thin-lto-import-instr-limit=10 + +COPY /scripts/rfl-build.sh /tmp/rfl-build.sh +ENV SCRIPT bash /tmp/rfl-build.sh diff --git a/src/ci/docker/scripts/rfl-build.sh b/src/ci/docker/scripts/rfl-build.sh new file mode 100755 index 0000000000000..41c43aaea7da9 --- /dev/null +++ b/src/ci/docker/scripts/rfl-build.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -euo pipefail + +LINUX_VERSION=v6.9 + +# Build rustc +../x.py --stage 1 build library/std +BUILT_RUSTC=$(realpath ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc) + +# Install rustup so that we have cargo for installing bindgen +curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs +sh rustup.sh -y --default-toolchain stable --profile minimal + +mkdir -p rfl +cd rfl + +# Download Linux +git clone --depth 1 --branch ${LINUX_VERSION} https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git + +# Install bindgen +/cargo/bin/cargo install --locked --version $(linux/scripts/min-tool-version.sh bindgen) bindgen-cli + +# Configure Linux +cat < linux/kernel/configs/rfl-for-rust-ci.config +# CONFIG_RETHUNK is not set +# CONFIG_X86_KERNEL_IBT is not set +# CONFIG_GCC_PLUGINS is not set + +CONFIG_RUST=y + +CONFIG_SAMPLES=y +CONFIG_SAMPLES_RUST=y + +CONFIG_SAMPLE_RUST_MINIMAL=m +CONFIG_SAMPLE_RUST_PRINT=y + +CONFIG_RUST_PHYLIB_ABSTRACTIONS=y +CONFIG_AX88796B_PHY=y +CONFIG_AX88796B_RUST_PHY=y + +CONFIG_KUNIT=y +CONFIG_RUST_KERNEL_DOCTESTS=y +EOF + +export RUSTC=${BUILT_RUSTC} +${RUSTC} -v + +make -C linux LLVM=1 -j$(($(nproc) + 1)) rustavailable defconfig rfl-for-rust-ci.config +make -C linux LLVM=1 -j$(($(nproc) + 1)) samples/rust/rust_minimal.o samples/rust/rust_print.o drivers/net/phy/ax88796b_rust.o diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 04888dc09b50d..063a8d3990ef5 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -75,17 +75,19 @@ envs: # These jobs automatically inherit envs.pr, to avoid repeating # it in each job definition. pr: - - image: mingw-check - <<: *job-linux-4c - - image: mingw-check-tidy - continue_on_error: true - <<: *job-linux-4c - - image: x86_64-gnu-llvm-17 - env: - ENABLE_GCC_CODEGEN: "1" - <<: *job-linux-16c - - image: x86_64-gnu-tools - <<: *job-linux-16c + # - image: mingw-check + # <<: *job-linux-4c + # - image: mingw-check-tidy + # continue_on_error: true + # <<: *job-linux-4c + # - image: x86_64-gnu-llvm-17 + # env: + # ENABLE_GCC_CODEGEN: "1" + # <<: *job-linux-16c + # - image: x86_64-gnu-tools + # <<: *job-linux-16c + - image: rfl + <<: *job-linux-8c # Jobs that run when you perform a try build (@bors try) # These jobs automatically inherit envs.try, to avoid repeating