Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed May 17, 2024
1 parent 1189851 commit b50ea05
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 11 deletions.
50 changes: 50 additions & 0 deletions src/ci/docker/host-x86_64/rfl/Dockerfile
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
50 changes: 50 additions & 0 deletions src/ci/docker/scripts/rfl-build.sh
Original file line number Diff line number Diff line change
@@ -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 <<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}
${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
24 changes: 13 additions & 11 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b50ea05

Please sign in to comment.