linux: add automatic selinux config selection
authorAdam Duskett <Aduskett@gmail.com>
Thu, 12 Mar 2020 18:09:08 +0000 (11:09 -0700)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 14 Mar 2020 14:36:44 +0000 (15:36 +0100)
Enabling SELinux support in the kernel requires several options, many
of which are in different areas. These options are as follows:

  - CONFIG_AUDIT
  - CONFIG_DEFAULT_SECURITY_SELINUX
  - CONFIG_INET
  - CONFIG_NET
  - CONFIG_SECURITY
  - CONFIG_SECURITY_NETWORK
  - CONFIG_SECURITY_SELINUX

As such, if a user selects the libselinux package, it is much easier
to select these options for them, much like we already do with other
packages such as systemd or iptables.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
linux/linux.mk

index 4b60f33ff35fcd2b0be1432a567f2152f754e0e8..f8c34c3dca53f65d6a7800c48d2cd17d6dfd6de5 100644 (file)
@@ -406,6 +406,14 @@ define LINUX_KCONFIG_FIXUP_CMDS
                $(call KCONFIG_ENABLE_OPT,CONFIG_FB,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224,$(@D)/.config))
+       $(if $(BR2_PACKAGE_LIBSELINUX),
+               $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_SELINUX,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_INET,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_NETWORK,$(@D)/.config)
+               $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_SELINUX,$(@D)/.config))
 endef
 
 ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)