Skip to contentSkip to conversation

kernel-kfrag: add new class

PATCH Superseded Armin Kuster 2 participants 5 messages May 30, 2021 – May 31, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kernel-kfrag: add new class

This provides a common place to define kernel fragments that may be usefull to the larger community.

---
 meta/classes/kernel-kfrag.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 meta/classes/kernel-kfrag.bbclass
meta/classes/kernel-kfrag.bbclass new file +8 -0
new file mode 100644
index 00000000000..c0c5667b519
@@ -0,0 +1,8 @@
+#
+# Class to place yocto-kernel-cache fragments
+# selections usfull to anyone
+#
+
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "apparmor", " features/apparmor/apparmor.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "smack", " features/smack/smack.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "dm-verity", " features/device-mapper/dm-verity.scc", "" ,d)}"
Signature · 1 line
2.24.3
#1 lore raw

PATCH 2/2 kernel.bbclass: include kernel-kfrag

---
 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +1 -1
index 8693ab86be8..ea2b037d2e0 100644
@@ -1,4 +1,4 @@
-inherit linux-kernel-base kernel-module-split
+inherit linux-kernel-base kernel-module-split kernel-frag
 
 COMPATIBLE_HOST = ".*-linux"
 
Signature · 1 line
2.24.3
#2 lore raw
In reply to Armin Kuster
Quoted 3 lines · Armin Kuster

This provides a common place to define kernel fragments that may be usefull to the larger community.

Not a bad idea at all, but what about calling the class "kernel-features", versus kfrag ? That describes the purpose, versus what the mechanism does.

A 2nd suggestion would be to bbwarn if this is inherited, but kernel-yocto is not.

Note: as mentioned during the yocto summit, I do have patches that make fragments more universally available, when I get them ready, we could remove the bbwarn.

Bruce

Quoted 27 lines
---
 meta/classes/kernel-kfrag.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 meta/classes/kernel-kfrag.bbclass
meta/classes/kernel-kfrag.bbclass new file +8 -1
new file mode 100644
index 00000000000..c0c5667b519
@@ -0,0 +1,8 @@
+#
+# Class to place yocto-kernel-cache fragments
+# selections usfull to anyone
+#
+
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "apparmor", " features/apparmor/apparmor.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "smack", " features/smack/smack.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "dm-verity", " features/device-mapper/dm-verity.scc", "" ,d)}"
--

2.24.3

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#3 lore raw
Quoted 6 lines · Bruce Ashfield
Quoted 2 lines · Armin Kuster

This provides a common place to define kernel fragments that may be usefull to the larger community.

Not a bad idea at all, but what about calling the class "kernel-features", versus kfrag ? That describes the purpose, versus what the mechanism does.

works for me.

Quoted 3 lines

A 2nd suggestion would be to bbwarn if this is inherited, but kernel-yocto is not.

seems reasonable.  I did wonder the best place to place for thie. The kernel cache can be used w/o linux-yocto.

Quoted 4 lines

Note: as mentioned during the yocto summit, I do have patches that make fragments more universally available, when I get them ready, we could remove the bbwarn.

Would those patches eliminate the need for a class like this?

-armin

Quoted 30 lines

Bruce

Quoted 26 lines
---
 meta/classes/kernel-kfrag.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 meta/classes/kernel-kfrag.bbclass
meta/classes/kernel-kfrag.bbclass new file +8 -1
new file mode 100644
index 00000000000..c0c5667b519
@@ -0,0 +1,8 @@
+#
+# Class to place yocto-kernel-cache fragments
+# selections usfull to anyone
+#
+
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "apparmor", " features/apparmor/apparmor.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "smack", " features/smack/smack.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "dm-verity", " features/device-mapper/dm-verity.scc", "" ,d)}"
--

2.24.3

#4 lore raw
Quoted 10 lines · On Sun, May 30, 2021 at 4:54 PM akuster808 <[email protected]> wrote:
Quoted 6 lines · Bruce Ashfield
Quoted 2 lines · Armin Kuster

This provides a common place to define kernel fragments that may be usefull to the larger community.

Not a bad idea at all, but what about calling the class "kernel-features", versus kfrag ? That describes the purpose, versus what the mechanism does.

Quoted 6 lines

works for me.

Quoted 3 lines

A 2nd suggestion would be to bbwarn if this is inherited, but kernel-yocto is not.

seems reasonable. I did wonder the best place to place for thie. The kernel cache can be used w/o linux-yocto.

True that it can be, but we don't have a universal way to detect fragment merging ... and as we all know, the implementations are all over the place.

I'd suggest that as a starting point, check for kernel-yocto, and we could enhance the check in the future if there are other kernel recipes that are doing merging, that also want to use this.

There's lots of other checks that we could do about kernel/machine/version combinations, etc (and in fact, i have an old bugzilla for them somewhere), but I'd stick with simple first .. and then we can see what makes sense to incrementally add.

Quoted 6 lines
Quoted 4 lines

Note: as mentioned during the yocto summit, I do have patches that make fragments more universally available, when I get them ready, we could remove the bbwarn.

Would those patches eliminate the need for a class like this?

Nope. They just drive the fragment operations into kernel.bbclass and only enable it when a .cfg/.scc are detected in the SRC_URI (so as to not impact class/standard kernel recipes). This is just delivering a fragment to that operation, so the class would still do the same job.

Bruce

Quoted 32 lines

-armin

Quoted 30 lines

Bruce

Quoted 26 lines
---
 meta/classes/kernel-kfrag.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 meta/classes/kernel-kfrag.bbclass
meta/classes/kernel-kfrag.bbclass new file +8 -1
new file mode 100644
index 00000000000..c0c5667b519
@@ -0,0 +1,8 @@
+#
+# Class to place yocto-kernel-cache fragments
+# selections usfull to anyone
+#
+
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "apparmor", " features/apparmor/apparmor.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "smack", " features/smack/smack.scc", "" ,d)}"
+KERNEL_FEATURES_append = " ${@bb.utils.contains("DISTRO_FEATURES", "dm-verity", " features/device-mapper/dm-verity.scc", "" ,d)}"
--

2.24.3

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II