Skip to content

Commit 71cfb94

Browse files
ojedanuclearcat
authored andcommitted
config: add rustc-1.71 build environment
Rust 1.71.1 will be the next version supported by the kernel [1]. Therefore, add it as a new build environment. Link: Rust-for-Linux/linux@89eed1a [1] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent f15fa07 commit 71cfb94

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

config/core/build-configs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,12 @@ build_environments:
718718
arch_params:
719719
x86_64: *x86_64_params
720720

721+
rustc-1.71:
722+
cc: clang
723+
cc_version: 16
724+
arch_params:
725+
x86_64: *x86_64_params
726+
721727
# Default config with full build coverage
722728
build_configs_defaults:
723729
variants:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{%- set sub_arch = 'amd64' %}
2+
{% extends 'rustc-1.71.jinja2' %}
3+
4+
{% block packages %}
5+
{{ super() }}
6+
7+
RUN dpkg --add-architecture amd64
8+
9+
{%- endblock %}

config/docker/rustc-1.71.jinja2

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{% extends 'clang-16.jinja2' %}
2+
3+
{% block packages %}
4+
{{ super() }}
5+
6+
ARG RUST_VER=1.71.1
7+
ARG BINDGEN_VER=0.56.0
8+
9+
ARG RUST_TRIPLE=rust-${RUST_VER}-x86_64-unknown-linux-gnu
10+
11+
ENV CARGO_HOME=/home/kernelci/.cargo
12+
ENV PATH=/usr/${RUST_TRIPLE}/bin:${CARGO_HOME}/bin:${PATH}
13+
14+
ARG SHA256SUM=34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4
15+
16+
# fetch, verify the toolchain
17+
RUN wget https://static.rust-lang.org/dist/${RUST_TRIPLE}.tar.gz && \
18+
echo "${SHA256SUM} ${RUST_TRIPLE}.tar.gz" | sha256sum --check --quiet
19+
20+
# install & cleanup tmp files
21+
RUN tar -xf ${RUST_TRIPLE}.tar.gz -C /tmp/ && \
22+
/tmp/${RUST_TRIPLE}/install.sh --prefix=/usr/${RUST_TRIPLE} \
23+
--components=rustc,cargo,rust-std-x86_64-unknown-linux-gnu && \
24+
rm -rf /tmp/${RUST_TRIPLE} && \
25+
rm /${RUST_TRIPLE}*
26+
27+
# This image is based on clang-*jinja2 which only has clang installed, but rustc
28+
# defaults to linker "cc" which usually points to the GNU/GCC stack. Pointing cc
29+
# to clang ensures both cargo and kernel build rustc invocations use llvm/clang.
30+
RUN update-alternatives --install /usr/bin/cc cc $(which clang) 30 && \
31+
update-alternatives --set cc $(which clang)
32+
33+
RUN git clone --recurse-submodules --branch $RUST_VER \
34+
https://github.com/rust-lang/rust \
35+
$(rustc --print sysroot)/lib/rustlib/src/rust
36+
37+
RUN cargo install --locked --version ${BINDGEN_VER} bindgen
38+
39+
# kernel build generates some rust code and tries to format it, if rustfmt is
40+
# missing it will print non-fatal error noise
41+
RUN cargo install rustfmt
42+
43+
{%- endblock %}

0 commit comments

Comments
 (0)