Skip to content

Commit d3f21f5

Browse files
authored
Merge pull request #414 from ojeda/docs
Doc improvements
2 parents fe53313 + 9f87415 commit d3f21f5

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

Documentation/rust/coding.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ Typically, you will want to instruct your editor/IDE to format while you type,
3030
when you save or at commit time. However, if for some reason you want
3131
to reformat the entire kernel Rust sources at some point, you may run::
3232

33-
make rustfmt
33+
make LLVM=1 rustfmt
3434

3535
To check if everything is formatted (printing a diff otherwise), e.g. if you
3636
have configured a CI for a tree as a maintainer, you may run::
3737

38-
make rustfmtcheck
38+
make LLVM=1 rustfmtcheck
3939

4040
Like ``clang-format`` for the rest of the kernel, ``rustfmt`` works on
4141
individual files, and does not require a kernel configuration. Sometimes it may
@@ -49,7 +49,7 @@ While ``rustc`` is a very helpful compiler, some extra lints and analysis are
4949
available via ``clippy``, a Rust linter. To enable it, pass ``CLIPPY=1`` to
5050
the same invocation you use for compilation, e.g.::
5151

52-
make ARCH=... CROSS_COMPILE=... CC=... -j... CLIPPY=1
52+
make LLVM=1 CLIPPY=1
5353

5454
At the moment, we do not enforce a "clippy-free" compilation, so you can treat
5555
the output the same way as the extra warning levels for C, e.g. like ``W=2``.

Documentation/rust/docs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This has the added advantage that they will be tailored to your particular
3838
kernel configuration. To generate them, simply use the ``rustdoc`` target with
3939
the same invocation you use for compilation, e.g.::
4040

41-
make ARCH=... CROSS_COMPILE=... CC=... -j... rustdoc
41+
make LLVM=1 rustdoc
4242

4343

4444
Writing the docs

Documentation/rust/quick-start.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ libclang
5656
********
5757

5858
``libclang`` (part of LLVM) is used by ``bindgen`` to understand the C code
59-
in the kernel, which means you will need a recent LLVM installed; like when
59+
in the kernel, which means you will need an LLVM installed; like when
6060
you compile the kernel with ``CC=clang`` or ``LLVM=1``.
6161

6262
Your Linux distribution is likely to have a suitable one available, so it is
@@ -66,20 +66,19 @@ There are also some binaries for several systems and architectures uploaded at:
6666

6767
https://releases.llvm.org/download.html
6868

69-
For Debian-based distributions, you can also fetch them from:
70-
71-
https://apt.llvm.org
72-
7369
Otherwise, building LLVM takes quite a while, but it is not a complex process:
7470

7571
https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm
7672

73+
See Documentation/kbuild/llvm.rst for more information and further ways
74+
to fetch pre-built releases and distribution packages.
75+
7776

7877
bindgen
7978
*******
8079

8180
The bindings to the C side of the kernel are generated at build time using
82-
the ``bindgen`` tool. A recent version should work, e.g. ``0.56.0``.
81+
the ``bindgen`` tool. The version we currently support is ``0.56.0``.
8382

8483
Install it via (this will build the tool from source)::
8584

@@ -184,14 +183,14 @@ And enable some sample modules either as built-in or as loadable.
184183
Building
185184
--------
186185

187-
Building a kernel with Clang or a complete LLVM toolchain is the best supported
188-
setup at the moment. That is::
186+
Building a kernel with a complete LLVM toolchain is the best supported setup
187+
at the moment. That is::
189188

190-
make ARCH=... CROSS_COMPILE=... CC=clang -j...
189+
make LLVM=1
191190

192-
or::
191+
For architectures that do not support a full LLVM toolchain, use::
193192

194-
make ARCH=... CROSS_COMPILE=... LLVM=1 -j...
193+
make CC=clang
195194

196195
Using GCC also works for some configurations, but it is *very* experimental at
197196
the moment.
@@ -209,7 +208,7 @@ is your toolchain doesn't support Rust's new v0 mangling scheme yet. There are
209208
a few ways out:
210209

211210
- If you don't mind building your own tools, we provide the following fork
212-
with the support cherry-picked from GCC on top of very recent releases:
211+
with the support cherry-picked from GCC:
213212

214213
https://github.com/Rust-for-Linux/binutils-gdb/releases/tag/gdb-10.1-release-rust
215214
https://github.com/Rust-for-Linux/binutils-gdb/releases/tag/binutils-2_35_1-rust

0 commit comments

Comments
 (0)