linux: allow br2-externals to provide their own Linux extensions
authorMcCabe, Robert J <robert.mccabe@rockwellcollins.com>
Sat, 28 Sep 2019 17:49:37 +0000 (12:49 -0500)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 28 Sep 2019 20:12:04 +0000 (22:12 +0200)
Signed-off-by: McCabe, Robert J <robert.mccabe@rockwellcollins.com>
Acked-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
docs/manual/customize-outside-br.txt
linux/linux.mk

index 7d3e2b1714c265f4006e83d06b0ca1c690d4e146..5f7d623aea3c9823e5c9ef59562dfde97339e8d8 100644 (file)
@@ -219,6 +219,12 @@ BR2_ROOTFS_OVERLAY=$(BR2_EXTERNAL_BAR_42_PATH)/board/<boardname>/overlay/
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=$(BR2_EXTERNAL_BAR_42_PATH)/board/<boardname>/kernel.config
 ----
 
+===== Additional Linux kernel extensions
+
+Additional Linux kernel extensions (see xref:linux-kernel-ext[]) can
+be added by storing them in the `linux/` directory at the root of a
+br2-external tree.
+
 ===== Example layout
 
 Here is an example layout using all features of br2-external (the sample
@@ -315,6 +321,14 @@ illustration, of course):
   |     |$(eval $(toolchain-external-package))
   |     `----
   |
+  |- linux/Config.ext.in
+  |     |config BR2_LINUX_KERNEL_EXT_EXAMPLE_DRIVER
+  |     |    bool "example-external-driver"
+  |     |    help
+  |     |      Example external driver
+  |     |---
+  |- linux/linux-ext-example-driver.mk
+  |
   |- configs/my-board_defconfig
   |     |BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BAR_42_PATH)/patches/"
   |     |BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_BAR_42_PATH)/board/my-board/overlay/"
index 95bde1aba504b854fc839caade3f39e956c7f7a3..b9e72107df48c7fa860f7ebb8c3e090b73f60f7a 100644 (file)
@@ -514,14 +514,19 @@ endef
 #
 # Note: our package infrastructure uses the full-path of the last-scanned
 # Makefile to determine what package we're currently defining, using the
-# last directory component in the path. As such, including other Makefile,
-# like below, before we call one of the *-package macro is usally not
-# working.
+# last directory component in the path. As such, including other Makefiles,
+# like below, before we call one of the *-package macros usually doesn't
+# work.
 # However, since the files we include here are in the same directory as
 # the current Makefile, we are OK. But this is a hard requirement: files
-# included here *must* be in the same directory!
+# included here *must* either be in this same directory OR within a
+# another directory with the name "linux" (in the BR2_EXTERNAL case).
 include $(sort $(wildcard linux/linux-ext-*.mk))
 
+# Import linux-kernel-extensions from br2-externals
+include $(sort $(wildcard $(foreach ext,$(BR2_EXTERNAL_DIRS), \
+       $(ext)/linux/linux-ext-*.mk)))
+
 LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
        $(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))