Skip to contentSkip to conversation

packagegroups: Add packagegroup-core-buildessential-rust

PATCH In review [email protected] 2 participants 6 messages Jul 17 – Aug 5

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 packagegroups: Add packagegroup-core-buildessential-rust

From: Harish Sadineni <[email protected]>

Introduce packagegroup-core-buildessential-rust to provide the on-target dependencies required for building Rust-based kernel modules, including the Rust toolchain, bindgen, and libclang.

Set PACKAGE_ARCH to TUNE_PKGARCH instead of the packagegroup default of "all", since libclang is dynamically renamed per build (e.g. libclang22.1), which is incompatible with an allarch packagegroup.

On riscv64, also pull in clang, lld, and llvm-bin, since rust support in the kernel on riscv64 requires the LLVM/Clang toolchain rather than gcc.

---
 .../packagegroup-core-buildessential-rust.bb  | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/recipes-core/packagegroups/packagegroup-core-buildessential-rust.bb
meta/recipes-core/packagegroups/packagegroup-core-buildessential-rust.bb new file +23 -0
new file mode 100644
index 0000000000..c1993af9aa
@@ -0,0 +1,23 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Essential build dependencies for building rust kernel modules in image"
+
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
+
+inherit packagegroup
+
+RDEPENDS:${PN} = "\
+    bindgen-cli \
+    libclang \
+    rust \
+    rust-src-lib \
+    rust-tools-rustfmt \
+"
+
+RDEPENDS:${PN}:append:riscv64 = "\
+    clang \
+    lld \
+    llvm-bin \
+"
Signature · 1 line
2.51.0
#1 lore raw

PATCH v2 2/4 packagegroups: add nativesdk-packagegroup-sdk-host-rust

From: Harish Sadineni <[email protected]>

Add a new nativesdk packagegroup providing the dependencies needed to build external/out-of-tree rust modules in sdk.

Set PACKAGE_ARCH to TUNE_PKGARCH instead of the packagegroup default of "all", since nativesdk-libclang is dynamically renamed per build (e.g. nativesdk-libclang22.1), which is incompatible with an allarch packagegroup.

Add this to TOOLCHAIN_HOST_TASK to include it in the SDK.

---
 .../nativesdk-packagegroup-sdk-host-rust.bb      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb new file +16 -0
new file mode 100644
index 0000000000..b10d420acd
@@ -0,0 +1,16 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Dependent packages for building external rust modules"
+
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
+
+inherit packagegroup
+inherit_defer nativesdk
+
+RDEPENDS:${PN} = "\
+    nativesdk-rust-src-lib \
+    nativesdk-bindgen-cli \
+    nativesdk-libclang \
+"
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH v2 2/4] packagegroups: add nativesdk-packagegroup-sdk-host-rust

Quoted 30 lines · On Fri, 2026-07-17 at 06:01 -0700, [email protected] wrote:

From: Harish Sadineni <[email protected]>

Add a new nativesdk packagegroup providing the dependencies needed to build external/out-of-tree rust modules in sdk.

Set PACKAGE_ARCH to TUNE_PKGARCH instead of the packagegroup default of "all", since nativesdk-libclang is dynamically renamed per build (e.g. nativesdk-libclang22.1), which is incompatible with an allarch packagegroup.

Add this to TOOLCHAIN_HOST_TASK to include it in the SDK.

---
 .../nativesdk-packagegroup-sdk-host-rust.bb      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb new file +6 -0
new file mode 100644
index 0000000000..b10d420acd
@@ -0,0 +1,16 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Dependent packages for building external rust modules"
+

meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb line 16

Quoted 10 lines
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb new file +10 -0
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
+
+inherit packagegroup
+inherit_defer nativesdk
+
+RDEPENDS:${PN} = "\
+    nativesdk-rust-src-lib \
+    nativesdk-bindgen-cli \
+    nativesdk-libclang \
+"

Hi Harish,

We've merged this patch but did have a follow-up question: should this packagegroup include dependencies on nativesdk-rustc and nativesdk-rust-tools-rustfmt? If so, please send a new patch to add them.

