[2/3] arm/ffa-debugfs-mod: remove kernel image runtime dependency

Message ID 20220209174610.3824795-2-ross.burton@arm.com
State New
Headers show
Series [1/3] arm/ffa-debugfs-mod: remove redundant RPROVIDES | expand

Commit Message

Ross Burton Feb. 9, 2022, 5:46 p.m. UTC
CS1K wants to put the ffa-debugfs kernel module into the initramfs, but
this pulls in the kernel image too because kernel modules depend on the
kernel image (via kernel-module-split.bbclass).  Arguably this should be
controllable somehow, as it's not mandatory to have an image on the same
file system as the modules: initramfs or separate /boot partitions being
notable cases.

Until this is resolved upstream[1] we can work around it by removing the
RDEPENDS on the kernel from the kernel module.  As the package is
generated during do_package this can't be a simple RDEPENDS:remove, but
has to be another package split function which runs after the module
splitting function.

[1] https://lore.kernel.org/openembedded-core/20220209173036.3823144-1-ross.burton@arm.com/T/#t

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../ffa-debugfs/ffa-debugfs-mod_2.1.0.bb               | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch

diff --git a/meta-arm/recipes-kernel/ffa-debugfs/ffa-debugfs-mod_2.1.0.bb b/meta-arm/recipes-kernel/ffa-debugfs/ffa-debugfs-mod_2.1.0.bb
index 4fedad1c..03ce0135 100644
--- a/meta-arm/recipes-kernel/ffa-debugfs/ffa-debugfs-mod_2.1.0.bb
+++ b/meta-arm/recipes-kernel/ffa-debugfs/ffa-debugfs-mod_2.1.0.bb
@@ -27,3 +27,13 @@  do_install:append() {
 }
 
 COMPATIBLE_HOST = "(arm|aarch64).*-linux"
+
+# Kernel modules currently RDEPEND on the kernel, which is troublesome when you want to put a
+# kernel module into a initramfs without pulling the kernel into the initramfs, which would be
+# silly.  Until this is a recommends the easiest way to handle this is to remove the dependency
+# in this recipe.
+PACKAGESPLITFUNCS:append = " remove_kernel_dependency"
+python remove_kernel_dependency() {
+  key = "RDEPENDS:kernel-module-arm-ffa-user-" + d.getVar("KERNEL_VERSION")
+  d.delVar(key)
+}