Re: [PATCH V2] docs: rust: Clarify that 'rustup override' applies to build directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 14, 2023 at 2:26 PM Tiago Lam <tiagolam@xxxxxxxxx> wrote:
>
> `scripts/min-tool-version.sh` won't exist within the build dir if the
> option the user takes is "enter the kernel build directory", right? It
> only works if they use the `--path` argument in the `rustup override
> set` option.

Yeah, the script is in the source tree, and the path is the build
tree. Giving a single one-liner with `--path <builddir>` and
`<srctree>/scripts...` would be simplest in the sense that it would
allow us to remove even the "enter ..." part too. But then the command
cannot be copy-pasted and it is likely harder for newcomers that may
not be using `O=`.

Something like v1 but a bit simpler, e.g. keeping things as they are,
but with just a sentence after the command like "If you are building
the kernel with `O=`, i.e. specifying an output directory, then you
should append `--path <builddir>`." could work.

Or we could just provide a `rustupoverride` Make target to do this for
us [1], since we have all the information needed and would be
copy-pasteable by everybody. I can send it as a non-mangled patch and
then Viresh can redo this one on top using it.

Cheers,
Miguel

[1]

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
 # ---------------------------------------------------------------------------





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux