Skip to content

Commit abc71bd

Browse files
committed
config: add rustc-1.66 build environment
Rust 1.66.0 will be the next version supported by the kernel [1]. Therefore, add `rustc-1.66` as a new build environment alongside `rustc-1.62` (which can be removed later on when the new version hits mainline). Link: Rust-for-Linux/linux#947 [1] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent faffa51 commit abc71bd

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

config/core/build-configs.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,14 @@ build_environments:
499499
<<: *x86_64_params
500500
name:
501501

502+
rustc-1.66:
503+
cc: clang
504+
cc_version: 15
505+
arch_params:
506+
x86_64:
507+
<<: *x86_64_params
508+
name:
509+
502510
# Default config with full build coverage
503511
build_configs_defaults:
504512
variants:

config/docker/rustc-1.66.jinja2

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{% extends 'clang-15.jinja2' %}
2+
3+
{% block packages %}
4+
{{ super() }}
5+
6+
ARG RUST_VER=1.66.0
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=f6ff8b7a38bab7d8f3cb7b70c7201494a5485c2cf12e84a13c9e232fa51ebfe7
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)