Best regards,

Signature · 1 line
Paul Barker
#3 lore raw

Re: [PATCH v2 2/4] packagegroups: add nativesdk-packagegroup-sdk-host-rust

Quoted 43 lines · Paul Barker
Quoted 30 lines · On Fri, 2026-07-17 at 06:01 -0700, [email protected] wrote:

From: Harish Sadineni <[email protected]>

Add a new nativesdk packagegroup providing the dependencies needed to build external/out-of-tree rust modules in sdk.

Set PACKAGE_ARCH to TUNE_PKGARCH instead of the packagegroup default of "all", since nativesdk-libclang is dynamically renamed per build (e.g. nativesdk-libclang22.1), which is incompatible with an allarch packagegroup.

Add this to TOOLCHAIN_HOST_TASK to include it in the SDK.

---
  .../nativesdk-packagegroup-sdk-host-rust.bb      | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

create mode 100644 meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb

meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb new file +6 -0
new file mode 100644
index 0000000000..b10d420acd
@@ -0,0 +1,16 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Dependent packages for building external rust modules"
+

meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb line 16

Quoted 10 lines
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-rust.bb new file +10 -0
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
+
+inherit packagegroup
+inherit_defer nativesdk
+
+RDEPENDS:${PN} = "\
+    nativesdk-rust-src-lib \
+    nativesdk-bindgen-cli \
+    nativesdk-libclang \
+"

Hi Harish,

Quoted 4 lines

We've merged this patch but did have a follow-up question: should this packagegroup include dependencies on nativesdk-rustc and nativesdk-rust-tools-rustfmt? If so, please send a new patch to add them.

Hi Paul,

nativesdk-rust and nativesdk-rust-tools-rustfmt will be added into SDK with 'packagegroup-rust-cross-canadian'. And, this packagegroup-rust-cross-canadian is not added here in this package group since it will be pulled by SDK_TOOLCHAIN_LANGS = "rust"

Thanks,
Harish

Quoted 3 lines

Best regards,

#4 lore raw

PATCH v2 3/4 packagegroups: add nativesdk-packagegroup-sdk-host-clang

In reply to [email protected]

From: Harish Sadineni <[email protected]>

Add a new nativesdk packagegroup providing the clang, lld, and llvm-bin dependencies needed to build external/out-of-tree modules in the SDK using the LLVM/Clang toolchain.

Rust support in the kernel on riscv64 requires the LLVM/Clang toolchain rather than gcc, so this packagegroup is intended to be added alongside nativesdk-packagegroup-sdk-rust when the SDK targets riscv64.

Add this to TOOLCHAIN_HOST_TASK to include it in the SDK.

---
 .../nativesdk-packagegroup-sdk-host-clang.bb       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-clang.bb
meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host-clang.bb new file +14 -0
new file mode 100644
index 0000000000..d6ee2120cf
@@ -0,0 +1,14 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+SUMMARY = "Dependent packages for building external kernel modules using clang"
+
+inherit packagegroup
+inherit_defer nativesdk
+
+RDEPENDS:${PN} = "\
+    nativesdk-clang \
+    nativesdk-lld \
+    nativesdk-llvm-bin \
+"
Signature · 1 line
2.51.0
#5 lore raw

PATCH v2 4/4 populate_sdk_base: add kernel-devsrc via SDK_TOOLCHAIN_LANGS

In reply to [email protected]

From: Harish Sadineni <[email protected]>

Add a new "kernel" value for SDK_TOOLCHAIN_LANGS that pulls kernel-devsrc into TOOLCHAIN_TARGET_TASK. This allows kernel development headers/sources to be included in the SDK.

---
 meta/classes-recipe/populate_sdk_base.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes-recipe/populate_sdk_base.bbclass +1 -0
index b427ff2761..1d9faecc16 100644
@@ -80,6 +80,7 @@ TOOLCHAIN_TARGET_TASK ?= " \
     ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \
     ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \
+    ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'kernel', 'kernel-devsrc', '', d)} \
     target-sdk-provides-dummy \
 "
 TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
Signature · 1 line
2.51.0