diff mbox series

[meta-selinux,v2] enable-selinux.bbclass: enable SELinux support in native packages

Message ID 20260317202754.920902-1-hfranco@baylibre.com
State New
Headers show
Series [meta-selinux,v2] enable-selinux.bbclass: enable SELinux support in native packages | expand

Commit Message

Hiago De Franco March 17, 2026, 8:25 p.m. UTC
With SELinux enabled for the target it makes sense to have SELinux
support enabled for the native tools, too.

Note that for native packages DISTRO_FEATURES is filtered, thus up to
now it never contained "selinux". Replace the target_selinux() with
bb.utils.filter(), allowing native packages to pick up "selinux" when
DISTRO_FEATURES_FILTER_NATIVE is configured.

Document in README how to enable SELinux support for native tools by
appending "selinux" to DISTRO_FEATURES_FILTER_NATIVE.

Co-developed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Hiago De Franco <hfranco@baylibre.com>
---
Hello,

This is the v2 patch following the patch sent by Uwe [0].

v1 -> v2:
- Dropped local.conf changes.
- Added a new section to README, as asked by the v1 review.
- Commit description and title updated.

[0] https://lore.kernel.org/yocto-patches/20260213154238.4093604-2-u.kleine-koenig@baylibre.com/

Regards,
Hiago.
---
 README                         | 8 ++++++++
 classes/enable-selinux.bbclass | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/README b/README
index ae011f3..3e343fc 100644
--- a/README
+++ b/README
@@ -63,6 +63,14 @@  labeling on first boot. Set FIRST_BOOT_RELABEL to 1 in local.conf:
 
 FIRST_BOOT_RELABEL = "1"
 
+Enable SELinux support on native tools
+--------------------------------------
+By default, native tools are not built with SELinux support. With target
+support for SELinux it is very helpful during debug when the native tools
+support SELinux, too. This can be achieved, for example, by adding to
+local.conf:
+
+DISTRO_FEATURES_FILTER_NATIVE:append = " selinux"
 
 Starting up the system
 ----------------------
diff --git a/classes/enable-selinux.bbclass b/classes/enable-selinux.bbclass
index 3dc61d6..0c9f52e 100644
--- a/classes/enable-selinux.bbclass
+++ b/classes/enable-selinux.bbclass
@@ -1,3 +1,3 @@ 
 inherit selinux
 
-PACKAGECONFIG:append = " ${@target_selinux(d, 'selinux')}"
+PACKAGECONFIG:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"