linux: simplify adding new extensions
authorYann E. MORIN <yann.morin.1998@free.fr>
Sat, 14 Mar 2015 14:25:20 +0000 (15:25 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 9 Apr 2015 20:57:51 +0000 (22:57 +0200)
Curently, all three linux extensions follow the same layout:
  - test if the extension is enabled
  - add itself to linux' patch-dependencies
  - declare a macro, added as the pre-patch hook

Except for the macro, all can be commonalised.

Add a simple infrastructure for that:
  - extensions declare themselves in the list of extensions
  - extensions define their macro
  - the infra adds them to the patch-dependencies and pre-patch
    hooks as appropriate

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
linux/linux.mk

index 21eb3c9966429b527e4594ef53401c810406bcd4..deed073e5d106dc393a057f4764b98090c25f83d 100644 (file)
@@ -327,6 +327,13 @@ endef
 # included here *must* be in the same directory!
 include $(sort $(wildcard linux/linux-ext-*.mk))
 
+LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
+       $(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))
+
+LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\
+       $(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\
+               $(call UPPERCASE,$(ext))_PREPARE_KERNEL))
+
 $(eval $(kconfig-package))
 
 # Support for rebuilding the kernel after the cpio archive has