summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2026-06-08 16:14:31 +0200
committerMiguel Ojeda <ojeda@kernel.org>2026-06-09 04:13:22 +0200
commit567621523ab7a2bc4a923757cba30bde8900447a (patch)
tree632c2949c8cd1c2148d18e286c62bad0303d2a77 /scripts
parentb0d90bdcaa969d2ccd8d5e3104653a7f92583e60 (diff)
downloadlwn-567621523ab7a2bc4a923757cba30bde8900447a.tar.gz
lwn-567621523ab7a2bc4a923757cba30bde8900447a.zip
rust: zerocopy: enable support in kbuild
With all the new files in place and ready from the new crate, enable the support for it in the build system. In addition, skip formatting for this vendored crate. Finally, there are no generated symbols expected from `zerocopy`, thus skip adding the `exports` generation. Link: https://patch.msgid.link/20260608141439.182634-13-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build1
-rwxr-xr-xscripts/generate_rust_analyzer.py10
2 files changed, 9 insertions, 2 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 3498d25b15e8..ddf0461dda6a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -329,6 +329,7 @@ rust_common_cmd = \
-Zcrate-attr=no_std \
-Zcrate-attr='feature($(rust_allowed_features))' \
-Zunstable-options --extern pin_init --extern kernel \
+ --extern zerocopy \
--crate-type rlib -L $(objtree)/rust/ \
--sysroot=/dev/null \
--out-dir $(dir $@) --emit=dep-info=$(depfile)
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index 2477209e1e94..80f7647f633a 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -276,6 +276,12 @@ def generate_crates(
[core, compiler_builtins],
)
+ zerocopy = append_crate(
+ "zerocopy",
+ srctree / "rust" / "zerocopy" / "src" / "lib.rs",
+ [core, compiler_builtins],
+ )
+
def append_crate_with_generated(
display_name: str,
deps: List[Dependency],
@@ -304,7 +310,7 @@ def generate_crates(
bindings = append_crate_with_generated("bindings", [core, ffi, pin_init])
uapi = append_crate_with_generated("uapi", [core, ffi, pin_init])
kernel = append_crate_with_generated(
- "kernel", [core, macros, build_error, pin_init, ffi, bindings, uapi]
+ "kernel", [core, macros, build_error, pin_init, ffi, bindings, uapi, zerocopy]
)
scripts = srctree / "scripts"
@@ -349,7 +355,7 @@ def generate_crates(
append_crate(
crate_name,
path,
- [core, kernel, pin_init],
+ [core, kernel, pin_init, zerocopy],
cfg=generated_cfg,
)