From: Yoann Congal <[email protected]>

Publish artifacts from kernel compilation to allow out-of-tree Rust
compilation:
* scripts/target.json: target definition: architecture, ABI, compiler
  options, ...
* rust/: the crates compiled by the kernel available to
  out-of-tree-modules

Signed-off-by: Yoann Congal <[email protected]>
---
 meta/classes-recipe/kernel.bbclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/meta/classes-recipe/kernel.bbclass 
b/meta/classes-recipe/kernel.bbclass
index 003a155e794..a9a25b9819a 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -631,6 +631,24 @@ do_shared_workdir () {
                cp -r scripts/gcc-plugins ${kerneldir}/scripts
        fi
 
+    if ${@bb.utils.contains("DISTRO_FEATURES", "rust-kernel", "true", "false", 
d)}; then
+        # Copy target.json file needed for out-of-tree rust modules
+        if [ -e scripts/target.json ]; then
+            bbnote "Copying scripts/target.json"
+            mkdir -p ${kerneldir}/scripts
+            cp scripts/target.json ${kerneldir}/scripts
+        else
+            bbwarn "scripts/target.json not found in compiled kernel. 
Out-of-tree rust modules will fail to build."
+        fi
+
+        # Copy rust/ needed by out-of-tree module (firstly for the core rust 
crate)
+        if [ -e rust/ ]; then
+            bbnote "Copying rust/"
+            cp -r rust ${kerneldir}/
+        else
+            bbwarn "rust/ not found in compiled kernel. Out-of-tree rust 
modules will fail to build."
+        fi
+    fi
 }
 
 # We don't need to stage anything, not the modules/firmware since those would 
clash with linux-firmware
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#226582): 
https://lists.openembedded.org/g/openembedded-core/message/226582
Mute This Topic: https://lists.openembedded.org/mt/116380210/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to