Message ID | 20231214222253.116734-1-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8889675dys; Thu, 14 Dec 2023 14:23:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhUscHjDbsZhNolrIz/UVW1h6K5p+RW+awCShwUb7zzMu8J4oT6UhrdLmTOR/UGOG9ws0G X-Received: by 2002:ac8:5a42:0:b0:425:4043:2a0c with SMTP id o2-20020ac85a42000000b0042540432a0cmr15992028qta.135.1702592613476; Thu, 14 Dec 2023 14:23:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702592613; cv=none; d=google.com; s=arc-20160816; b=W5zQgn+DCiVEi9UbIjzJoJXcOlYj6ekd0fpsaTTX4Uly88BRXS4e6+3Sl95kSy97p7 OfFvCZOhOLaDOcZIBG7kY3oFgwus1Rh+zaETz4YZGyBr5gQ7pXhMn5xjCtUbtaPLTMfW 3QZ9BgImXYqM9eqGKQJK9NBRmn4ccW307+1ys5K5qtQpvUQMV3MXX1v4C/SxLRAHsz8C pJh5+el95bKR7VZ1jp40ZNdOlcE2JRt/i1CVf34+UWRreSm7Ayo25IQnsks5g/HMuexy X620CISJx7/cF1ZPZ9WwEtpxHOZaUqnjyHh5lG9noi9raWL5iOEQ9YjsR1DsQJ9uP3Ea +Vhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=2XXst07nknW0l6uACkPyWWBXUPw/FxLNvLtoP6e392E=; fh=QSgolHeNGRlAM0OXE00xeOGX8y4YA1YVQI+ETCOl/lQ=; b=yOgjnqXVG+LTSRC7QLIahqMa8B6b47fAEsx3AgKHfLiFwlMppAXXeXI5VndPwxBqJY rNQyP079r4K5JBIjfzZ2QGySG00twyaDLoJBM5cB6mIs/Wka12sWTiHKCHvBe+6jZ4v2 Y5YBFkxWkUDRRHvldmMAVZEGq35MPDrYnqkUx3cV93NIyWdqqjPy0okKHYOp3jl5qPyL srR5nFKXC0qyiXxFSHTXMM8ocW8i11GYIhFlp98say+ytEJE3AKoaHTIRf/asvKAQIs9 tcyOs2a2shhTsoiOvI3hNI8GkPf5MG8coTteJYdWvmBfHQ0QzLh9f9p2t9z0yNLyIq14 1tBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hy1KhZDQ; spf=pass (google.com: domain of linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb21-20020a05622a1b1500b00423759c77cdsi5321581qtb.523.2023.12.14.14.23.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 14:23:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hy1KhZDQ; spf=pass (google.com: domain of linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 445581C21DE4 for <ouuuleilei@gmail.com>; Thu, 14 Dec 2023 22:23:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C69B66ADF; Thu, 14 Dec 2023 22:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hy1KhZDQ" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B4746720A; Thu, 14 Dec 2023 22:23:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34043C433C8; Thu, 14 Dec 2023 22:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702592591; bh=pgyu4wBiidMdBiu1uYG+TluTmLJL6JHzn+KTryLFeg4=; h=From:To:Cc:Subject:Date:From; b=hy1KhZDQeVmw/PKAZKMyHpyFpLjMJvZ9nzmSzg1q25LbazraEx0KJ3LDB8nRJJvpX 3jXCtGicmnegnajOaGeUiliNcYAg0Kv2/pOJZIINAIncAfSGEUcFTdS6+Sw3FkUUIV O0nRnHfXWkFc0zAIDOsUyh8cCkqx1OCcYo+K5aMstdkf6vM6GKbcRbXYnQdMNrbxjS qHc1tXmWh4RrjAfJAr3gYMqXpOSQIpykKFOM4pyoP6GAAVRIW4qrdMLUlff6dQIqiv /4fO0fIg7F5Iy4RdxU4hqQedtn/JRLasYTUA9lvGmygWOzBJ/DJrzVqJiNz0QSh+q5 z8xkqRXYjB/TQ== From: Miguel Ojeda <ojeda@kernel.org> To: Masahiro Yamada <masahiroy@kernel.org>, Miguel Ojeda <ojeda@kernel.org>, Wedson Almeida Filho <wedsonaf@gmail.com>, Alex Gaynor <alex.gaynor@gmail.com> Cc: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Andreas Hindborg <a.hindborg@samsung.com>, Alice Ryhl <aliceryhl@google.com>, linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH] kbuild: rust: add `rustupoverride` target Date: Thu, 14 Dec 2023 23:22:53 +0100 Message-ID: <20231214222253.116734-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785297752164087228 X-GMAIL-MSGID: 1785297752164087228 |
Series |
kbuild: rust: add `rustupoverride` target
|
|
Commit Message
Miguel Ojeda
Dec. 14, 2023, 10:22 p.m. UTC
When setting up the Rust support via `rustup`, one may use an override
in order to select the right version of the Rust toolchain.
The current instructions at Documentation/rust/quick-start.rst assume
one is using an in-tree kernel build (i.e. no `O=`) [1]. We would like
to provide also the way to do so for `O=` builds, but ideally in a way
that keeps the one-liner copy-pastable and without duplication [2].
Thus provide a new Make target, `rustupoverride`, that sets it up for
the user given their build options/variables.
Link: https://lore.kernel.org/rust-for-linux/20231207084846.faset66xzuoyvdlg@vireshk-i7/ [1]
Link: https://lore.kernel.org/rust-for-linux/CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com/ [2]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
Viresh may send a patch on top of this to refer to `rustupoverride`
from the Quick Start guide in `Documentation/rust` -- that one should
probably be applied right after this one.
Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
base-commit: a39b6ac3781d46ba18193c9dbb2110f31e9bffe9
--
2.43.0
Comments
On 12/14/23 19:22, Miguel Ojeda wrote: > When setting up the Rust support via `rustup`, one may use an override > in order to select the right version of the Rust toolchain. > > The current instructions at Documentation/rust/quick-start.rst assume > one is using an in-tree kernel build (i.e. no `O=`) [1]. We would like > to provide also the way to do so for `O=` builds, but ideally in a way > that keeps the one-liner copy-pastable and without duplication [2]. > > Thus provide a new Make target, `rustupoverride`, that sets it up for > the user given their build options/variables. > > Link: https://lore.kernel.org/rust-for-linux/20231207084846.faset66xzuoyvdlg@vireshk-i7/ [1] > Link: https://lore.kernel.org/rust-for-linux/CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com/ [2] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > [...] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
On Fri, 15 Dec 2023 at 06:23, Miguel Ojeda <ojeda@kernel.org> wrote: > > When setting up the Rust support via `rustup`, one may use an override > in order to select the right version of the Rust toolchain. > > The current instructions at Documentation/rust/quick-start.rst assume > one is using an in-tree kernel build (i.e. no `O=`) [1]. We would like > to provide also the way to do so for `O=` builds, but ideally in a way > that keeps the one-liner copy-pastable and without duplication [2]. > > Thus provide a new Make target, `rustupoverride`, that sets it up for > the user given their build options/variables. > > Link: https://lore.kernel.org/rust-for-linux/20231207084846.faset66xzuoyvdlg@vireshk-i7/ [1] > Link: https://lore.kernel.org/rust-for-linux/CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com/ [2] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > Viresh may send a patch on top of this to refer to `rustupoverride` > from the Quick Start guide in `Documentation/rust` -- that one should > probably be applied right after this one. > This worked fine for me testing the 1.74.1 upgrade, thanks. Tested-by: David Gow <davidgow@google.com> Would having similar targets for bindgen help? What about having this install rust-src? Updating / installing those required a lot more looking up of documentation (and then adding --force), so it'd be nice if there were some way to do a similar override or make target. Cheers, -- David
On Thu, Dec 14, 2023 at 11:23 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > When setting up the Rust support via `rustup`, one may use an override > in order to select the right version of the Rust toolchain. > > The current instructions at Documentation/rust/quick-start.rst assume > one is using an in-tree kernel build (i.e. no `O=`) [1]. We would like > to provide also the way to do so for `O=` builds, but ideally in a way > that keeps the one-liner copy-pastable and without duplication [2]. > > Thus provide a new Make target, `rustupoverride`, that sets it up for > the user given their build options/variables. > > Link: https://lore.kernel.org/rust-for-linux/20231207084846.faset66xzuoyvdlg@vireshk-i7/ [1] > Link: https://lore.kernel.org/rust-for-linux/CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com/ [2] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
On 14/12/2023 22:22, Miguel Ojeda wrote: > When setting up the Rust support via `rustup`, one may use an override > in order to select the right version of the Rust toolchain. > > The current instructions at Documentation/rust/quick-start.rst assume > one is using an in-tree kernel build (i.e. no `O=`) [1]. We would like > to provide also the way to do so for `O=` builds, but ideally in a way > that keeps the one-liner copy-pastable and without duplication [2]. > > Thus provide a new Make target, `rustupoverride`, that sets it up for > the user given their build options/variables. > > Link: https://lore.kernel.org/rust-for-linux/20231207084846.faset66xzuoyvdlg@vireshk-i7/ [1] > Link: https://lore.kernel.org/rust-for-linux/CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com/ [2] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Tiago Lam <tiagolam@gmail.com>
On Fri, Dec 15, 2023 at 8:38 AM David Gow <davidgow@google.com> wrote: > > Would having similar targets for bindgen help? What about having this > install rust-src? Updating / installing those required a lot more > looking up of documentation (and then adding --force), so it'd be nice > if there were some way to do a similar override or make target. Which docs did you need to check? i.e. we have the commands for those steps in the Quick Start guide. I think you may be referring to the case when switching between LTS and mainline, due to the `bindgen-cli` vs. `bindgen` name change that the tool did (since that is where `--force` is required, not for normal upgrading or downgrading). That is definitely a bit painful :-( At least `cargo` mentions the need for `--force` in that case. Or are you referring to something else? I considered having a `rustupsetup` target (or script) instead that does everything (with a `BUILDONLY=1` option or similar, given some dependencies are not strictly needed for building), since having all this "switching logic" is useful, but then: - I am not sure we should "hide" the details of the setup too much: I thought `rustupoverride` would be OK-ish because the output directory is needed (so it is justified) and the command is straightforward, but the others do not "need" that information. - If we include `bindgen` there, it wouldn't be `rustup`-only anymore, so perhaps we would need another name like `rustsetup`. But that may mislead others (e.g. those looking at the Make help), because it is just one way of setting things up and it is not required. Perhaps this can be alleviated by not including it in the `make help`, so that everybody comes from the Quick Start guide and thus hopefully they have read the document at least diagonally :) - Given there are different ways to set different sub-steps, and the fact that we don't have such a script for C does not have (please correct me if I am wrong -- I am aware of Thorsten's recent guide, which covers `apt` etc., but that is a Quick Start-like approach rather than automated script), I am not sure it would be welcome as a Make target (but perhaps it would be fine as a script?). Masahiro may have some guidelines here. - In the future we may have to change how the setup works or add steps, i.e. it is not 100% settled. Thus I am concerned about adding complex Make targets that users may start to depend on (i.e. with particular/complex semantics), vs. just having docs that are manual. For `rustupoverride`, it thought it could be OK-ish because it is just a single command and unlikely that it will change (and if we stop using it, we can make it empty with a warning and then remove it eventually; while it gets harder for more complex ones). What do you think? Cheers, Miguel
On Fri, 15 Dec 2023 at 19:27, Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Fri, Dec 15, 2023 at 8:38 AM David Gow <davidgow@google.com> wrote: > > > > Would having similar targets for bindgen help? What about having this > > install rust-src? Updating / installing those required a lot more > > looking up of documentation (and then adding --force), so it'd be nice > > if there were some way to do a similar override or make target. > > Which docs did you need to check? i.e. we have the commands for those > steps in the Quick Start guide. I think you may be referring to the > case when switching between LTS and mainline, due to the `bindgen-cli` > vs. `bindgen` name change that the tool did (since that is where > `--force` is required, not for normal upgrading or downgrading). That > is definitely a bit painful :-( At least `cargo` mentions the need for > `--force` in that case. Or are you referring to something else? Yeah, I only needed to check the Quick Start guide, but had to look at all three sections (rustc, rust-src, bindgen), which And yes, it looks like the bindgen/bindgen-cli name change was what was causing my issues. If that's only a one-off, then we should be fine. ( > I considered having a `rustupsetup` target (or script) instead that > does everything (with a `BUILDONLY=1` option or similar, given some > dependencies are not strictly needed for building), since having all > this "switching logic" is useful, but then: > > - I am not sure we should "hide" the details of the setup too much: > I thought `rustupoverride` would be OK-ish because the output > directory is needed (so it is justified) and the command is > straightforward, but the others do not "need" that information. Yeah; I'm a bit conflicted here as well. A part of me thinks that, if we're adding make targets, doing them for everything would be more consistent, but it does add some 'unnecessary' targets, which is probably not worth it just to look nice. > - If we include `bindgen` there, it wouldn't be `rustup`-only > anymore, so perhaps we would need another name like `rustsetup`. But > that may mislead others (e.g. those looking at the Make help), because > it is just one way of setting things up and it is not required. > Perhaps this can be alleviated by not including it in the `make help`, > so that everybody comes from the Quick Start guide and thus hopefully > they have read the document at least diagonally :) Personally, I'd love a 'make rustsetup' or similar, but I do agree it could be misleading, particularly long-term. The real advantage to it is while we're depending on unstable things and changing versions regularly. I don't think the one-off setup is tricky (and the documentation is good), it's the need to upgrade regularly (and, for per-directory overrides, possibly on several different checkouts). Having a script to 'upgrade everything to the required version' would be really convenient. > - Given there are different ways to set different sub-steps, and the > fact that we don't have such a script for C does not have (please > correct me if I am wrong -- I am aware of Thorsten's recent guide, > which covers `apt` etc., but that is a Quick Start-like approach > rather than automated script), I am not sure it would be welcome as a > Make target (but perhaps it would be fine as a script?). Masahiro may > have some guidelines here. > > - In the future we may have to change how the setup works or add > steps, i.e. it is not 100% settled. Thus I am concerned about adding > complex Make targets that users may start to depend on (i.e. with > particular/complex semantics), vs. just having docs that are manual. > For `rustupoverride`, it thought it could be OK-ish because it is just > a single command and unlikely that it will change (and if we stop > using it, we can make it empty with a warning and then remove it > eventually; while it gets harder for more complex ones). > > What do you think? Yeah, on reflection it's definitely not a good long-term solution, as ideally people will be able to just use whatever rustc version they have lying around (be it via rustup, or distro packages). Maybe what we need in the short term is an 'update-rust' script (possibly living in scripts/, possibly hosted elsewhere, like the rust-for-linux website), which just does all the steps from the Quick Start guide automatically? (Even if that's not a good solution overall, I'll probably throw one together myself just to keep my own systems up-to-date.) Still -- none of this is a blocker for this patch. Cheers, -- David
On Fri, Dec 15, 2023 at 8:27 PM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Fri, Dec 15, 2023 at 8:38 AM David Gow <davidgow@google.com> wrote: > > > > Would having similar targets for bindgen help? What about having this > > install rust-src? Updating / installing those required a lot more > > looking up of documentation (and then adding --force), so it'd be nice > > if there were some way to do a similar override or make target. > > Which docs did you need to check? i.e. we have the commands for those > steps in the Quick Start guide. I think you may be referring to the > case when switching between LTS and mainline, due to the `bindgen-cli` > vs. `bindgen` name change that the tool did (since that is where > `--force` is required, not for normal upgrading or downgrading). That > is definitely a bit painful :-( At least `cargo` mentions the need for > `--force` in that case. Or are you referring to something else? > > I considered having a `rustupsetup` target (or script) instead that > does everything (with a `BUILDONLY=1` option or similar, given some > dependencies are not strictly needed for building), since having all > this "switching logic" is useful, but then: > > - I am not sure we should "hide" the details of the setup too much: > I thought `rustupoverride` would be OK-ish because the output > directory is needed (so it is justified) and the command is > straightforward, but the others do not "need" that information. > > - If we include `bindgen` there, it wouldn't be `rustup`-only > anymore, so perhaps we would need another name like `rustsetup`. But > that may mislead others (e.g. those looking at the Make help), because > it is just one way of setting things up and it is not required. > Perhaps this can be alleviated by not including it in the `make help`, > so that everybody comes from the Quick Start guide and thus hopefully > they have read the document at least diagonally :) > > - Given there are different ways to set different sub-steps, and the > fact that we don't have such a script for C does not have (please > correct me if I am wrong -- I am aware of Thorsten's recent guide, > which covers `apt` etc., but that is a Quick Start-like approach > rather than automated script), I am not sure it would be welcome as a > Make target (but perhaps it would be fine as a script?). Masahiro may > have some guidelines here. 'make rustupoverride' potentially requires internet connection if the required rustc version is not yet installed on the system. Even if it is already installed, it changes ~/.rustup/settings.toml. If I do rustupoverride per-directory, $ make O=~/kernel/build0 rustupoverride $ make O=~/kernel/build1 rustupoverride $ make O=~/kernel/build2 rustupoverride it would accumulate the overrides entries in ~/.rustup/settings.toml Rather, I will manually do this one time for the parent directory: $ rustup override set --path=/~kernel $(scripts/min-tool-version.sh rustc) and use ~/kernel/build0, ~/kernel/build1, ~/kernel/build2 as output directories. In principle, Kbuild does not require internet connection, or proactively change the system setting. If you want to provide a way for automated settings, you can do it in a script you maintain. > - In the future we may have to change how the setup works or add > steps, i.e. it is not 100% settled. Thus I am concerned about adding > complex Make targets that users may start to depend on (i.e. with > particular/complex semantics), vs. just having docs that are manual. > For `rustupoverride`, it thought it could be OK-ish because it is just > a single command and unlikely that it will change (and if we stop > using it, we can make it empty with a warning and then remove it > eventually; while it gets harder for more complex ones). > > What do you think? > > Cheers, > Miguel -- Best Regards Masahiro Yamada
On Mon, Dec 18, 2023 at 1:10 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > In principle, Kbuild does not require internet connection, > or proactively change the system setting. Yeah, that was what I thought. I agree it can be surprising to have Make targets that modify environment/system-level bits (i.e. affecting things outside the build). > Rather, I will manually do this one time for the parent directory: That can work for many people, yeah. Though I imagine some people may want to keep builds (and sources) of different kernel versions in the same parent folder (or even other projects). But one can use nested overrides too. > If you want to provide a way for automated settings, > you can do it in a script you maintain. Sounds good. In that case, we can send to the list your patch from the `rust` branch if that is OK with you (i.e. I understand you would prefer to avoid not just `rustsetup` but also `rustupoverride`). Thanks Masahiro! Cheers, Miguel
On Mon, Dec 18, 2023 at 10:33 PM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Mon, Dec 18, 2023 at 1:10 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > In principle, Kbuild does not require internet connection, > > or proactively change the system setting. > > Yeah, that was what I thought. I agree it can be surprising to have > Make targets that modify environment/system-level bits (i.e. affecting > things outside the build). > > > Rather, I will manually do this one time for the parent directory: > > That can work for many people, yeah. Though I imagine some people may > want to keep builds (and sources) of different kernel versions in the > same parent folder (or even other projects). But one can use nested > overrides too. > > > If you want to provide a way for automated settings, > > you can do it in a script you maintain. > > Sounds good. In that case, we can send to the list your patch from the > `rust` branch if that is OK with you (i.e. I understand you would > prefer to avoid not just `rustsetup` but also `rustupoverride`). > > Thanks Masahiro! > > Cheers, > Miguel Viresh's v2 was written without relying on this patch. If that one is better described, that is OK too. -- Best Regards Masahiro Yamada
diff --git a/Makefile b/Makefile index 70fc4c11dfc0..7fe82dd4dc6f 100644 --- a/Makefile +++ b/Makefile @@ -276,7 +276,8 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers headers_% archheaders archscripts \ %asm-generic kernelversion %src-pkg dt_binding_check \ - outputmakefile rustavailable rustfmt rustfmtcheck + outputmakefile rustavailable rustfmt rustfmtcheck \ + rustupoverride no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \ image_name single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/ @@ -1611,6 +1612,7 @@ help: @echo ' (requires kernel .config; downloads external repos)' @echo ' rust-analyzer - Generate rust-project.json rust-analyzer support file' @echo ' (requires kernel .config)' + @echo ' rustupoverride - Set up a rustup override for the build directory' @echo ' dir/file.[os] - Build specified target only' @echo ' dir/file.rsi - Build macro expanded source, similar to C preprocessing.' @echo ' Run with RUSTFMT=n to skip reformatting if needed.' @@ -1735,6 +1737,11 @@ rustfmt: rustfmtcheck: rustfmt_flags = --check rustfmtcheck: rustfmt +# `rustup override` setup target +PHONY += rustupoverride +rustupoverride: + $(Q)rustup override set $(shell $(srctree)/scripts/min-tool-version.sh rustc) + # Misc # ---------------------------------------------------------------------------