-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/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 <<EOF > 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} | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters