Refactor kernel configuration fragment handling 60/26460/2
authorScott Murray <scott.murray@konsulko.com>
Sun, 27 Jun 2021 18:36:00 +0000 (14:36 -0400)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tue, 29 Jun 2021 21:31:01 +0000 (21:31 +0000)
Refactor the kernel configuration fragment handling to shift all AGL
applied configuration fragments into a new AGL_KCONFIG_FRAGMENTS
variable that is used to generate SRC_URI and KERNEL_CONFIG_FRAGMENTS
additions for the various BSPs.  The intent is to make it simple to
disable AGL provided configuration in downstream builds as the IC EG
has expressed as a requirement.  Additionally, the rework has allowed
for some clean up of accumulated cruft.

In practice, clearing AGL_KCONFIG_FRAGMENTS drops all non-BSP provided
kernel configuration with the exception of some qemu BSP related
additions required for AGL CI and some explicitly configurable things
like netboot support.

Notable changes:
- Instead of always using AGL's own fragment merging logic on top of
  the BSP kernel recipe, an effort is now made to leverage the BSP
  recipes' own merging schemes, so there are now separate include
  files for kernel-yocto.bbclass and plain kernel.bbclass based kernel
  recipes, as well as a common include file that defines the
  AGL_KCONFIG_FRAGMENTS variable and its derivations.  That file can
  be included directly in bbappends for BSP kernel recipes that use
  the KERNEL_CONFIG_FRAGMENTS scheme (e.g. meta-ti, meta-qcom).
- The SMACK enabling configuration in meta-app-framework has been
  updated to supply different fragments for enabling SMACK by default
  for 4.x and 5.x kernels.  This removes a warning from always
  supplying the old configuration, and allows providing a CONFIG_LSM
  definition to ensure over-riding any BSP modifications.
  This allows removing the previous hack to handle CONFIG_LSM being
  set in the defconfigs in linux-raspberrypi.
- By request, the linux-yocto support from meta-agl-bsp/meta-core has
  been rationalized into meta-agl-core to improve the experience when
  using meta-agl-core standalone for testing.
- All demo supporting kernel configuration has been removed, a
  subsequent change to meta-agl-demo will add it there by leveraging
  AGL_KCONFIG_FRAGMENTS.
- The hardware device support has been split out of the can-bus.cfg
  fragment, in favor of shifting it to meta-agl-demo.  A few other
  stray non-CAN configuration options have also been removed from
  can-bus.cfg, as they do not seem to be required.

Bug-AGL: SPEC-3983

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: If6662fd36e26cec767b1d53b1188a74d01ef9dcf
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26460
Reviewed-by: Hiroyuki Ishii <ishii.hiroyuki002@jp.panasonic.com>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account

43 files changed:
meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/hciattach.cfg [deleted file]
meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/most_deps.cfg [deleted file]
meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_%.bbappend [deleted file]
meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_agl.inc [deleted file]
meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend
meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc_%.bbappend
meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_%.bbappend
meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/disable_most.cfg [deleted file]
meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_%.bbappend
meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend
meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe_%.bbappend
meta-agl-bsp/meta-synopsys/recipes-kernel/linux-yocto_%.bbappend
meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend
meta-agl-core/recipes-kernel/linux/linux-agl-config.inc [new file with mode: 0644]
meta-agl-core/recipes-kernel/linux/linux-agl.inc
meta-agl-core/recipes-kernel/linux/linux-yocto-agl.inc [new file with mode: 0644]
meta-agl-core/recipes-kernel/linux/linux-yocto_%.bbappend [new file with mode: 0644]
meta-agl-core/recipes-kernel/linux/linux/btusb.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/can-bus.cfg
meta-agl-core/recipes-kernel/linux/linux/hid.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/i2c-led.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/iiodevice.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/joystick.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/netfilter.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/nfc.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/procevent.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/qemu-drm.cfg [moved from meta-agl-core/recipes-kernel/linux/linux/drm.cfg with 100% similarity]
meta-agl-core/recipes-kernel/linux/linux/qemu-virtio.cfg [moved from meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/virtio.cfg with 100% similarity]
meta-agl-core/recipes-kernel/linux/linux/qemuarm.cfg [moved from meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/qemuarm.cfg with 100% similarity]
meta-agl-core/recipes-kernel/linux/linux/rtc.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/rtl_sdr.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/scheddebug.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/uinput.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/usb.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/usbaudio.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/usbmodem.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/uvc.cfg [deleted file]
meta-agl-core/recipes-kernel/linux/linux/wifi.cfg [deleted file]
meta-app-framework/recipes-kernel/linux/linux-%.bbappend
meta-app-framework/recipes-kernel/linux/linux-appfw.inc
meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg [new file with mode: 0644]
meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm.cfg

diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/hciattach.cfg b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/hciattach.cfg
deleted file mode 100755 (executable)
index c9c4fe2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_INTEL=m
-CONFIG_BT_BCM=m
-CONFIG_BT_RTL=m
-CONFIG_BT_HCIBTUSB=m
-CONFIG_BT_HCIBTUSB_BCM=y
-CONFIG_BT_HCIBTUSB_RTL=y
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-
-#
-# USB port drivers
-#
-CONFIG_USB_SERIAL_CP210X=y
diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/most_deps.cfg b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto/most_deps.cfg
deleted file mode 100644 (file)
index 15ddbd2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG_I2C=y
-CONFIG_USB=y
-CONFIG_MEDIA_SUPPORT=m
-CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
-CONFIG_MEDIA_CONTROLLER=y
-CONFIG_VIDEO_DEV=m
-CONFIG_VIDEO_V4L2_SUBDEV_API=y
-CONFIG_VIDEO_V4L2=m
diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_%.bbappend
deleted file mode 100644 (file)
index 3d5903d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', '${BPN}_agl.inc', '', d)}
diff --git a/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_agl.inc b/meta-agl-bsp/meta-core/recipes-kernel/linux/linux-yocto_agl.inc
deleted file mode 100644 (file)
index 30e656b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:"
-
-
-require recipes-kernel/linux/linux-agl.inc
-
-# Extra configuration options for the QEMU kernel
-SRC_URI += "file://hciattach.cfg \
-           file://virtio.cfg \
-            "
-
-# Enable some things on qemuarm64 so MOST drivers will build and load.
-SRC_URI_append_qemuarm64 = " file://most_deps.cfg"
-
-# Configuration for using the virt machine (and not versatilepb)
-SRC_URI_append_qemuarm = " file://qemuarm.cfg"
-
-# Build a generic v7 kernel instead of the arm926j one that upstream
-# qemuarm defaults to.
-KBUILD_DEFCONFIG_qemuarm = "multi_v7_defconfig"
-KCONFIG_MODE = "--alldefconfig"
-
index 549ba39..c6f60d3 100644 (file)
@@ -1,6 +1,6 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:${THISDIR}/files:"
 
-require recipes-kernel/linux/linux-agl.inc
+require recipes-kernel/linux/linux-yocto-agl.inc
 
 # These patches and the configuration fragment below will need to be
 # revisited if/when using IMX_DEFAULT_BSP = "mainline" with i.MX8
@@ -10,27 +10,22 @@ SRC_URI_append_etnaviv = " \
     file://0002-dts-enable-etnaviv.patch \
 "
 
-# Make sure these are enabled so that AGL configurations work
-SRC_URI_append = " file://tmpfs.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/tmpfs.cfg"
-SRC_URI_append = " file://namespace.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/namespace.cfg"
-SRC_URI_append = " file://cgroup.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cgroup.cfg"
+# Make sure these are enabled so that AGL systemd configuration works
+AGL_KCONFIG_FRAGMENTS += " \
+    tmpfs.cfg \
+    namespace.cfg \
+    cgroup.cfg \
+"
 
 # Support for CFG80211 subsystem
-SRC_URI_append = " file://cfg80211.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cfg80211.cfg"
+AGL_KCONFIG_FRAGMENTS += "cfg80211.cfg"
+
+# Turn off a couple of things enabled by default by Freescale
+# (lock debugging and userspace firmware loader fallback)
+AGL_KCONFIG_FRAGMENTS += "fixups.cfg"
 
 # Support for i.MX8MQ EVKB (e.g. Broadcom wifi)
-SRC_URI_append_imx8mqevk = " file://imx8mq-evkb.cfg"
-KERNEL_CONFIG_FRAGMENTS_append_imx8mqevk = " ${WORKDIR}/imx8mq-evkb.cfg"
+AGL_KCONFIG_FRAGMENTS_append_imx8mqevk = " imx8mq-evkb.cfg"
 
 # Build in etnaviv if required
-SRC_URI_append_etnaviv = " file://etnaviv.cfg"
-KERNEL_CONFIG_FRAGMENTS_append_etnaviv = " ${WORKDIR}/etnaviv.cfg"
-
-# Turn off a couple of things enabled by default by Freescale
-# (lock debugging and userspace firmware loader fallback)
-SRC_URI_append = " file://fixups.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/fixups.cfg"
+AGL_KCONFIG_FRAGMENTS_append_etnaviv = " etnaviv.cfg"
index 640f9cf..95f764b 100644 (file)
@@ -1,23 +1,20 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
-require recipes-kernel/linux/linux-agl.inc
+require recipes-kernel/linux/linux-yocto-agl.inc
 
-# Make sure these are enabled so that AGL configurations work
-SRC_URI_append = " file://tmpfs.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/tmpfs.cfg"
-SRC_URI_append = " file://namespace.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/namespace.cfg"
-SRC_URI_append = " file://cgroup.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cgroup.cfg"
+# Make sure these are enabled so that AGL systemd configuration works
+AGL_KCONFIG_FRAGMENTS += " \
+    tmpfs.cfg \
+    namespace.cfg \
+    cgroup.cfg \
+"
 
 # Support for CFG80211 subsystem
-SRC_URI_append = " file://cfg80211.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cfg80211.cfg"
+AGL_KCONFIG_FRAGMENTS += "cfg80211.cfg"
 
 # Turn off a couple of things enabled by default by Freescale
 # (lock debugging and userspace firmware loader fallback)
-SRC_URI_append = " file://fixups.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/fixups.cfg"
+AGL_KCONFIG_FRAGMENTS += "fixups.cfg"
 
 do_install_append_cubox-i() {
     # Add symlink to work with default Hummingboard 2 u-boot configuration
index 5069e1e..75ef03b 100644 (file)
@@ -1,24 +1,33 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
 
-require recipes-kernel/linux/linux-agl.inc
+require recipes-kernel/linux/linux-yocto-agl.inc
 
-SRC_URI_append = "\
+SRC_URI_append = " \
     ${@oe.utils.conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \
     file://0001-mconf-menuconfig.patch \
 "
 
+# Enable support for Pi foundation touchscreen
+AGL_KCONFIG_FRAGMENTS += "raspberrypi-panel.cfg"
+
+# Enable bt hci uart
+AGL_KCONFIG_FRAGMENTS += "raspberrypi-hciuart.cfg"
+
+# ENABLE NETWORK (built-in)
+AGL_KCONFIG_FRAGMENTS += "raspberrypi_network.cfg"
+
 # For Xen
-SRC_URI_append = "\
-    ${@bb.utils.contains('AGL_XEN_WANTED','1','file://xen-be.cfg','',d)} \
+AGL_KCONFIG_FRAGMENTS += " \
+    ${@bb.utils.contains('AGL_XEN_WANTED','1','xen-be.cfg','',d)} \
 "
 
-#take in account that linux under xen should use the hvc0 console
+# Take in account that linux under Xen should use the hvc0 console
 SERIAL_OPTION = "${@bb.utils.contains('AGL_XEN_WANTED','1','hvc0','ttyS0,115200',d)}"
 SERIAL = "${@oe.utils.conditional("ENABLE_UART", "1", "console=${SERIAL_OPTION}", "", d)}"
 
 CMDLINE_DEBUG = ""
 
-# XEN related option
+# Xen related option
 CMDLINE_append = ' ${@bb.utils.contains('AGL_XEN_WANTED','1','clk_ignore_unused','',d)}'
 
 # Workaround for crash during brcmfmac loading. Disable it at this moment
@@ -32,23 +41,6 @@ CMDLINE_append = '${@oe.utils.conditional("ENABLE_CMA", "1", " coherent_pool=6M
 KERNEL_MODULE_AUTOLOAD += "snd-bcm2835"
 KERNEL_MODULE_AUTOLOAD += "hid-multitouch"
 
-RDEPENDS_${PN} += "kernel-module-snd-bcm2835"
 PACKAGES += "kernel-module-snd-bcm2835"
 
-# Enable support for usb video class for usb camera devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/uvc.cfg"
-
-# Enable support for joystick devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/joystick.cfg"
-
-# Enable support for Pi foundation touchscreen
-SRC_URI_append = " file://raspberrypi-panel.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/raspberrypi-panel.cfg"
-
-# Enable bt hci uart
-SRC_URI_append = " file://raspberrypi-hciuart.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/raspberrypi-hciuart.cfg"
-
-# ENABLE NETWORK (built-in)
-SRC_URI_append = " file://raspberrypi_network.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/raspberrypi_network.cfg"
+RDEPENDS_${PN} += "kernel-module-snd-bcm2835"
diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/disable_most.cfg b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/disable_most.cfg
deleted file mode 100644 (file)
index 4179e25..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# CONFIG_STAGING is not set
-# CONFIG_MOST is not set
-# CONFIG_MOSTCORE is not set
-# CONFIG_AIM_CDEV is not set
-# CONFIG_AIM_NETWORK is not set
-# CONFIG_AIM_SOUND is not set
-# CONFIG_AIM_V4L2 is not set
-# CONFIG_HDM_DIM2 is not set
-
index def762b..d6c1014 100644 (file)
@@ -2,7 +2,6 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
 SRC_URI_append_ulcb = " \
     file://0001-arm64-dts-renesas-preserve-drm-HDMI-connector-naming.patch \
-    file://disable_most.cfg \
 "
 
 KERNEL_DEVICETREE_remove_h3ulcb = " \
index 12054df..68ff69b 100644 (file)
@@ -1,18 +1,17 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
-require recipes-kernel/linux/linux-agl.inc
-
-SRC_URI_append  = " file://namespace_fix.cfg \
-    "
+require recipes-kernel/linux/linux-yocto-agl.inc
 
 # Add ADSP patch to enable and add sound hardware abstraction
 SRC_URI_append = " \
     file://0004-ADSP-enable-and-add-sound-hardware-abstraction.patch \
 "
 
+AGL_KCONFIG_FRAGMENTS += "namespace_fix.cfg"
+
 # For Xen
-SRC_URI_append = " \
-    ${@bb.utils.contains('AGL_XEN_WANTED','1','file://xen-be.cfg','',d)} \
+AGL_KCONFIG_FRAGMENTS += " \
+    ${@bb.utils.contains('AGL_XEN_WANTED','1','xen-be.cfg','',d)} \
 "
 SRC_URI_append_m3ulcb = " \
     ${@bb.utils.contains('AGL_XEN_WANTED','1','file://r8a7796-m3ulcb-xen.dts;subdir=git/arch/${ARCH}/boot/dts/renesas','',d)} \
index 6c15b16..fcd0e8c 100644 (file)
@@ -2,4 +2,4 @@ require recipes-kernel/linux/linux-agl.inc
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
 
-SRC_URI += "file://cma-256.cfg"
+AGL_KCONFIG_FRAGMENTS += "cma-256.cfg"
diff --git a/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc b/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc
new file mode 100644 (file)
index 0000000..4003dd9
--- /dev/null
@@ -0,0 +1,85 @@
+# Common include file that defines AGL's variables for kernel
+# configuration.
+#
+# Can be included directly for kernel.bbclass based recipes that
+# use their own config fragment merging scheme, or use the
+# KERNEL_CONFIG_FRAGMENTS variable (e.g. meta-ti, meta-qcom).
+#
+# Fragments should be added to AGL_KCONFIG_FRAGMENTS as just the
+# .cfg filename with +=.  Appending to AGL_KCONFIG_FRAGMENTS (i.e.
+# using _append) should only be done for:
+# - Specific AGL features that set an override in their feature
+#   template, e.g. agl-netboot.
+# - To add essential configuration for core target machines like
+#   qemu.  Note that appending fragments directly to SRC_URI
+#   would work for qemu targets since they use linux-yocto, but
+#   the AGL_KCONFIG_FRAGMENTS mechanism is recommended for
+#   consistency and to preserve the option of disabling all AGL
+#   additions by overriding AGL_KERNEL_SRC.
+#
+# In general, care shoud be taken to preserve the ability to set
+# AGL_KCONFIG_FRAGMENTS to "" to disable non-essential (from a build
+# perspective) AGL additions.
+#
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
+
+# NOTE: AGL_KERNEL_SRC is explicitly intended as an intermediate variable
+#       that can be used as a last resort to completely disable all AGL
+#       additions, modifying or appending it is not recommended.
+AGL_KERNEL_SRC ?= "${@' '.join(['file://' + x for x in d.getVar('AGL_KCONFIG_FRAGMENTS').split()])}"
+
+SRC_URI_append = " ${AGL_KERNEL_SRC}"
+
+# For meta-ti and meta-qcom
+KERNEL_CONFIG_FRAGMENTS ?= "${@' '.join(['${WORKDIR}/' + x for x in d.getVar('AGL_KCONFIG_FRAGMENTS').split()])}"
+
+# Extra configuration options for the AGL kernel
+AGL_KCONFIG_FRAGMENTS += " \
+    can-bus.cfg \
+    fanotify.cfg \
+    overlayfs.cfg \
+"
+
+AGL_KCONFIG_FRAGMENTS += " ${@bb.utils.contains('AGL_XEN_GUEST_WANTED','1','xen_domu.cfg','',d)}"
+
+# Base ALSA support and other sound related configuration
+AGL_KCONFIG_FRAGMENTS += "sound.cfg"
+
+# Enable support for SystemTap
+AGL_KCONFIG_FRAGMENTS += "${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'systemtap.cfg', '', d)}"
+
+#
+# Feature override and qemu specific appends:
+#
+
+# Enable required features for the agl-netboot feature
+AGL_KCONFIG_FRAGMENTS_append_netboot = " \
+    nbd.cfg \
+    ramdisk.cfg \
+"
+
+# Add hda audio and required virtio device support for qemu
+AGL_KCONFIG_FRAGMENTS_append_qemuall = " \
+    sound-hda.cfg \
+    qemu-virtio.cfg \
+    qemu-drm.cfg \
+"
+
+# Configuration for using the ARM virt machine (and not versatilepb)
+AGL_KCONFIG_FRAGMENTS_append_qemuarm = " qemuarm.cfg"
+
+# Additional drivers for virtual machines
+# OVERRIDES save us some c'n'p below ...
+OVERRIDES_prepend_qemux86 = "virtualmachine:"
+OVERRIDES_prepend_qemux86-64 = "virtualmachine:"
+AGL_KCONFIG_FRAGMENTS_append_virtualmachine = " vbox-vmware-sata.cfg"
+
+# Extra configuration for using qemux86-64 image on physical hardware
+AGL_KCONFIG_FRAGMENTS_append_qemux86-64 = " \
+    x86-extra-graphic-devices.cfg \
+    x86-net-devices.cfg \
+    x86-security-tpm.cfg \
+    x86-usb-devices.cfg \
+    x86-upsquare.cfg \
+"
index cd960ef..547c239 100644 (file)
@@ -1,7 +1,10 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
+# Include file intended for kernel.bbclass based recipes that do not
+# have their own config fragment merging scheme.
 
 DEPENDS += "kern-tools-native"
 
+include linux-agl-config.inc
+
 # returns all the elements from the src uri that are .cfg files
 def find_cfgs(d):
     sources=src_patches(d, True)
@@ -13,120 +16,9 @@ def find_cfgs(d):
     return sources_list
 
 do_configure_append () {
-    [ ! -f .config ] && cp -a ${WORKDIR}/defconfig .config
-    # Need to clear CONFIG_LSM for 5.1+ kernels to ensure it'll get
-    # regenerated to reflect configuration changes (e.g. SMACK).
-    sed -i '/^CONFIG_LSM/d' .config
-    merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
-    yes '' | make oldconfig
+    if [ -n "${AGL_KCONFIG_FRAGMENTS}" ]; then
+        [ ! -f .config ] && cp -a ${WORKDIR}/defconfig .config
+        merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
+        yes '' | make oldconfig
+    fi
 }
-
-# Extra configuration options for the AGL kernel
-SRC_URI_append = "\
-            file://can-bus.cfg \
-            file://usb.cfg \
-            file://uvc.cfg \
-            file://joystick.cfg \
-            file://fanotify.cfg \
-            file://uinput.cfg \
-            file://hid.cfg \
-            file://drm.cfg \
-            file://btusb.cfg \
-            file://usbaudio.cfg \
-            file://usbmodem.cfg \
-            file://i2c-led.cfg \
-            file://nfc.cfg \
-            file://overlayfs.cfg \
-        "
-
-SRC_URI_append = " ${@bb.utils.contains('AGL_XEN_GUEST_WANTED','1','file://xen_domu.cfg','',d)}"
-
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/can-bus.cfg"
-# Enable support for usb video class for usb camera devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/uvc.cfg"
-# Enable support for joystick devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/joystick.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/fanotify.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/uinput.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/hid.cfg"
-# Enable DRM support for graphics
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/drm.cfg"
-# Enable Bluetooth USB devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/btusb.cfg"
-# Enable USB audio devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/usbaudio.cfg"
-# Enable I2C and LED for demontrator
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/i2c-led.cfg"
-# Enable NFC devices
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/nfc.cfg"
-# Enable overlayfs filesystem support
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/overlayfs.cfg"
-# Enable XEN support of the guest
-KERNEL_CONFIG_FRAGMENTS_append = " ${@bb.utils.contains('AGL_XEN_GUEST_WANTED','1','${WORKDIR}/xen_domu.cfg','',d)}"
-
-# Enable required features for the agl-netboot feature
-SRC_URI_append_netboot = " file://nbd.cfg \
-       file://ramdisk.cfg"
-KERNEL_CONFIG_FRAGMENTS_append_netboot = " ${WORKDIR}/nbd.cfg ${WORKDIR}/ramdisk.cfg"
-
-# Enable support for TP-Link TL-W722N USB Wifi adapter (rev 1 and 2)
-SRC_URI_append = " file://wifi.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/wifi.cfg"
-
-# Enable support for RTLSDR
-SRC_URI_append = " file://rtl_sdr.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/rtl_sdr.cfg"
-
-# Additional drivers for virtual machines
-# OVERRIDES save us some c'n'p below ...
-OVERRIDES_prepend_qemux86 = "virtualmachine:"
-OVERRIDES_prepend_qemux86-64 = "virtualmachine:"
-SRC_URI_append_virtualmachine = " file://vbox-vmware-sata.cfg"
-KERNEL_CONFIG_FRAGMENTS_append_virtualmachine = " ${WORKDIR}/vbox-vmware-sata.cfg"
-
-# Extra configuration for using qemux86-64 image on physical hardware
-SRC_URI_append_qemux86-64 = "\
-    file://x86-extra-graphic-devices.cfg \
-    file://x86-net-devices.cfg \
-    file://x86-security-tpm.cfg \
-    file://x86-usb-devices.cfg \
-    file://x86-upsquare.cfg \
-"
-KERNEL_CONFIG_FRAGMENTS_append_qemux86-64 = "\
-    ${WORKDIR}/x86-extra-graphic-devices.cfg \
-    ${WORKDIR}/x86-net-devices.cfg \
-    ${WORKDIR}/x86-security-tpm.cfg \
-    ${WORKDIR}/x86-usb-devices.cfg \
-    ${WORKDIR}/x86-upsquare.cfg \
-"
-
-# Enable support for smack
-KERNEL_CONFIG_FRAGMENTS_append_with-lsm-smack = "\
-       ${WORKDIR}/audit.cfg \
-       ${WORKDIR}/smack.cfg \
-       ${WORKDIR}/smack-default-lsm.cfg \
-"
-
-# ALSA support and other sound related configuration
-SRC_URI_append = " file://sound.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/sound.cfg"
-
-# add hda audio for qemu
-SRC_URI_append_qemuall = " file://sound-hda.cfg"
-KERNEL_CONFIG_FRAGMENTS_append_qemuall = " ${WORKDIR}/sound-hda.cfg"
-
-# iio-dummy-device support for test iiodevice
-SRC_URI_append = " file://iiodevice.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/iiodevice.cfg"
-
-# external rtc support via e.g. http://wiki.seeedstudio.com/Grove-RTC/
-SRC_URI_append = " file://rtc.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/rtc.cfg"
-
-# netfilter options
-SRC_URI_append = " file://netfilter.cfg"
-KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/netfilter.cfg"
-
-# Enable support for SystemTap
-SRC_URI_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'file://systemtap.cfg', '', d)}"
-KERNEL_CONFIG_FRAGMENTS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', '${WORKDIR}/systemtap.cfg', '', d)}"
diff --git a/meta-agl-core/recipes-kernel/linux/linux-yocto-agl.inc b/meta-agl-core/recipes-kernel/linux/linux-yocto-agl.inc
new file mode 100644 (file)
index 0000000..dd4e8e8
--- /dev/null
@@ -0,0 +1,12 @@
+# Include file intended for kernel-yocto.bbclass based recipes.
+
+include linux-agl-config.inc
+
+# For qemuarm, build a generic v7 kernel instead of the arm926j one that
+# upstream qemuarm defaults to.
+KBUILD_DEFCONFIG_qemuarm = "multi_v7_defconfig"
+
+# Use alldefconfig for the qemu targets, but let other kernel-yocto
+# based BSPs use their own defaults (note that linux-renesas and
+# linux-raspberrypi also default to alldefconfig).
+KCONFIG_MODE_qemuall = "--alldefconfig"
diff --git a/meta-agl-core/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-agl-core/recipes-kernel/linux/linux-yocto_%.bbappend
new file mode 100644 (file)
index 0000000..808df2d
--- /dev/null
@@ -0,0 +1 @@
+require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', '${BPN}-agl.inc', '', d)}
diff --git a/meta-agl-core/recipes-kernel/linux/linux/btusb.cfg b/meta-agl-core/recipes-kernel/linux/linux/btusb.cfg
deleted file mode 100644 (file)
index 4a4c35a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-CONFIG_BT=m
-CONFIG_BT_BREDR=y
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-CONFIG_BT_HS=y
-CONFIG_BT_LE=y
-CONFIG_BT_LEDS=y
-# CONFIG_BT_SELFTEST is not set
-CONFIG_BT_DEBUGFS=y
-
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_INTEL=m
-CONFIG_BT_BCM=m
-CONFIG_BT_RTL=m
-CONFIG_BT_HCIBTUSB=m
-CONFIG_BT_HCIBTUSB_BCM=y
-CONFIG_BT_HCIBTUSB_RTL=y
-CONFIG_BT_HCIBCM203X=m
-CONFIG_BT_HCIBFUSB=m
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_CMAC=m
-
-#
-# Bluetooth AVRCP support
-#
-CONFIG_INPUT_UINPUT=y
index 2f24b76..d7c7c77 100644 (file)
@@ -1,8 +1,3 @@
-CONFIG_TASKSTATS=y
-CONFIG_TASK_DELAY_ACCT=y
-# CONFIG_TASK_XACCT is not set
-CONFIG_USER_RETURN_NOTIFIER=y
-CONFIG_PREEMPT_NOTIFIERS=y
 CONFIG_CAN=m
 CONFIG_CAN_RAW=m
 CONFIG_CAN_BCM=m
@@ -12,31 +7,4 @@ CONFIG_CAN_J1939=m
 #
 # CAN Device Drivers
 #
-CONFIG_CAN_C_CAN=m
-CONFIG_CAN_C_CAN_PLATFORM=m
 CONFIG_CAN_VCAN=m
-CONFIG_CAN_SLCAN=m
-CONFIG_CAN_DEV=m
-CONFIG_CAN_CALC_BITTIMING=y
-# CONFIG_CAN_LEDS is not set
-# CONFIG_CAN_SJA1000 is not set
-# CONFIG_CAN_M_CAN is not set
-# CONFIG_CAN_CC770 is not set
-
-#
-# CAN SPI interfaces
-#
-CONFIG_CAN_MCP251X=m
-
-#
-# CAN USB interfaces
-#
-# CONFIG_CAN_EMS_USB is not set
-CONFIG_CAN_ESD_USB2=m
-CONFIG_CAN_GS_USB=m
-CONFIG_CAN_KVASER_USB=m
-CONFIG_CAN_PEAK_USB=m
-CONFIG_CAN_8DEV_USB=m
-CONFIG_CAN_MCBA_USB=m
-# CONFIG_CAN_SOFTING is not set
-# CONFIG_CAN_DEBUG_DEVICES is not set
diff --git a/meta-agl-core/recipes-kernel/linux/linux/hid.cfg b/meta-agl-core/recipes-kernel/linux/linux/hid.cfg
deleted file mode 100644 (file)
index 327c753..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_HID_MULTITOUCH=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/i2c-led.cfg b/meta-agl-core/recipes-kernel/linux/linux/i2c-led.cfg
deleted file mode 100644 (file)
index 248b511..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# enabling I2C and LED for demonstrator
-CONFIG_I2C_TINY_USB=y
-CONFIG_LEDS_BLINKM=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/iiodevice.cfg b/meta-agl-core/recipes-kernel/linux/linux/iiodevice.cfg
deleted file mode 100644 (file)
index c5b8ff3..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Extcon Device Drivers
-#
-CONFIG_IIO=y
-CONFIG_IIO_BUFFER=y
-CONFIG_IIO_BUFFER_CB=y
-CONFIG_IIO_KFIFO_BUF=y
-CONFIG_IIO_CONFIGFS=m
-CONFIG_IIO_TRIGGER=y
-CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
-CONFIG_IIO_SW_DEVICE=m
-CONFIG_IIO_SW_TRIGGER=m
-
-#
-# IIO dummy driver
-#
-CONFIG_IIO_DUMMY_EVGEN=m
-CONFIG_IIO_SIMPLE_DUMMY=m
-CONFIG_IIO_SIMPLE_DUMMY_EVENTS=y
-CONFIG_IIO_SIMPLE_DUMMY_BUFFER=y
-
-#
-# Triggers - standalone
-#
-CONFIG_IIO_HRTIMER_TRIGGER=m
-CONFIG_IIO_TRIGGERED_BUFFER=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/joystick.cfg b/meta-agl-core/recipes-kernel/linux/linux/joystick.cfg
deleted file mode 100644 (file)
index 2201bcb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG_INPUT_JOYDEV=y
-CONFIG_INPUT_JOYSTICK=y
-CONFIG_JOYSTICK_ADI=y
-CONFIG_GAMEPORT=y
-CONFIG_HID_LOGITECH=y
-CONFIG_LOGIWHEELS_FF=y
-CONFIG_HID_LOGITECH_HIDPP=y
-CONFIG_LOGITECH_FF=y
-CONFIG_LOGIG940_FF=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/netfilter.cfg b/meta-agl-core/recipes-kernel/linux/linux/netfilter.cfg
deleted file mode 100644 (file)
index 34be704..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NETFILTER_XT_MATCH_OWNER=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/nfc.cfg b/meta-agl-core/recipes-kernel/linux/linux/nfc.cfg
deleted file mode 100644 (file)
index 6d863a0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-CONFIG_NFC=m
-CONFIG_NFC_DIGITAL=m
-CONFIG_NFC_NCI=m
-CONFIG_NFC_NCI_SPI=m
-CONFIG_NFC_HCI=m
-CONFIG_NFC_SHDLC=y
-CONFIG_NFC_TRF7970A=m
-CONFIG_NFC_MEI_PHY=m
-CONFIG_NFC_PORT100=m
-CONFIG_NFC_FDP=m
-CONFIG_NFC_FDP_I2C=m
-CONFIG_NFC_PN544=m
-CONFIG_NFC_PN544_I2C=m
-CONFIG_NFC_PN544_MEI=m
-CONFIG_NFC_PN533=m
-CONFIG_NFC_PN533_USB=m
-CONFIG_NFC_PN533_I2C=m
-CONFIG_NFC_MICROREAD=m
-CONFIG_NFC_MICROREAD_I2C=m
-CONFIG_NFC_MICROREAD_MEI=m
-CONFIG_NFC_MRVL=m
-CONFIG_NFC_MRVL_USB=m
-CONFIG_NFC_MRVL_I2C=m
-CONFIG_NFC_MRVL_SPI=m
-CONFIG_NFC_ST21NFCA=m
-CONFIG_NFC_ST21NFCA_I2C=m
-CONFIG_NFC_ST_NCI=m
-CONFIG_NFC_ST_NCI_I2C=m
-CONFIG_NFC_ST_NCI_SPI=m
-CONFIG_NFC_NXP_NCI=m
-CONFIG_NFC_NXP_NCI_I2C=m
-CONFIG_NFC_S3FWRN5=m
-CONFIG_NFC_S3FWRN5_I2C=m
-CONFIG_NFC_ST95HF=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/procevent.cfg b/meta-agl-core/recipes-kernel/linux/linux/procevent.cfg
deleted file mode 100644 (file)
index 6e08c25..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_CONNECTOR=y
-CONFIG_PROC_EVENTS=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/rtc.cfg b/meta-agl-core/recipes-kernel/linux/linux/rtc.cfg
deleted file mode 100644 (file)
index 2641958..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_LIB=y
-CONFIG_RTC_INTF_SYSFS=y
-CONFIG_RTC_INTF_PROC=y
-CONFIG_RTC_INTF_DEV=y
-CONFIG_RTC_DRV_DS1307=m
-CONFIG_RTC_DRV_DS3232=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/rtl_sdr.cfg b/meta-agl-core/recipes-kernel/linux/linux/rtl_sdr.cfg
deleted file mode 100644 (file)
index d457470..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG_MEDIA_USB_SUPPORT=y
-CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
-CONFIG_DVB_USB_V2=m
-CONFIG_DVB_USB_RTL28XXU=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/scheddebug.cfg b/meta-agl-core/recipes-kernel/linux/linux/scheddebug.cfg
deleted file mode 100644 (file)
index e8b09aa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_SCHED_DEBUG=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/uinput.cfg b/meta-agl-core/recipes-kernel/linux/linux/uinput.cfg
deleted file mode 100644 (file)
index 7996ef1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Enable the User-level Input driver (required by "wayland-fits")
-CONFIG_INPUT_MISC=y
-CONFIG_INPUT_UINPUT=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/usb.cfg b/meta-agl-core/recipes-kernel/linux/linux/usb.cfg
deleted file mode 100644 (file)
index 8e9e98e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG_USB_SERIAL=y
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_ACM=m
-CONFIG_CRC_CCITT=y
-CONFIG_USB_SERIAL_FTDI_SIO=m
-CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_PCI=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/usbaudio.cfg b/meta-agl-core/recipes-kernel/linux/linux/usbaudio.cfg
deleted file mode 100644 (file)
index 5961f43..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_SND_USB=y
-CONFIG_SND_USB_AUDIO=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/usbmodem.cfg b/meta-agl-core/recipes-kernel/linux/linux/usbmodem.cfg
deleted file mode 100644 (file)
index 3ded931..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_USB_USBNET=m
-CONFIG_USB_NET_CDC_MBIM=m
-CONFIG_USB_NET_QMI_WWAN=m
-CONFIG_USB_SIERRA_NET=m
-CONFIG_USB_SERIAL_OPTION=m
-CONFIG_USB_SERIAL_SIERRAWIRELESS=m
-CONFIG_USB_SERIAL_QUALCOMM=m
diff --git a/meta-agl-core/recipes-kernel/linux/linux/uvc.cfg b/meta-agl-core/recipes-kernel/linux/linux/uvc.cfg
deleted file mode 100644 (file)
index 7c6556c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG_VIDEOBUF2_VMALLOC=y
-CONFIG_MEDIA_USB_SUPPORT=y
-CONFIG_USB_VIDEO_CLASS=m
-CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
diff --git a/meta-agl-core/recipes-kernel/linux/linux/wifi.cfg b/meta-agl-core/recipes-kernel/linux/linux/wifi.cfg
deleted file mode 100644 (file)
index 00c2e06..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_CFG80211=m
-CONFIG_MAC80211=m
-CONFIG_WLAN_VENDOR_ATH=m
-CONFIG_ATH9K_HTC=m
-CONFIG_STAGING=y
-CONFIG_R8188EU=m
index acce6cc..807da11 100644 (file)
@@ -1,2 +1 @@
-require ${@bb.utils.contains('APPFW_ENABLED', '1', 'linux-appfw.inc', '', d)}
-
+require ${@bb.utils.contains('APPFW_ENABLED', '1', 'linux-appfw.inc', '', d) if bb.data.inherits_class('kernel', d) else ''}
index cbf6567..1b6d1b6 100644 (file)
@@ -1,21 +1,23 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/linux:"
 
