rust: add pin-init crate build infrastructure

Add infrastructure for moving the initialization API to its own crate.
Covers all make targets such as `rust-analyzer` and `rustdoc`. The tests
of pin-init are not added to `rusttest`, as they are already tested in
the user-space repository [1].

Link: https://github.com/Rust-for-Linux/pin-init [1]
Co-developed-by: Benno Lossin <benno.lossin@proton.me>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20250308110339.2997091-15-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
Miguel Ojeda 2025-03-08 11:05:01 +00:00
parent b321b93854
commit d7659acca7
6 changed files with 86 additions and 20 deletions

View file

@ -93,10 +93,25 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
)
crates[-1]["env"]["OBJTREE"] = str(objtree.resolve(True))
append_crate(
"pin_init_internal",
srctree / "rust" / "pin-init" / "internal" / "src" / "_lib.rs",
[],
cfg=["kernel"],
is_proc_macro=True,
)
append_crate(
"pin_init",
srctree / "rust" / "pin-init" / "src" / "_lib.rs",
["core", "pin_init_internal", "macros"],
cfg=["kernel"],
)
append_crate(
"kernel",
srctree / "rust" / "kernel" / "lib.rs",
["core", "macros", "build_error", "bindings"],
["core", "macros", "build_error", "bindings", "pin_init"],
cfg=cfg,
)
crates[-1]["source"] = {