|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +LINUX_VERSION=c13320499ba0efd93174ef6462ae8a7a2933f6e7 |
| 6 | + |
| 7 | +# Build rustc, rustdoc and cargo |
| 8 | +../x.py build --stage 1 library rustdoc |
| 9 | +../x.py build --stage 0 cargo |
| 10 | + |
| 11 | +# Install rustup so that we can use the built toolchain easily, and also |
| 12 | +# install bindgen in an easy way. |
| 13 | +curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs |
| 14 | +sh rustup.sh -y --default-toolchain none |
| 15 | + |
| 16 | +source /cargo/env |
| 17 | + |
| 18 | +BUILD_DIR=$(realpath ./build) |
| 19 | +rustup toolchain link local "${BUILD_DIR}"/x86_64-unknown-linux-gnu/stage1 |
| 20 | +rustup default local |
| 21 | + |
| 22 | +mkdir -p rfl |
| 23 | +cd rfl |
| 24 | + |
| 25 | +# Remove existing directory to make local builds easier |
| 26 | +rm -rf linux || true |
| 27 | + |
| 28 | +# Download Linux at a specific commit |
| 29 | +mkdir -p linux |
| 30 | +git -C linux init |
| 31 | +git -C linux remote add origin https://github.com/torvalds/linux.git |
| 32 | +git -C linux fetch --depth 1 origin ${LINUX_VERSION} |
| 33 | +git -C linux checkout FETCH_HEAD |
| 34 | + |
| 35 | +# Install bindgen |
| 36 | +"${BUILD_DIR}"/x86_64-unknown-linux-gnu/stage0/bin/cargo install \ |
| 37 | + --version $(linux/scripts/min-tool-version.sh bindgen) \ |
| 38 | + bindgen-cli |
| 39 | + |
| 40 | +# Configure Rust for Linux |
| 41 | +cat <<EOF > linux/kernel/configs/rfl-for-rust-ci.config |
| 42 | +# CONFIG_WERROR is not set |
| 43 | +
|
| 44 | +CONFIG_RUST=y |
| 45 | +
|
| 46 | +CONFIG_SAMPLES=y |
| 47 | +CONFIG_SAMPLES_RUST=y |
| 48 | +
|
| 49 | +CONFIG_SAMPLE_RUST_MINIMAL=m |
| 50 | +CONFIG_SAMPLE_RUST_PRINT=y |
| 51 | +
|
| 52 | +CONFIG_RUST_PHYLIB_ABSTRACTIONS=y |
| 53 | +CONFIG_AX88796B_PHY=y |
| 54 | +CONFIG_AX88796B_RUST_PHY=y |
| 55 | +
|
| 56 | +CONFIG_KUNIT=y |
| 57 | +CONFIG_RUST_KERNEL_DOCTESTS=y |
| 58 | +EOF |
| 59 | + |
| 60 | +make -C linux LLVM=1 -j$(($(nproc) + 1)) \ |
| 61 | + rustavailable \ |
| 62 | + defconfig \ |
| 63 | + rfl-for-rust-ci.config |
| 64 | + |
| 65 | +make -C linux LLVM=1 -j$(($(nproc) + 1)) \ |
| 66 | + samples/rust/rust_minimal.o \ |
| 67 | + samples/rust/rust_print.o \ |
| 68 | + drivers/net/phy/ax88796b_rust.o |
0 commit comments