Skip to content

Commit 90e8386

Browse files
committed
Build Rust for Linux in PR CI
1 parent 500eb30 commit 90e8386

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

src/ci/docker/host-x86_64/rfl/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
python3 \
1414
git \
1515
cmake \
16-
sudo \
1716
gdb \
1817
flex \
1918
bison \
2019
bc \
21-
llvm-17-tools \
20+
llvm-17 \
2221
llvm-17-dev \
23-
clang \
22+
llvm-17-tools \
23+
clang-17 \
24+
lld-17 \
25+
libelf-dev \
2426
libedit-dev \
2527
libssl-dev \
2628
pkg-config \
@@ -31,6 +33,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3133
COPY scripts/sccache.sh /scripts/
3234
RUN sh /scripts/sccache.sh
3335

36+
# RfL needs access to llvm-ar
37+
ENV PATH="${PATH}:/usr/lib/llvm-17/bin"
38+
3439
# We are disabling CI LLVM since this builder is intentionally using a host
3540
# LLVM, rather than the typical src/llvm-project LLVM.
3641
ENV NO_DOWNLOAD_CI_LLVM 1

src/ci/docker/scripts/rfl-build.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,32 @@
22

33
set -euo pipefail
44

5-
LINUX_VERSION=v6.9
5+
LINUX_VERSION=master
66

7-
# Build rustc
8-
../x.py --stage 1 build library/std
9-
BUILT_RUSTC=$(realpath ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc)
7+
# Build rustc and rustdoc
8+
../x.py --stage 1 build library rustdoc
109

11-
# Install rustup so that we have cargo for installing bindgen
10+
# Install rustup so that we can use the built toolchain easily
1211
curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
1312
sh rustup.sh -y --default-toolchain stable --profile minimal
1413

1514
source /cargo/env
1615

16+
rustup toolchain link local ./build/x86_64-unknown-linux-gnu/stage1
17+
rustup default local
18+
1719
mkdir -p rfl
1820
cd rfl
1921

2022
# Download Linux
2123
git clone --depth 1 --branch ${LINUX_VERSION} \
2224
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
2325

24-
# Install bindgen
25-
cargo install --locked \
26-
--version $(linux/scripts/min-tool-version.sh bindgen) bindgen-cli
26+
# Install bindgen. It needs to be compiled with the same version
27+
# as will be used for the RfL build.
28+
cargo install --version $(linux/scripts/min-tool-version.sh bindgen) bindgen-cli
2729

28-
# Configure Linux
30+
# Configure Rust for Linux
2931
cat <<EOF > linux/kernel/configs/rfl-for-rust-ci.config
3032
# CONFIG_RETHUNK is not set
3133
# CONFIG_X86_KERNEL_IBT is not set
@@ -47,12 +49,12 @@ CONFIG_KUNIT=y
4749
CONFIG_RUST_KERNEL_DOCTESTS=y
4850
EOF
4951

50-
make -C linux LLVM=1 RUSTC=${BUILT_RUSTC} -j$(($(nproc) + 1)) \
52+
make -C linux LLVM=1 -j$(($(nproc) + 1)) \
5153
rustavailable \
5254
defconfig \
5355
rfl-for-rust-ci.config
5456

55-
make -C linux LLVM=1 RUSTC=${BUILT_RUSTC} -j$(($(nproc) + 1)) \
57+
make -C linux LLVM=1 -j$(($(nproc) + 1)) \
5658
samples/rust/rust_minimal.o \
5759
samples/rust/rust_print.o \
5860
drivers/net/phy/ax88796b_rust.o

0 commit comments

Comments
 (0)