-IS_KERNEL_RECIPE := "${@bb.data.inherits_class('kernel', d) and 'yes' or 'no'}"
-SMACK_KERNEL_SRC_URI_no = ""
-SMACK_KERNEL_SRC_URI_yes = ""
+# Enable SMACK support without making it the default explicitly.
+AGL_KCONFIG_FRAGMENTS += "smack.cfg"
 
-# Kernel config fragment enabling Smack, without making it the default explicitly.
-SMACK_KERNEL_SRC_URI_yes += "file://smack.cfg"
-
-# When added, set Smack as the default LSM.
-SMACK_DEFAULT_SECURITY_CFG = "file://smack-default-lsm.cfg"
-# Add it by default, can be overridden by changing this variable here.
-SMACK_DEFAULT_SECURITY ??= "${SMACK_DEFAULT_SECURITY_CFG}"
-SMACK_KERNEL_SRC_URI_yes += " ${SMACK_DEFAULT_SECURITY}"
-
-# add audit.cfg
-SMACK_KERNEL_SRC_URI_yes += " file://audit.cfg"
-
-
-SRC_URI_append_with-lsm-smack = "${SMACK_KERNEL_SRC_URI_${IS_KERNEL_RECIPE}}"
+# Enable SMACK as default LSM, can be overridden by changing this
+# variable to e.g. "".
+#
+# NOTE:
+# We use a different fragment for kernels older than 5.x that predate
+# the switch to using CONFIG_LSM instead of CONFIG_DEFAULT_SECURITY.
+# For simplicity, logic to handle the change being made in 5.1 instead
+# of 5.0 has been omitted; in practice this should not be a problem
+# since no current BSPs have been seen that use 5.0.x.  If a BSP
+# kernel recipe does not set LINUX_VERSION, the kernel being 5.x or
+# newer is assumed as the default behavior.
+LINUX_VERSION_MAJOR = "${@(d.getVar('LINUX_VERSION') or "5.x").split('.')[0]}"
+SMACK_DEFAULT_SUFFIX = "${@'' if int(d.getVar('LINUX_VERSION_MAJOR') or 0) >= 5 else '-old'}"
+SMACK_DEFAULT_SECURITY ??= "smack-default-lsm${SMACK_DEFAULT_SUFFIX}.cfg"
+AGL_KCONFIG_FRAGMENTS += "${SMACK_DEFAULT_SECURITY}"
 
+# Enable audit support
+AGL_KCONFIG_FRAGMENTS += "audit.cfg"
diff --git a/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg b/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg
new file mode 100644 (file)
index 0000000..b5c4845
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_DEFAULT_SECURITY="smack"
+CONFIG_DEFAULT_SECURITY_SMACK=y
index b5c4845..4791eba 100644 (file)
@@ -1,2 +1,2 @@
-CONFIG_DEFAULT_SECURITY="smack"
 CONFIG_DEFAULT_SECURITY_SMACK=y
+CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor"