From 0d52274754ff0e4e0a9f63221fcaedcb7ab61f51 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 14 Dec 2023 22:25:11 +0100 Subject: [PATCH 1/5] config: add `rustc-1.74` build environment Rust 1.74.1 will likely be the next version supported by the kernel [1]. Therefore, add it as a new build environment. Link: https://lore.kernel.org/rust-for-linux/20231214092958.377061-1-ojeda@kernel.org/ [1] Signed-off-by: Miguel Ojeda --- config/core/build-configs.yaml | 6 ++++ config/docker/rustc-1.74-x86.jinja2 | 9 ++++++ config/docker/rustc-1.74.jinja2 | 43 +++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 config/docker/rustc-1.74-x86.jinja2 create mode 100644 config/docker/rustc-1.74.jinja2 diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index cb4db5229d..6b3d2a30ec 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -721,6 +721,12 @@ build_environments: arch_params: x86_64: *x86_64_params + rustc-1.74: + cc: clang + cc_version: 17 + arch_params: + x86_64: *x86_64_params + # Default config with full build coverage build_configs_defaults: variants: diff --git a/config/docker/rustc-1.74-x86.jinja2 b/config/docker/rustc-1.74-x86.jinja2 new file mode 100644 index 0000000000..9c38df1ad4 --- /dev/null +++ b/config/docker/rustc-1.74-x86.jinja2 @@ -0,0 +1,9 @@ +{%- set sub_arch = 'amd64' %} +{% extends 'rustc-1.74.jinja2' %} + +{% block packages %} +{{ super() }} + +RUN dpkg --add-architecture amd64 + +{%- endblock %} diff --git a/config/docker/rustc-1.74.jinja2 b/config/docker/rustc-1.74.jinja2 new file mode 100644 index 0000000000..eca74561fc --- /dev/null +++ b/config/docker/rustc-1.74.jinja2 @@ -0,0 +1,43 @@ +{% extends 'clang-17.jinja2' %} + +{% block packages %} +{{ super() }} + +ARG RUST_VER=1.74.1 +ARG BINDGEN_VER=0.65.1 + +ARG RUST_TRIPLE=rust-${RUST_VER}-x86_64-unknown-linux-gnu + +ENV CARGO_HOME=/home/kernelci/.cargo +ENV PATH=/usr/${RUST_TRIPLE}/bin:${CARGO_HOME}/bin:${PATH} + +ARG SHA256SUM=d206888a2a9d55113940151ba16117ce2456d7de021bab18cfcb06dc48d3157c + +# fetch, verify the toolchain +RUN wget https://static.rust-lang.org/dist/${RUST_TRIPLE}.tar.gz && \ + echo "${SHA256SUM} ${RUST_TRIPLE}.tar.gz" | sha256sum --check --quiet + +# install & cleanup tmp files +RUN tar -xf ${RUST_TRIPLE}.tar.gz -C /tmp/ && \ + /tmp/${RUST_TRIPLE}/install.sh --prefix=/usr/${RUST_TRIPLE} \ + --components=rustc,cargo,rust-std-x86_64-unknown-linux-gnu && \ + rm -rf /tmp/${RUST_TRIPLE} && \ + rm /${RUST_TRIPLE}* + +# This image is based on clang-*jinja2 which only has clang installed, but rustc +# defaults to linker "cc" which usually points to the GNU/GCC stack. Pointing cc +# to clang ensures both cargo and kernel build rustc invocations use llvm/clang. +RUN update-alternatives --install /usr/bin/cc cc $(which clang) 30 && \ + update-alternatives --set cc $(which clang) + +RUN git clone --recurse-submodules --branch $RUST_VER \ + https://github.com/rust-lang/rust \ + $(rustc --print sysroot)/lib/rustlib/src/rust + +RUN cargo install --locked --version ${BINDGEN_VER} bindgen-cli + +# kernel build generates some rust code and tries to format it, if rustfmt is +# missing it will print non-fatal error noise +RUN cargo install rustfmt + +{%- endblock %} From 8045c42d0f4c8d2478a6c4787ed9b9f114221c05 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 14 Dec 2023 22:26:36 +0100 Subject: [PATCH 2/5] build-configs.yaml: move `mainline` to Rust 1.74 Signed-off-by: Miguel Ojeda --- config/core/build-configs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index 6b3d2a30ec..151e4856ef 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -1217,8 +1217,8 @@ build_configs: clang-16: build_environment: clang-16 architectures: *arch_clang_configs - rustc-1.73: - build_environment: rustc-1.73 + rustc-1.74: + build_environment: rustc-1.74 fragments: [rust, rust-samples, kselftest] architectures: x86_64: From e7400567a731301be7687bfce0d446c690260da7 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 14 Dec 2023 22:27:42 +0100 Subject: [PATCH 3/5] build-configs.yaml: move `next` to Rust 1.74 Signed-off-by: Miguel Ojeda --- config/core/build-configs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index 151e4856ef..9b854aa2aa 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -1307,8 +1307,8 @@ build_configs: architectures: <<: *arch_clang_configs - rustc-1.73: - build_environment: rustc-1.73 + rustc-1.74: + build_environment: rustc-1.74 fragments: [rust, rust-samples, kselftest] architectures: x86_64: From 7cfee6f4523b34ab7c54811643fa16ce0c33b03f Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 14 Dec 2023 22:27:58 +0100 Subject: [PATCH 4/5] build-configs.yaml: move `rust-for-linux_rust-next` to Rust 1.74 Signed-off-by: Miguel Ojeda --- config/core/build-configs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index 9b854aa2aa..169aae3c10 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -1466,8 +1466,8 @@ build_configs: tree: rust-for-linux branch: 'rust-next' variants: - rustc-1.73: - build_environment: rustc-1.73 + rustc-1.74: + build_environment: rustc-1.74 fragments: [rust, rust-for-linux-samples, rust-samples, kselftest] architectures: x86_64: From e3172dc5352be517558452db2c9860b4c0471a5f Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 14 Dec 2023 22:28:25 +0100 Subject: [PATCH 5/5] config: remove unused Rust 1.73 build environment Signed-off-by: Miguel Ojeda --- config/core/build-configs.yaml | 6 ---- config/docker/rustc-1.73-x86.jinja2 | 9 ------ config/docker/rustc-1.73.jinja2 | 43 ----------------------------- 3 files changed, 58 deletions(-) delete mode 100644 config/docker/rustc-1.73-x86.jinja2 delete mode 100644 config/docker/rustc-1.73.jinja2 diff --git a/config/core/build-configs.yaml b/config/core/build-configs.yaml index 169aae3c10..32f2e04aa7 100644 --- a/config/core/build-configs.yaml +++ b/config/core/build-configs.yaml @@ -715,12 +715,6 @@ build_environments: cc_version: 17 arch_params: *clang_15_arch_params - rustc-1.73: - cc: clang - cc_version: 17 - arch_params: - x86_64: *x86_64_params - rustc-1.74: cc: clang cc_version: 17 diff --git a/config/docker/rustc-1.73-x86.jinja2 b/config/docker/rustc-1.73-x86.jinja2 deleted file mode 100644 index 9dbd723010..0000000000 --- a/config/docker/rustc-1.73-x86.jinja2 +++ /dev/null @@ -1,9 +0,0 @@ -{%- set sub_arch = 'amd64' %} -{% extends 'rustc-1.73.jinja2' %} - -{% block packages %} -{{ super() }} - -RUN dpkg --add-architecture amd64 - -{%- endblock %} diff --git a/config/docker/rustc-1.73.jinja2 b/config/docker/rustc-1.73.jinja2 deleted file mode 100644 index e7433f1c0f..0000000000 --- a/config/docker/rustc-1.73.jinja2 +++ /dev/null @@ -1,43 +0,0 @@ -{% extends 'clang-17.jinja2' %} - -{% block packages %} -{{ super() }} - -ARG RUST_VER=1.73.0 -ARG BINDGEN_VER=0.65.1 - -ARG RUST_TRIPLE=rust-${RUST_VER}-x86_64-unknown-linux-gnu - -ENV CARGO_HOME=/home/kernelci/.cargo -ENV PATH=/usr/${RUST_TRIPLE}/bin:${CARGO_HOME}/bin:${PATH} - -ARG SHA256SUM=aa4cf0b7e66a9f5b7c623d4b340bb1ac2864a5f2c2b981f39f796245dc84f2cb - -# fetch, verify the toolchain -RUN wget https://static.rust-lang.org/dist/${RUST_TRIPLE}.tar.gz && \ - echo "${SHA256SUM} ${RUST_TRIPLE}.tar.gz" | sha256sum --check --quiet - -# install & cleanup tmp files -RUN tar -xf ${RUST_TRIPLE}.tar.gz -C /tmp/ && \ - /tmp/${RUST_TRIPLE}/install.sh --prefix=/usr/${RUST_TRIPLE} \ - --components=rustc,cargo,rust-std-x86_64-unknown-linux-gnu && \ - rm -rf /tmp/${RUST_TRIPLE} && \ - rm /${RUST_TRIPLE}* - -# This image is based on clang-*jinja2 which only has clang installed, but rustc -# defaults to linker "cc" which usually points to the GNU/GCC stack. Pointing cc -# to clang ensures both cargo and kernel build rustc invocations use llvm/clang. -RUN update-alternatives --install /usr/bin/cc cc $(which clang) 30 && \ - update-alternatives --set cc $(which clang) - -RUN git clone --recurse-submodules --branch $RUST_VER \ - https://github.com/rust-lang/rust \ - $(rustc --print sysroot)/lib/rustlib/src/rust - -RUN cargo install --locked --version ${BINDGEN_VER} bindgen-cli - -# kernel build generates some rust code and tries to format it, if rustfmt is -# missing it will print non-fatal error noise -RUN cargo install rustfmt - -{%- endblock %}