diff mbox

Xenomai support for pre and post patches

Message ID CAEbDrgk-oaAJgHv=w02Hdzef9t7zphqWKBuq87eyD=FWHrA=Aw@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Gregory Dymarek March 28, 2014, 9:42 a.m. UTC
The following patch adds support for pre- and post- adeos patches to Xenomai.

Comments

Thomas Petazzoni March 28, 2014, 11:09 a.m. UTC | #1
Dear Gregory Dymarek,

Thanks for your contribution!

On Fri, 28 Mar 2014 09:42:19 +0000, Gregory Dymarek wrote:

> The following patch adds support for pre- and post- adeos patches to
> Xenomai.

Can you explain why this is needed? You can already apply patches on
any package using the BR2_GLOBAL_PATCH_DIR option. See
http://buildroot.org/downloads/manual/manual.html#packages-custom for
details about it.

Basically, you can do:

	BR2_GLOBAL_PATCH_DIR=board/<company>/<project>/

and then, in:

	board/<company>/<project>/xenomai/

you put your patches, and then will be applied to Xenomai before it is
being built.

Best regards,

Thomas
Gregory Dymarek March 28, 2014, 1:31 p.m. UTC | #2
Hi Thomas,

Thanks for the information.

With your instructions I can see how to define the PRE patch (one that
is applied to kernel before Xenomai Adeos patch). However, there are
number of boards that require POST patch. A post patch is one that has
to be applied to kernel after Xenomai Adeos patch.

The examples are: raspberry, zynq, beaglebone, mxc

Is there a way to stage global patches?

Regards,
Gregory

On 28 March 2014 11:09, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Gregory Dymarek,
>
> Thanks for your contribution!
>
> On Fri, 28 Mar 2014 09:42:19 +0000, Gregory Dymarek wrote:
>
>> The following patch adds support for pre- and post- adeos patches to
>> Xenomai.
>
> Can you explain why this is needed? You can already apply patches on
> any package using the BR2_GLOBAL_PATCH_DIR option. See
> http://buildroot.org/downloads/manual/manual.html#packages-custom for
> details about it.
>
> Basically, you can do:
>
>         BR2_GLOBAL_PATCH_DIR=board/<company>/<project>/
>
> and then, in:
>
>         board/<company>/<project>/xenomai/
>
> you put your patches, and then will be applied to Xenomai before it is
> being built.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
Thomas Petazzoni March 28, 2014, 1:37 p.m. UTC | #3
Dear Gregory Dymarek,

On Fri, 28 Mar 2014 13:31:31 +0000, Gregory Dymarek wrote:

> With your instructions I can see how to define the PRE patch (one that
> is applied to kernel before Xenomai Adeos patch). However, there are
> number of boards that require POST patch. A post patch is one that has
> to be applied to kernel after Xenomai Adeos patch.
> 
> The examples are: raspberry, zynq, beaglebone, mxc

Make a patch that applies to the Xenomai sources, and which adds the
necessary bits *inside* the kernel patches that Xenomai is applying to
the kernel. So you'll need a patch of a patch :-)

Thomas
diff mbox

Patch

diff -rupN linux.orig/Config.ext.in linux/Config.ext.in
--- linux.orig/Config.ext.in	2014-03-27 18:29:40.944499478 +0000
+++ linux/Config.ext.in	2014-03-27 18:43:35.048499592 +0000
@@ -21,6 +21,12 @@  comment "xenomai needs a toolchain w/ th
 		   BR2_bfin || BR2_powerpc || BR2_sh4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
 
+config BR2_LINUX_KERNEL_EXT_XENOMAI_PRE_PATCH
+	depends on BR2_LINUX_KERNEL_EXT_XENOMAI
+	string "Path for Pre Adeos patch file"
+	help
+	  Optionally, specify a patch that will be applied prior to Adeos patch.
+
 config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
 	depends on BR2_LINUX_KERNEL_EXT_XENOMAI
 	string "Path for Adeos patch file"
@@ -29,6 +35,12 @@  config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEO
 	  Download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
 	  and verify that your kernel version in buildroot matches.
 
+config BR2_LINUX_KERNEL_EXT_XENOMAI_POST_PATCH
+	depends on BR2_LINUX_KERNEL_EXT_XENOMAI
+	string "Path for Post Adeos patch file"
+	help
+	  Optionally, specify a patch that will be applied after Adeos patch.
+
 # RTAI
 config BR2_LINUX_KERNEL_EXT_RTAI
 	bool "RTAI Real-time patch"
diff -rupN linux.orig/linux-ext-xenomai.mk linux/linux-ext-xenomai.mk
--- linux.orig/linux-ext-xenomai.mk	2014-03-27 18:29:40.944499478 +0000
+++ linux/linux-ext-xenomai.mk	2014-03-27 18:47:49.928499626 +0000
@@ -9,6 +9,20 @@  ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
 LINUX_DEPENDENCIES += xenomai
 
 # Adeos patch version
+XENOMAI_PRE_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_PRE_PATCH))
+ifneq ($(XENOMAI_PRE_PATCH),)
+define XENOMAI_PRE_PATCH_CMD
+	patch -p1 --directory=$(LINUX_DIR) < $(XENOMAI_PRE_PATCH)
+endef 
+endif
+
+XENOMAI_POST_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_POST_PATCH))
+ifneq ($(XENOMAI_POST_PATCH),)
+define XENOMAI_POST_PATCH_CMD
+	patch -p1 --directory=$(LINUX_DIR) < $(XENOMAI_POST_PATCH)
+endef 
+endif
+
 XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
 ifeq ($(XENOMAI_ADEOS_PATCH),)
 XENOMAI_ADEOS_OPT = --default
@@ -18,11 +32,13 @@  endif
 
 # Prepare kernel patch
 define XENOMAI_PREPARE_KERNEL
+	$(XENOMAI_PRE_PATCH_CMD)
 	$(XENOMAI_DIR)/scripts/prepare-kernel.sh \
 		--linux=$(LINUX_DIR) \
 		--arch=$(KERNEL_ARCH) \
 		$(XENOMAI_ADEOS_OPT) \
 		--verbose
+	$(XENOMAI_POST_PATCH_CMD)
 endef
 
 LINUX_PRE_PATCH_HOOKS += XENOMAI_PREPARE_KERNEL