Skip to contentSkip to conversation

Add Xenomai real-time framework

PATCH New benoit.mauduit at gmail.com 3 participants 13 messages Jul 13, 2011 – Sep 14, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Add Xenomai real-time framework

From: Benoit Mauduit <[email protected]>

These two patches are an initial add for Xenomai in buildroot.

"Xenomai is a real-time development framework cooperating with the Linux kernel, in order to provide a pervasive, interface-agnostic, hard real-time support to user-space applications, seamlessly integrated into the GNU/Linux environment."
[http://www.xenomai.org]

Xenomai comes with a Linux Kernel and user-space part.
I added a Linux extensions sub-menu (The first patch) which handles the kernel modification provided by Adeos/Xenomai. The advantage of this way is for maintenance purpose. (Xenomai do not provide a full kernel patch, but use a script called "prepare-kernel.sh") Also, this split the user-space from the kernel in a nice way instead of adding a serie of patches.

The Xenomai user-space part can be built separately with an external real-time Kernel.

I have tested on both x86 and Arm with buildroot toolchains (uclibc).

Any feedback is welcome, especially for the first patch.

Regards,

Signature · 28 lines
Beno?t Mauduit

---

Benoit Mauduit (2):
  linux: Add Linux Kernel extensions menu
  Add xenomai real-time Framework to buildroot for Arm and x86

 Makefile                                           |    2 +-
 linux/Config.ext.in                                |   20 ++++
 linux/Config.in                                    |    4 +
 linux/xenomai.mk                                   |   29 ++++++
 package/Config.in                                  |    4 +
 package/xenomai/Config.in                          |   81 +++++++++++++++++
 package/xenomai/README                             |   48 ++++++++++
 .../xenomai/xenomai-do-not-install-devices.patch   |   11 +++
 package/xenomai/xenomai.mk                         |   95 ++++++++++++++++++++
 target/generic/device_table_dev.txt                |    5 +
 10 files changed, 298 insertions(+), 1 deletions(-)
 create mode 100644 linux/Config.ext.in
 create mode 100644 linux/xenomai.mk
 create mode 100644 package/xenomai/Config.in
 create mode 100644 package/xenomai/README
 create mode 100644 package/xenomai/xenomai-do-not-install-devices.patch
 create mode 100644 package/xenomai/xenomai.mk

-- 
1.7.6
#1 lore raw

PATCH 1/2 linux: Add Linux Kernel extensions menu

From: Benoit Mauduit <[email protected]>

Add a kernel sub-menu (called "Linux Kernel Extensions"), which makes possible to patch it or tweak the kernel build step.

* All linux/*.mk files will be read by the make process.
* The menu can be customized in "linux/Config.ext.in".

---
 Makefile            |    2 +-
 linux/Config.ext.in |    3 +++
 linux/Config.in     |    4 ++++
 3 files changed, 8 insertions(+), 1 deletions(-)
 create mode 100644 linux/Config.ext.in
Makefile +1 -1
index 2f3802c..27e4375 100644
@@ -313,7 +313,7 @@ include package/*/*.mk
 
 include boot/common.mk
 include target/Makefile.in
-include linux/linux.mk
+include linux/*.mk
 
 TARGETS+=target-finalize
 
linux/Config.ext.in new file +3 -0
new file mode 100644
index 0000000..50e801d
@@ -0,0 +1,3 @@
+menu "Linux Kernel Extensions"
+
+endmenu
linux/Config.in +4 -0
index 8d3b0ba..3a22686 100644
@@ -176,6 +176,10 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
 	  /boot in the target root filesystem, as is typically done on
 	  x86/x86_64 systems.
 
+
+# Linux extensions (Xenomai)
+source "linux/Config.ext.in"
+
 endif # BR2_LINUX_KERNEL
 
 endmenu
Signature · 1 line
1.7.6
#2 lore raw

PATCH 1/2 linux: Add Linux Kernel extensions menu

Hi,

Quoted 24 lines · On Wed, Jul 13, 2011 at 5:52 PM, <[email protected]> wrote:

From: Benoit Mauduit <[email protected]>

Add a kernel sub-menu (called "Linux Kernel Extensions"), which makes possible to patch it or tweak the kernel build step.

?* All linux/*.mk files will be read by the make process. ?* The menu can be customized in "linux/Config.ext.in".

---

?Makefile ? ? ? ? ? ?| ? ?2 +-
?linux/Config.ext.in | ? ?3 +++
?linux/Config.in ? ? | ? ?4 ++++

?3 files changed, 8 insertions(+), 1 deletions(-)
?create mode 100644 linux/Config.ext.in

Makefile +0 -0
index 2f3802c..27e4375 100644
@@ -313,7 +313,7 @@ include package/*/*.mk
 

?include boot/common.mk
?include target/Makefile.in

Makefile include package/*/*.mk · line 316

Quoted 2 lines
Makefile +1 -1
-include linux/linux.mk
+include linux/*.mk

Shouldn't the linux.mk file be included *before* all the other .mk files? I can imagine that some of the extra .mk files depend on linux variables.

Quoted 35 lines

?TARGETS+=target-finalize

linux/Config.ext.in new file +3 -0
new file mode 100644
index 0000000..50e801d
@@ -0,0 +1,3 @@
+menu "Linux Kernel Extensions"
+
+endmenu
linux/Config.in +0 -0
index 8d3b0ba..3a22686 100644
@@ -176,6 +176,10 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET

? ? ? ? ?/boot in the target root filesystem, as is typically done on ? ? ? ? ?x86/x86_64 systems.

linux/Config.in +4 -0
+
+# Linux extensions (Xenomai)
+source "linux/Config.ext.in"
+

?endif # BR2_LINUX_KERNEL

?endmenu
--
1.7.6

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/2 linux: Add Linux Kernel extensions menu

Quoted 1 line · Thomas De Schampheleire

Hi,

Hi !

Quoted 23 lines · On Wed, Jul 13, 2011 at 5:52 PM, ?<[email protected]> wrote:
Quoted 22 lines

From: Benoit Mauduit <[email protected]>

Add a kernel sub-menu (called "Linux Kernel Extensions"), which makes possible to patch it or tweak the kernel build step.

?* All linux/*.mk files will be read by the make process. ?* The menu can be customized in "linux/Config.ext.in".

---

?Makefile ? ? ? ? ? ?| ? ?2 +-
?linux/Config.ext.in | ? ?3 +++
?linux/Config.in ? ? | ? ?4 ++++

?3 files changed, 8 insertions(+), 1 deletions(-)
?create mode 100644 linux/Config.ext.in

Makefile +0 -0
index 2f3802c..27e4375 100644
@@ -313,7 +313,7 @@ include package/*/*.mk
 
Quoted 9 lines

Makefile include package/*/*.mk · line 316

Quoted 4 lines

?include boot/common.mk
?include target/Makefile.in

Makefile +1 -1
-include linux/linux.mk
+include linux/*.mk

Shouldn't the linux.mk file be included *before* all the other .mk files? I can imagine that some of the extra .mk files depend on linux variables.

You are right, this is a mistake.
I suggest to name all linux makefile extension like that :
"xenomai_ext.mk".
And include them with:
include linux/*_ext.mk

Thanks !

Signature · 1 line
Benoit Mauduit
#4 lore raw

PATCH 1/2 linux: Add Linux Kernel extensions menu

Le Wed, 20 Jul 2011 10:10:36 +0200,
Beno?t Mauduit <[email protected]> a ?crit :

Quoted 5 lines

You are right, this is a mistake.
I suggest to name all linux makefile extension like that :
"xenomai_ext.mk".
And include them with:
include linux/*_ext.mk

Or maybe, it's linux/linux.mk's job to include linux/linux-*-ext.mk, or explicitly linux/linux-xenomai.mk ?

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 2/2 Add xenomai real-time Framework to buildroot for Arm and x86

In reply to benoit.mauduit at gmail.com

From: Benoit Mauduit <[email protected]>

Buildroot Kernel:
* Download Adeos patch and specify the path into buildroot menuconfig...
* ..and take care of Linux kernel version supported by Xenomai.

Non-buildroot Kernel:
* The User-space part of Xenomai can be built with an external real-time kernel.

---
 linux/Config.ext.in                                |   17 ++++
 linux/xenomai.mk                                   |   29 ++++++
 package/Config.in                                  |    4 +
 package/xenomai/Config.in                          |   81 +++++++++++++++++
 package/xenomai/README                             |   48 ++++++++++
 .../xenomai/xenomai-do-not-install-devices.patch   |   11 +++
 package/xenomai/xenomai.mk                         |   95 ++++++++++++++++++++
 target/generic/device_table_dev.txt                |    5 +
 8 files changed, 290 insertions(+), 0 deletions(-)
 create mode 100644 linux/xenomai.mk
 create mode 100644 package/xenomai/Config.in
 create mode 100644 package/xenomai/README
 create mode 100644 package/xenomai/xenomai-do-not-install-devices.patch
 create mode 100644 package/xenomai/xenomai.mk
linux/Config.ext.in +17 -0
index 50e801d..1d35ffc 100644
@@ -1,3 +1,20 @@
 menu "Linux Kernel Extensions"
 
+# Xenomai
+config BR2_LINUX_KERNEL_EXT_XENOMAI
+	bool "Adeos/Xenomai Real-time patch"
+  select BR2_PACKAGE_XENOMAI
+	depends on ((BR2_arm && (BR2_ARM_EABI || BR2_TOOLCHAIN_EXTERNAL)) \
+		|| BR2_i386)
+	help
+	  Xenomai Kernel part.
+
+config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
+	depends on BR2_LINUX_KERNEL_EXT_XENOMAI
+	string "Path for ADEOS patch file"
+	help
+	  Xenomai needs Adeos patch.
+	  You must download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
+	  and verify that your kernel version in buildroot match.
+
 endmenu
linux/xenomai.mk new file +29 -0
new file mode 100644
index 0000000..8cffb43
@@ -0,0 +1,29 @@
+##################################################
+# Linux Adeos/Xenomai extensions
+#
+# Patch the linux kernel with xenomai extension
+##################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
+# Add dependency to xenomai (user-space) which provide ksrc part
+LINUX_DEPENDENCIES += xenomai
+
+# Adeos patch version
+XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
+ifeq ($(XENOMAI_ADEOS_PATCH),)
+XENOMAI_ADEOS_OPT = --default
+else
+XENOMAI_ADEOS_OPT = --adeos=$(XENOMAI_ADEOS_PATCH)
+endif
+
+# Prepare kernel patch
+define XENOMAI_PREPARE_KERNEL
+	$(XENOMAI_DIR)/scripts/prepare-kernel.sh \
+		--linux=$(LINUX_DIR) \
+		--arch=$(BR2_ARCH) \
+		$(XENOMAI_ADEOS_OPT)
+endef
+
+LINUX_POST_EXTRACT_HOOKS += XENOMAI_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_XENOMAI
package/Config.in +4 -0
index 2fa9ff5..a461135 100644
@@ -478,6 +478,10 @@ source "package/rpm/Config.in"
 endif
 endmenu
 
+menu "Real-Time"
+source "package/xenomai/Config.in"
+endmenu
+
 menu "Shell and utilities"
 source "package/at/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/xenomai/Config.in new file +81 -0

81 lines not on this page · raw message

package/xenomai/README new file +48 -0

48 lines not on this page · raw message

package/xenomai/xenomai-do-not-install-devices.patch new file +11 -0
new file mode 100644
index 0000000..348abee
@@ -0,0 +1,11 @@
+--- a/Makefile.in	2011-06-24 16:11:23.591449817 +0200
++++ b/Makefile.in	2011-06-24 16:20:29.638129633 +0200
+@@ -719,7 +719,7 @@
+ 	  $$sudo mknod -m 666 $(DESTDIR)/dev/rtheap c 10 254 ; \
+ 	fi
+ 
+-install-exec-local: devices
++install-exec-local:
+ 
+ install-user:
+ 	$(MAKE) SUDO=false install
package/xenomai/xenomai.mk new file +95 -0

95 lines not on this page · raw message

target/generic/device_table_dev.txt +5 -0
index a3d53d4..71cd083 100644
@@ -141,3 +141,8 @@
 
 # I2C device nodes
 /dev/i2c-	c	666	0	0	89	0	0	1	4
+
+# Xenomai
+#/dev/rtheap     c       666     0       0       10      254     0       0       -
+#/dev/rtscope    c       666     0       0       10      253     0       0       -
+#/dev/rtp        c       666     0       0       150     0       0       1       32
Signature · 1 line
1.7.6
#6 lore raw

PATCH 2/2 Add xenomai real-time Framework to buildroot for Arm and x86

Hi,

Quoted 21 lines · On Wed, Jul 13, 2011 at 5:53 PM, <[email protected]> wrote:

From: Benoit Mauduit <[email protected]>

Buildroot Kernel:
?* Download Adeos patch and specify the path into buildroot ? ?menuconfig...
?* ..and take care of Linux kernel version supported by Xenomai.

Non-buildroot Kernel:
?* The User-space part of Xenomai can be built with an external ? ?real-time kernel.

---

?linux/Config.ext.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 17 ++++
?linux/xenomai.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 29 ++++++
?package/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +
?package/xenomai/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 81 +++++++++++++++++
?package/xenomai/README ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 48 ++++++++++
?.../xenomai/xenomai-do-not-install-devices.patch ? | ? 11 +++
?package/xenomai/xenomai.mk ? ? ? ? ? ? ? ? ? ? ? ? | ? 95 ++++++++++++++++++++
?target/generic/device_table_dev.txt ? ? ? ? ? ? ? ?| ? ?5 +
Quoted 6 lines

?8 files changed, 290 insertions(+), 0 deletions(-)
?create mode 100644 linux/xenomai.mk
?create mode 100644 package/xenomai/Config.in
?create mode 100644 package/xenomai/README
?create mode 100644 package/xenomai/xenomai-do-not-install-devices.patch ?create mode 100644 package/xenomai/xenomai.mk

Looking forward to have this in buildroot.
Actually, I added support for Xenomai in my buildroot tree, but never got around to submit a proper patch. My changes were based on the xenomai-buildroot patch from the Armadeus project, but with several modifications.

One of these modifications is to add support for a local xenomai installation. However, I understand that Thomas P. is preparing patches that supports this in a generic way, so it doesn't need to be in the xenomai Makefile anymore.

Some comments below...

Quoted 8 lines
linux/Config.ext.in +0 -0
index 50e801d..1d35ffc 100644
@@ -1,3 +1,20 @@

?menu "Linux Kernel Extensions"

linux/Config.ext.in

Quoted 6 lines
linux/Config.ext.in +6 -0
+# Xenomai
+config BR2_LINUX_KERNEL_EXT_XENOMAI
+ ? ? ? bool "Adeos/Xenomai Real-time patch"
+ ?select BR2_PACKAGE_XENOMAI
+ ? ? ? depends on ((BR2_arm && (BR2_ARM_EABI || BR2_TOOLCHAIN_EXTERNAL)) \
+ ? ? ? ? ? ? ? || BR2_i386)

Why do you restrict this to arm and i386? Xenomai has support for many more architectures, among which powerpc.

linux/Config.ext.in

Quoted 10 lines

+ ? ? ? help
+ ? ? ? ? Xenomai Kernel part.

linux/Config.ext.in +8 -0
+
+config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
+ ? ? ? depends on BR2_LINUX_KERNEL_EXT_XENOMAI
+ ? ? ? string "Path for ADEOS patch file"
+ ? ? ? help
+ ? ? ? ? Xenomai needs Adeos patch.
+ ? ? ? ? You must download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
+ ? ? ? ? and verify that your kernel version in buildroot match.

I think you should mention that this is optional. If you don't specify a patch, the default patches included with the Xenomai distribution will be used.

Quoted 58 lines

+
?endmenu

linux/xenomai.mk new file +29 -0
new file mode 100644
index 0000000..8cffb43
@@ -0,0 +1,29 @@
+##################################################
+# Linux Adeos/Xenomai extensions
+#
+# Patch the linux kernel with xenomai extension
+##################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
+# Add dependency to xenomai (user-space) which provide ksrc part
+LINUX_DEPENDENCIES += xenomai
+
+# Adeos patch version
+XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
+ifeq ($(XENOMAI_ADEOS_PATCH),)
+XENOMAI_ADEOS_OPT = --default
+else
+XENOMAI_ADEOS_OPT = --adeos=$(XENOMAI_ADEOS_PATCH)
+endif
+
+# Prepare kernel patch
+define XENOMAI_PREPARE_KERNEL
+ ? ? ? $(XENOMAI_DIR)/scripts/prepare-kernel.sh \
+ ? ? ? ? ? ? ? --linux=$(LINUX_DIR) \
+ ? ? ? ? ? ? ? --arch=$(BR2_ARCH) \
+ ? ? ? ? ? ? ? $(XENOMAI_ADEOS_OPT)
+endef
+
+LINUX_POST_EXTRACT_HOOKS += XENOMAI_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_XENOMAI
package/Config.in +0 -0
index 2fa9ff5..a461135 100644
@@ -478,6 +478,10 @@ source "package/rpm/Config.in"

?endif
?endmenu

package/Config.in +4 -0
+menu "Real-Time"
+source "package/xenomai/Config.in"
+endmenu
+

?menu "Shell and utilities"
?source "package/at/Config.in"
?if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS

package/xenomai/Config.in new file +0 -0
new file mode 100644
index 0000000..614c564

package/xenomai/Config.in line 4

Quoted 4 lines
package/xenomai/Config.in new file +4 -0
@@ -0,0 +1,81 @@
+config BR2_PACKAGE_XENOMAI
+ ? ? ? bool "Xenomai Userspace"
+ ? ? ? depends on ((BR2_arm && (BR2_ARM_EABI || BR2_TOOLCHAIN_EXTERNAL)) \
+ ? ? ? ? || BR2_i386)

Same comment on architectures.

package/xenomai/Config.in line 14

Quoted 10 lines
package/xenomai/Config.in new file +10 -0
+ ? ? ? help
+ ? ? ? ? Real-Time Framework for Linux
+ ? ? ? ? http://www.xenomai.org
+
+config BR2_PACKAGE_XENOMAI_VERSION
+ ? ? ? depends on BR2_PACKAGE_XENOMAI
+ ? ? ? string "Custom Xenomai version"
+ ? ? ? help
+ ? ? ? ? Manualy select Xenomai Version.
+ ? ? ? ? Take care of compatibility with the Linux kernel.

If you allow specifying a specific version, wouldn't it make sense to create a select statement here? Right now, there is no indication of the default version that would be selected (this is specified in the .mk file).
Making this more like the linux or gdb version selection seems logical to me.

package/xenomai/Config.in line 23

Quoted 9 lines
package/xenomai/Config.in new file +9 -0
+
+# Manually select CPU (use it if not detected)
+config BR2_PACKAGE_XENOMAI_CPU_TYPE_MANUAL
+ ? ? ? bool "Manually Select Xenomai CPU"
+ ? ? ? depends on (BR2_PACKAGE_XENOMAI && !BR2_i386)
+ ? ? ? help
+ ? ? ? ? This option allows you to select Xenomai CPU in a list. Use it only
+ ? ? ? ? if CPU is not auto-detected by Buildroot ! (i.e. your board is not
+ ? ? ? ? described)

What is the reason for this !BR2_i386? Why the exception?

Quoted 174 lines
package/xenomai/Config.in new file +58 -0
+
+choice
+ ? ? ? prompt "Xenomai ARM CPU type"
+ ? ? ? depends on BR2_PACKAGE_XENOMAI && BR2_arm \
+ ? ? ? ? && BR2_PACKAGE_XENOMAI_CPU_TYPE_MANUAL
+ ? ? ? help
+ ? ? ? ? Manually select CPU type for Xenomai.
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_AT91RM9200
+ ? ? ? ? ? ? ? bool "Atmel AT91RM9200"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_AT91SAM926X
+ ? ? ? ? ? ? ? bool "Atmel AT91SAM926X"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_INTEGRATOR
+ ? ? ? ? ? ? ? bool "ARM Ltd. Integrator"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IXP4XX
+ ? ? ? ? ? ? ? bool "Intel IXP4XX (XScale)"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IMX
+ ? ? ? ? ? ? ? bool "Freescale i.MX (MX1/MXL)"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IMX21
+ ? ? ? ? ? ? ? bool "Freescale i.MX21"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_MX2
+ ? ? ? ? ? ? ? bool "Freescale MXC/MX2"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_MX3
+ ? ? ? ? ? ? ? bool "Freescale MXC/MX3"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_SA1100
+ ? ? ? ? ? ? ? bool "StrongARM SA1100"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_S3C2410
+ ? ? ? ? ? ? ? bool "S3C2410"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_GENERIC_ARM
+ ? ? ? ? ? ? ? bool "Generic ARM"
+
+endchoice
+
+# Now set CPU type. We force manually selected type even if detected in case
+# user takes the risk.
+config BR2_PACKAGE_XENOMAI_CPU_TYPE
+ ? ? ? string
+ ? ? ? depends on BR2_PACKAGE_XENOMAI && BR2_arm
+ ? ? ? default "at91rm9200" ?if BR2_PACKAGE_XENOMAI_CPU_AT91RM9200
+ ? ? ? default "at91sam926x" if BR2_PACKAGE_XENOMAI_CPU_AT91SAM926X
+ ? ? ? default "integrator" ?if BR2_PACKAGE_XENOMAI_CPU_INTEGRATOR
+ ? ? ? default "ixp4xx" ? ? ?if BR2_PACKAGE_XENOMAI_CPU_IXP4XX
+ ? ? ? default "generic" ? ? if BR2_PACKAGE_XENOMAI_CPU_GENERIC_ARM
+ ? ? ? default "imx" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_IMX
+ ? ? ? default "imx21" ? ? ? if BR2_PACKAGE_XENOMAI_CPU_IMX21
+ ? ? ? default "mx2" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_MX2
+ ? ? ? default "mx3" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_MX3
+ ? ? ? default "s3c2410" ? ? if BR2_PACKAGE_XENOMAI_CPU_S3C2410
package/xenomai/README new file +48 -0
new file mode 100644
index 0000000..118223a
@@ -0,0 +1,48 @@
+****************
+* Xenomai ? ? ?*
+****************
+
+Xenomai comes with 2 parts : Kernel Part and User-space part.
+Kernel part patch Linux with ADEOS(i-pipe)
+(http://home.gna.org/adeos/) and some Xenomai kernel space stuff.
+
+From Adeos main site :
+"The purpose of Adeos is to provide a flexible environment for sharing
+hardware resources among multiple operating systems, or among multiple
+instances of a single OS."
+
+From Xenomai main site :
+"Xenomai is a real-time development framework cooperating with the
+Linux kernel, in order to provide a pervasive, interface-agnostic,
+hard real-time support to user-space applications, seamlessly
+integrated into the GNU/Linux environment."
+
+****************
+* Installation *
+****************
+
+* Buildroot Kernel: *
+ ?- Check that your version of Linux Kernel is supported by the
+ ? ?version of xenomai you choose.
+ ?- Download Adeos patch at
+ ? ?http://download.gna.org/adeos/patches/v2.6/$(ARCH)/, or if your
+ ? ?are sure, let the Xenomai 'prepare-kernel.sh' script do the work.
+ ?- Check the Xenomai Kernel option in Buildroot :
+ ? ? -> Kernel
+ ? ? ? -> Linux Kernel (BR2_LINUX_KERNEL [=y])
+ ? ? ? ? -> Linux Kernel Extensions
+ ? ? ? ? ? ?-> [*] Adeos/Xenomai Real-time patch
+ ? ? ..And add the path to Adeos patch. (or leave it empty if you let
+ ? ? xenomai script do the work)
+
+* Non-Buildroot Kernel AND Buildroot Kernel *
+ ?- Make sure your Kernel is patched with Xenomai
+ ?- Check the option in Buildroot menu :
+ ? ?-> Package Selection for the target
+ ? ? ? -> Real-time
+ ? ? ? ? ?-> [*] Xenomai Userspace
+ ?- You can download a custom version of Xenomai that fit with your
+ ?Kernel.
+ ?- If you use static /dev and the default device_table, Uncomment
+ ?Xenomai part in 'target/generic/device_table_dev.txt'. (rtheap,
+ ?rtscope and rtp[0-31])
package/xenomai/xenomai-do-not-install-devices.patch new file +11 -0
new file mode 100644
index 0000000..348abee
@@ -0,0 +1,11 @@
+--- a/Makefile.in ? ? ?2011-06-24 16:11:23.591449817 +0200
++++ b/Makefile.in ? ? ?2011-06-24 16:20:29.638129633 +0200
+@@ -719,7 +719,7 @@
+ ? ? ? ? $$sudo mknod -m 666 $(DESTDIR)/dev/rtheap c 10 254 ; \
+ ? ? ? fi
+
+-install-exec-local: devices
++install-exec-local:
+
+ install-user:
+ ? ? ? $(MAKE) SUDO=false install
package/xenomai/xenomai.mk new file +39 -0
new file mode 100644
index 0000000..6819168
@@ -0,0 +1,95 @@
+#############################################################
+# Xenomai
+# URL ?: http://xenomai.org
+# NOTE : Real-Time Framework for Linux
+#
+#############################################################
+
+XENOMAI_VERSION = $(call qstrip,$(BR2_PACKAGE_XENOMAI_VERSION))
+ifeq ($(XENOMAI_VERSION),)
+XENOMAI_VERSION = 2.5.6
+endif
+
+XENOMAI_SITE = http://download.gna.org/xenomai/stable/
+XENOMAI_SOURCE = xenomai-$(XENOMAI_VERSION).tar.bz2
+
+XENOMAI_INSTALL_STAGING = YES
+
+# Only ARM and x86 are supported
+ifeq ($(BR2_arm),y)
+XENOMAI_CPU_TYPE = $(call qstrip,$(BR2_PACKAGE_XENOMAI_CPU_TYPE))
+# Set "generic" if not defined
+ifeq ($(XENOMAI_CPU_TYPE),)
+XENOMAI_CPU_TYPE = generic
+endif
+
+define XENOMAI_CONFIGURE_CMDS
+ ? ? ? (cd $(@D); rm -rf config.cache; \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_OPTS) \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_ARGS) \
+ ? ? ? ? ? ? ? CCFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ ? ? ? ? ? ? ? ./configure \
+ ? ? ? ? ? ? ? --enable-$(BR2_ARCH)-mach=$(XENOMAI_CPU_TYPE) \
+ ? ? ? ? ? ? ? --host=$(BR2_ARCH)-linux \
+ ? ? ? )
+endef
+endif #BR2_arm
+
+# x86
+ifeq ($(BR2_i386),y)

package/xenomai/xenomai.mk line 49

Quoted 10 lines
package/xenomai/xenomai.mk new file +10 -0
+define XENOMAI_CONFIGURE_CMDS
+ ? ? ? (cd $(@D); rm -rf config.cache; \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_OPTS) \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_ARGS) \
+ ? ? ? ? ? ? ? CCFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ ? ? ? ? ? ? ? ./configure \
+ ? ? ? ? ? ? ? --host=$(BR2_ARCH)-linux \
+ ? ? ? )
+endef
+endif # BR2_x86

We had to explicitly enable SMP support in case our kernel was configured that way, otherwise the Xenomai userland detected a feature mismatch between kernel and userland. To achieve this, we added the following to the configure commands:

                    $(if $(shell grep "^CONFIG_SMP*=*y"

$(LINUX26_DIR)/.config ),--enable-smp,) \

I'm not sure this the cleanest way to interrogate the kernel configuration, but it certainly works.

Regarding the architecture selection: in case of powerpc, the configuration commands are the same than for i386. In fact, I think that only ARM is the exception, because the machine type is specified. Therefore, I would suggest to add a variable for extra configure options, which is set for ARM and untouched for other architectures (i386, powerpc, ...). That way, the CONFIGURE_CMDS only need to be specified only once.

package/xenomai/xenomai.mk line 60

Quoted 11 lines
package/xenomai/xenomai.mk new file +11 -0
+
+define XENOMAI_INSTALL_STAGING_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(STAGING_DIR) -C $(@D) install
+endef
+
+define XENOMAI_INSTALL_TARGET_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
+ ? ? ? rm -rf $(TARGET_DIR)/usr/xenomai/share/doc
+ ? ? ? rm -rf $(TARGET_DIR)/usr/xenomai/include
+ ? ? ? echo "/usr/xenomai/lib" > $(TARGET_DIR)/etc/ld.so.conf
+endef

The way you add the lib directory to /etc/ld.so.conf can not co-exist with other packages adding to this file. You should append instead of overwrite. Our solution is this:

# Make sure /etc/ld.so.conf exists
touch $(TARGET_DIR)/etc/ld.so.conf
# Add /usr/xenomai/lib only if it is not yet present (grep "/usr/xenomai/lib" $(TARGET_DIR)/etc/ld.so.conf
&>/dev/null) || (echo "/usr/xenomai/lib" >> $(TARGET_DIR)/etc/ld.so.conf)

Since I think this is a generic pattern when adding something to /etc/ld.so.conf, it could be interesting to put it as a function somewher in buildroot, so that package Makefiles only need to say something like:

        add_to_ld_so_conf("/usr/xenomai/lib")
Quoted 49 lines
package/xenomai/xenomai.mk new file +35 -0
+
+# If you use static /dev creation don't forget to update your
+# ?device_table_dev.txt
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV),y)
+XENOMAI_DEPENDENCIES += udev
+
+define XENOMAI_UDEV_HOOKS
+ ? ? ? if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
+ ? ? ? ? ? ? ? for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
+ ? ? ? ? ? ? ? ? ? ? ? cp $$f $(TARGET_DIR)/etc/udev/rules.d/ ; \
+ ? ? ? ? ? ? ? done ; \
+ ? ? ? fi;
+endef
+
+XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_UDEV_HOOKS
+endif # udev
+
+define XENOMAI_CLEAN_CMDS
+ ? ? ? -$(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) clean
+endef
+
+define XENOMAI_UNINSTALL_TARGET_CMDS
+ ? ? ? if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
+ ? ? ? ? ? ? ? for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
+ ? ? ? ? ? ? ? ? ? ? ? rm -f $(TARGET_DIR)/etc/udev/rules.d/$$f ; \
+ ? ? ? ? ? ? ? done ; \
+ ? ? ? fi;
+ ? ? ? $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) uninstall
+endef
+
+define XENOMAI_UNINSTALL_STAGING_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(STAGING_DIR) -C $(@D) uninstall
+endef
+
+$(eval $(call GENTARGETS,package,xenomai))
target/generic/device_table_dev.txt +0 -0
index a3d53d4..71cd083 100644
@@ -141,3 +141,8 @@
 

?# I2C device nodes
?/dev/i2c- ? ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 89 ? ? ?0 ? ? ? 0 ? ? ? 1 ? ? ? 4

target/generic/device_table_dev.txt +5 -1
+
+# Xenomai
+#/dev/rtheap ? ? c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 10 ? ? ?254 ? ? 0 ? ? ? 0 ? ? ? -
+#/dev/rtscope ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 10 ? ? ?253 ? ? 0 ? ? ? 0 ? ? ? -
+#/dev/rtp ? ? ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 150 ? ? 0 ? ? ? 0 ? ? ? 1 ? ? ? 32
--
Quoted 2 lines

1.7.6

Thanks,
Thomas

#7 lore raw

PATCH 2/2 Add xenomai real-time Framework to buildroot for Arm and x86

Quoted 54 lines · Thomas De Schampheleire

Hi,

Quoted 21 lines · On Wed, Jul 13, 2011 at 5:53 PM, ?<[email protected]> wrote:

From: Benoit Mauduit <[email protected]>

Buildroot Kernel:
?* Download Adeos patch and specify the path into buildroot ? ?menuconfig...
?* ..and take care of Linux kernel version supported by Xenomai.

Non-buildroot Kernel:
?* The User-space part of Xenomai can be built with an external ? ?real-time kernel.

---

?linux/Config.ext.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 17 ++++
?linux/xenomai.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 29 ++++++
?package/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +
?package/xenomai/Config.in ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 81 +++++++++++++++++
?package/xenomai/README ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 48 ++++++++++
?.../xenomai/xenomai-do-not-install-devices.patch ? | ? 11 +++
?package/xenomai/xenomai.mk ? ? ? ? ? ? ? ? ? ? ? ? | ? 95 ++++++++++++++++++++
?target/generic/device_table_dev.txt ? ? ? ? ? ? ? ?| ? ?5 +
Quoted 6 lines

?8 files changed, 290 insertions(+), 0 deletions(-)
?create mode 100644 linux/xenomai.mk
?create mode 100644 package/xenomai/Config.in
?create mode 100644 package/xenomai/README
?create mode 100644 package/xenomai/xenomai-do-not-install-devices.patch ?create mode 100644 package/xenomai/xenomai.mk

Looking forward to have this in buildroot.
Actually, I added support for Xenomai in my buildroot tree, but never got around to submit a proper patch. My changes were based on the xenomai-buildroot patch from the Armadeus project, but with several modifications.

One of these modifications is to add support for a local xenomai installation. However, I understand that Thomas P. is preparing patches that supports this in a generic way, so it doesn't need to be in the xenomai Makefile anymore.

Some comments below...

Quoted 8 lines
linux/Config.ext.in +0 -0
index 50e801d..1d35ffc 100644
@@ -1,3 +1,20 @@

?menu "Linux Kernel Extensions"

Quoted 9 lines

linux/Config.ext.in

Quoted 6 lines
linux/Config.ext.in +6 -0
+# Xenomai
+config BR2_LINUX_KERNEL_EXT_XENOMAI
+ ? ? ? bool "Adeos/Xenomai Real-time patch"
+ ?select BR2_PACKAGE_XENOMAI
+ ? ? ? depends on ((BR2_arm && (BR2_ARM_EABI || BR2_TOOLCHAIN_EXTERNAL)) \
+ ? ? ? ? ? ? ? || BR2_i386)

Why do you restrict this to arm and i386? Xenomai has support for many more architectures, among which powerpc.

I deliberately restrict to ARM and i386 architecture, because I have not tested them.
But you are right, Xenomai is compatible with ARM, Blackfin, Nios II, PowerPc et x86 Architectures.

Quoted 6 lines
Quoted 6 lines

+ ? ? ? help
+ ? ? ? ? Xenomai Kernel part.

linux/Config.ext.in +4 -0
+
+config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
+ ? ? ? depends on BR2_LINUX_KERNEL_EXT_XENOMAI
+ ? ? ? string "Path for ADEOS patch file"
Quoted 9 lines
Quoted 4 lines

+ ? ? ? help
+ ? ? ? ? Xenomai needs Adeos patch.
+ ? ? ? ? You must download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
+ ? ? ? ? and verify that your kernel version in buildroot match.

I think you should mention that this is optional. If you don't specify a patch, the default patches included with the Xenomai distribution will be used.

Oups, i mention that in xenomai/README but forgot it in the menu entry.

Quoted 65 lines
Quoted 58 lines

+
?endmenu

linux/xenomai.mk new file +29 -0
new file mode 100644
index 0000000..8cffb43
@@ -0,0 +1,29 @@
+##################################################
+# Linux Adeos/Xenomai extensions
+#
+# Patch the linux kernel with xenomai extension
+##################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
+# Add dependency to xenomai (user-space) which provide ksrc part
+LINUX_DEPENDENCIES += xenomai
+
+# Adeos patch version
+XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
+ifeq ($(XENOMAI_ADEOS_PATCH),)
+XENOMAI_ADEOS_OPT = --default
+else
+XENOMAI_ADEOS_OPT = --adeos=$(XENOMAI_ADEOS_PATCH)
+endif
+
+# Prepare kernel patch
+define XENOMAI_PREPARE_KERNEL
+ ? ? ? $(XENOMAI_DIR)/scripts/prepare-kernel.sh \
+ ? ? ? ? ? ? ? --linux=$(LINUX_DIR) \
+ ? ? ? ? ? ? ? --arch=$(BR2_ARCH) \
+ ? ? ? ? ? ? ? $(XENOMAI_ADEOS_OPT)
+endef
+
+LINUX_POST_EXTRACT_HOOKS += XENOMAI_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_XENOMAI
package/Config.in +0 -0
index 2fa9ff5..a461135 100644
@@ -478,6 +478,10 @@ source "package/rpm/Config.in"

?endif
?endmenu

package/Config.in +4 -0
+menu "Real-Time"
+source "package/xenomai/Config.in"
+endmenu
+

?menu "Shell and utilities"
?source "package/at/Config.in"
?if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS

package/xenomai/Config.in new file +0 -0
new file mode 100644
index 0000000..614c564

package/xenomai/Config.in line 4

Quoted 4 lines
package/xenomai/Config.in new file +4 -0
@@ -0,0 +1,81 @@
+config BR2_PACKAGE_XENOMAI
+ ? ? ? bool "Xenomai Userspace"
+ ? ? ? depends on ((BR2_arm && (BR2_ARM_EABI || BR2_TOOLCHAIN_EXTERNAL)) \
+ ? ? ? ? || BR2_i386)

Same comment on architectures.

Quoted 17 lines

package/xenomai/Config.in line 14

Quoted 10 lines
package/xenomai/Config.in new file +10 -0
+ ? ? ? help
+ ? ? ? ? Real-Time Framework for Linux
+ ? ? ? ? http://www.xenomai.org
+
+config BR2_PACKAGE_XENOMAI_VERSION
+ ? ? ? depends on BR2_PACKAGE_XENOMAI
+ ? ? ? string "Custom Xenomai version"
+ ? ? ? help
+ ? ? ? ? Manualy select Xenomai Version.
+ ? ? ? ? Take care of compatibility with the Linux kernel.

If you allow specifying a specific version, wouldn't it make sense to create a select statement here? Right now, there is no indication of the default version that would be selected (this is specified in the .mk file).
Making this more like the linux or gdb version selection seems logical to me.

Ok. Personally I prefer for package to do like that, because it's easier for version bumping.

Quoted 12 lines

package/xenomai/Config.in line 23

Quoted 9 lines
package/xenomai/Config.in new file +9 -0
+
+# Manually select CPU (use it if not detected)
+config BR2_PACKAGE_XENOMAI_CPU_TYPE_MANUAL
+ ? ? ? bool "Manually Select Xenomai CPU"
+ ? ? ? depends on (BR2_PACKAGE_XENOMAI && !BR2_i386)
+ ? ? ? help
+ ? ? ? ? This option allows you to select Xenomai CPU in a list. Use it only
+ ? ? ? ? if CPU is not auto-detected by Buildroot ! (i.e. your board is not
+ ? ? ? ? described)

What is the reason for this !BR2_i386? Why the exception?

Because when we compile for x86 arch, the configure script doesn't need this option.
In fact, the makefile is wrong, because only "--enable-arm-mach=" is correct (and not --enable-$(BR2_ARCH)-mach).

Quoted 192 lines
Quoted 174 lines
package/xenomai/Config.in new file +58 -0
+
+choice
+ ? ? ? prompt "Xenomai ARM CPU type"
+ ? ? ? depends on BR2_PACKAGE_XENOMAI && BR2_arm \
+ ? ? ? ? && BR2_PACKAGE_XENOMAI_CPU_TYPE_MANUAL
+ ? ? ? help
+ ? ? ? ? Manually select CPU type for Xenomai.
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_AT91RM9200
+ ? ? ? ? ? ? ? bool "Atmel AT91RM9200"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_AT91SAM926X
+ ? ? ? ? ? ? ? bool "Atmel AT91SAM926X"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_INTEGRATOR
+ ? ? ? ? ? ? ? bool "ARM Ltd. Integrator"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IXP4XX
+ ? ? ? ? ? ? ? bool "Intel IXP4XX (XScale)"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IMX
+ ? ? ? ? ? ? ? bool "Freescale i.MX (MX1/MXL)"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_IMX21
+ ? ? ? ? ? ? ? bool "Freescale i.MX21"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_MX2
+ ? ? ? ? ? ? ? bool "Freescale MXC/MX2"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_MX3
+ ? ? ? ? ? ? ? bool "Freescale MXC/MX3"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_SA1100
+ ? ? ? ? ? ? ? bool "StrongARM SA1100"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_S3C2410
+ ? ? ? ? ? ? ? bool "S3C2410"
+
+ ? ? ? config BR2_PACKAGE_XENOMAI_CPU_GENERIC_ARM
+ ? ? ? ? ? ? ? bool "Generic ARM"
+
+endchoice
+
+# Now set CPU type. We force manually selected type even if detected in case
+# user takes the risk.
+config BR2_PACKAGE_XENOMAI_CPU_TYPE
+ ? ? ? string
+ ? ? ? depends on BR2_PACKAGE_XENOMAI && BR2_arm
+ ? ? ? default "at91rm9200" ?if BR2_PACKAGE_XENOMAI_CPU_AT91RM9200
+ ? ? ? default "at91sam926x" if BR2_PACKAGE_XENOMAI_CPU_AT91SAM926X
+ ? ? ? default "integrator" ?if BR2_PACKAGE_XENOMAI_CPU_INTEGRATOR
+ ? ? ? default "ixp4xx" ? ? ?if BR2_PACKAGE_XENOMAI_CPU_IXP4XX
+ ? ? ? default "generic" ? ? if BR2_PACKAGE_XENOMAI_CPU_GENERIC_ARM
+ ? ? ? default "imx" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_IMX
+ ? ? ? default "imx21" ? ? ? if BR2_PACKAGE_XENOMAI_CPU_IMX21
+ ? ? ? default "mx2" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_MX2
+ ? ? ? default "mx3" ? ? ? ? if BR2_PACKAGE_XENOMAI_CPU_MX3
+ ? ? ? default "s3c2410" ? ? if BR2_PACKAGE_XENOMAI_CPU_S3C2410
package/xenomai/README new file +48 -0
new file mode 100644
index 0000000..118223a
@@ -0,0 +1,48 @@
+****************
+* Xenomai ? ? ?*
+****************
+
+Xenomai comes with 2 parts : Kernel Part and User-space part.
+Kernel part patch Linux with ADEOS(i-pipe)
+(http://home.gna.org/adeos/) and some Xenomai kernel space stuff.
+
+From Adeos main site :
+"The purpose of Adeos is to provide a flexible environment for sharing
+hardware resources among multiple operating systems, or among multiple
+instances of a single OS."
+
+From Xenomai main site :
+"Xenomai is a real-time development framework cooperating with the
+Linux kernel, in order to provide a pervasive, interface-agnostic,
+hard real-time support to user-space applications, seamlessly
+integrated into the GNU/Linux environment."
+
+****************
+* Installation *
+****************
+
+* Buildroot Kernel: *
+ ?- Check that your version of Linux Kernel is supported by the
+ ? ?version of xenomai you choose.
+ ?- Download Adeos patch at
+ ? ?http://download.gna.org/adeos/patches/v2.6/$(ARCH)/, or if your
+ ? ?are sure, let the Xenomai 'prepare-kernel.sh' script do the work.
+ ?- Check the Xenomai Kernel option in Buildroot :
+ ? ? -> Kernel
+ ? ? ? -> Linux Kernel (BR2_LINUX_KERNEL [=y])
+ ? ? ? ? -> Linux Kernel Extensions
+ ? ? ? ? ? ?-> [*] Adeos/Xenomai Real-time patch
+ ? ? ..And add the path to Adeos patch. (or leave it empty if you let
+ ? ? xenomai script do the work)
+
+* Non-Buildroot Kernel AND Buildroot Kernel *
+ ?- Make sure your Kernel is patched with Xenomai
+ ?- Check the option in Buildroot menu :
+ ? ?-> Package Selection for the target
+ ? ? ? -> Real-time
+ ? ? ? ? ?-> [*] Xenomai Userspace
+ ?- You can download a custom version of Xenomai that fit with your
+ ?Kernel.
+ ?- If you use static /dev and the default device_table, Uncomment
+ ?Xenomai part in 'target/generic/device_table_dev.txt'. (rtheap,
+ ?rtscope and rtp[0-31])
package/xenomai/xenomai-do-not-install-devices.patch new file +11 -0
new file mode 100644
index 0000000..348abee
@@ -0,0 +1,11 @@
+--- a/Makefile.in ? ? ?2011-06-24 16:11:23.591449817 +0200
++++ b/Makefile.in ? ? ?2011-06-24 16:20:29.638129633 +0200
+@@ -719,7 +719,7 @@
+ ? ? ? ? $$sudo mknod -m 666 $(DESTDIR)/dev/rtheap c 10 254 ; \
+ ? ? ? fi
+
+-install-exec-local: devices
++install-exec-local:
+
+ install-user:
+ ? ? ? $(MAKE) SUDO=false install
package/xenomai/xenomai.mk new file +39 -0
new file mode 100644
index 0000000..6819168
@@ -0,0 +1,95 @@
+#############################################################
+# Xenomai
+# URL ?: http://xenomai.org
+# NOTE : Real-Time Framework for Linux
+#
+#############################################################
+
+XENOMAI_VERSION = $(call qstrip,$(BR2_PACKAGE_XENOMAI_VERSION))
+ifeq ($(XENOMAI_VERSION),)
+XENOMAI_VERSION = 2.5.6
+endif
+
+XENOMAI_SITE = http://download.gna.org/xenomai/stable/
+XENOMAI_SOURCE = xenomai-$(XENOMAI_VERSION).tar.bz2
+
+XENOMAI_INSTALL_STAGING = YES
+
+# Only ARM and x86 are supported
+ifeq ($(BR2_arm),y)
+XENOMAI_CPU_TYPE = $(call qstrip,$(BR2_PACKAGE_XENOMAI_CPU_TYPE))
+# Set "generic" if not defined
+ifeq ($(XENOMAI_CPU_TYPE),)
+XENOMAI_CPU_TYPE = generic
+endif
+
+define XENOMAI_CONFIGURE_CMDS
+ ? ? ? (cd $(@D); rm -rf config.cache; \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_OPTS) \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_ARGS) \
+ ? ? ? ? ? ? ? CCFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ ? ? ? ? ? ? ? ./configure \
+ ? ? ? ? ? ? ? --enable-$(BR2_ARCH)-mach=$(XENOMAI_CPU_TYPE) \
+ ? ? ? ? ? ? ? --host=$(BR2_ARCH)-linux \
+ ? ? ? )
+endef
+endif #BR2_arm
+
+# x86
+ifeq ($(BR2_i386),y)

package/xenomai/xenomai.mk line 49

Quoted 10 lines
package/xenomai/xenomai.mk new file +10 -0
+define XENOMAI_CONFIGURE_CMDS
+ ? ? ? (cd $(@D); rm -rf config.cache; \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_OPTS) \
+ ? ? ? ? ? ? ? $(TARGET_CONFIGURE_ARGS) \
+ ? ? ? ? ? ? ? CCFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
+ ? ? ? ? ? ? ? ./configure \
+ ? ? ? ? ? ? ? --host=$(BR2_ARCH)-linux \
+ ? ? ? )
+endef
+endif # BR2_x86

We had to explicitly enable SMP support in case our kernel was configured that way, otherwise the Xenomai userland detected a feature mismatch between kernel and userland. To achieve this, we added the following to the configure commands:
? ? ? ? ? ? ? ? ? ?$(if $(shell grep "^CONFIG_SMP*=*y" $(LINUX26_DIR)/.config ),--enable-smp,) \

Quoted 3 lines

I'm not sure this the cleanest way to interrogate the kernel configuration, but it certainly works.

I will add this to the patch.
I think a generic way to check other Kconfig-based package options is an interesting feature to add to Buildroot.

Quoted 32 lines

Regarding the architecture selection: in case of powerpc, the configuration commands are the same than for i386. In fact, I think that only ARM is the exception, because the machine type is specified. Therefore, I would suggest to add a variable for extra configure options, which is set for ARM and untouched for other architectures (i386, powerpc, ...). That way, the CONFIGURE_CMDS only need to be specified only once.

package/xenomai/xenomai.mk line 60

Quoted 11 lines
package/xenomai/xenomai.mk new file +11 -0
+
+define XENOMAI_INSTALL_STAGING_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(STAGING_DIR) -C $(@D) install
+endef
+
+define XENOMAI_INSTALL_TARGET_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
+ ? ? ? rm -rf $(TARGET_DIR)/usr/xenomai/share/doc
+ ? ? ? rm -rf $(TARGET_DIR)/usr/xenomai/include
+ ? ? ? echo "/usr/xenomai/lib" > $(TARGET_DIR)/etc/ld.so.conf
+endef

The way you add the lib directory to /etc/ld.so.conf can not co-exist with other packages adding to this file. You should append instead of overwrite. Our solution is this:

? ? ? # Make sure /etc/ld.so.conf exists
? ? ? ?touch $(TARGET_DIR)/etc/ld.so.conf
? ? ? ?# Add /usr/xenomai/lib only if it is not yet present ? ? ? ?(grep "/usr/xenomai/lib" $(TARGET_DIR)/etc/ld.so.conf &>/dev/null) || (echo "/usr/xenomai/lib" >> $(TARGET_DIR)/etc/ld.so.conf)

Quoted 6 lines

Since I think this is a generic pattern when adding something to /etc/ld.so.conf, it could be interesting to put it as a function somewher in buildroot, so that package Makefiles only need to say something like:
? ? ? ?add_to_ld_so_conf("/usr/xenomai/lib")

I agree with you. I will try to make a patch if I find some time.

Quoted 41 lines
Quoted 41 lines
package/xenomai/xenomai.mk new file +35 -0
+
+# If you use static /dev creation don't forget to update your
+# ?device_table_dev.txt
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV),y)
+XENOMAI_DEPENDENCIES += udev
+
+define XENOMAI_UDEV_HOOKS
+ ? ? ? if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
+ ? ? ? ? ? ? ? for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
+ ? ? ? ? ? ? ? ? ? ? ? cp $$f $(TARGET_DIR)/etc/udev/rules.d/ ; \
+ ? ? ? ? ? ? ? done ; \
+ ? ? ? fi;
+endef
+
+XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_UDEV_HOOKS
+endif # udev
+
+define XENOMAI_CLEAN_CMDS
+ ? ? ? -$(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) clean
+endef
+
+define XENOMAI_UNINSTALL_TARGET_CMDS
+ ? ? ? if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
+ ? ? ? ? ? ? ? for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
+ ? ? ? ? ? ? ? ? ? ? ? rm -f $(TARGET_DIR)/etc/udev/rules.d/$$f ; \
+ ? ? ? ? ? ? ? done ; \
+ ? ? ? fi;
+ ? ? ? $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) uninstall
+endef
+
+define XENOMAI_UNINSTALL_STAGING_CMDS
+ ? ? ? $(MAKE) DESTDIR=$(STAGING_DIR) -C $(@D) uninstall
+endef
+
+$(eval $(call GENTARGETS,package,xenomai))
target/generic/device_table_dev.txt +0 -0
index a3d53d4..71cd083 100644
@@ -141,3 +141,8 @@
 
Quoted 14 lines
Quoted 10 lines

?# I2C device nodes
?/dev/i2c- ? ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 89 ? ? ?0 ? ? ? 0 ? ? ? 1 ? ? ? 4

target/generic/device_table_dev.txt +5 -1
+
+# Xenomai
+#/dev/rtheap ? ? c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 10 ? ? ?254 ? ? 0 ? ? ? 0 ? ? ? -
+#/dev/rtscope ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 10 ? ? ?253 ? ? 0 ? ? ? 0 ? ? ? -
+#/dev/rtp ? ? ? ?c ? ? ? 666 ? ? 0 ? ? ? 0 ? ? ? 150 ? ? 0 ? ? ? 0 ? ? ? 1 ? ? ? 32
--

1.7.6

Thanks,
Thomas

Thanks for feedbacks !
Regards,

Signature · 1 line
Benoit Mauduit
#8 lore raw

cover Add Xenomai real-time framework

In reply to benoit.mauduit at gmail.com

Hello Benoit,

Le Wed, 13 Jul 2011 17:52:58 +0200,
benoit.mauduit at gmail.com a ?crit :

Quoted 3 lines

From: Benoit Mauduit <[email protected]>

These two patches are an initial add for Xenomai in buildroot.

Hey, this is great!

I did a quick review. There a few things I am not totally happy with, but I like the way you hooked up the Xenomai kernel patch into the kernel build process.

I will have a more detailed look, do some testing, and give some more precise feedback.

Thanks again for doing this work!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw

cover Add Xenomai real-time framework

Hi Benoit, Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello Benoit,

Le Wed, 13 Jul 2011 17:52:58 +0200,
benoit.mauduit at gmail.com a ?crit :

Quoted 3 lines

From: Benoit Mauduit <[email protected]>

These two patches are an initial add for Xenomai in buildroot.

Hey, this is great!

Quoted 8 lines

I did a quick review. There a few things I am not totally happy with, but I like the way you hooked up the Xenomai kernel patch into the kernel build process.

I will have a more detailed look, do some testing, and give some more precise feedback.

Thanks again for doing this work!

What is the current status of this? I haven't seen any recent updated patches for xenomai in buildroot.

Benoit, do you have the time to submit a new patch based on the feedback you received?
Thomas (P.), are there more comments you wanted to add?

Thanks,
Thomas

#10 lore raw

cover Add Xenomai real-time framework

Le Mon, 12 Sep 2011 21:24:40 +0200,
Thomas De Schampheleire <[email protected]> a ?crit :

Quoted 6 lines

What is the current status of this? I haven't seen any recent updated patches for xenomai in buildroot.

Benoit, do you have the time to submit a new patch based on the feedback you received?
Thomas (P.), are there more comments you wanted to add?

I haven't had the time to do a more careful review process yet, but it's on my TODO-list: my colleague Maxime Ripard can testify that I did talk to him today about those Xenomai patches.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw

cover Add Xenomai real-time framework

Quoted 14 lines · Thomas Petazzoni

Le Mon, 12 Sep 2011 21:24:40 +0200,
Thomas De Schampheleire <[email protected]> a ?crit :

Quoted 6 lines

What is the current status of this? I haven't seen any recent updated patches for xenomai in buildroot.

Benoit, do you have the time to submit a new patch based on the feedback you received?
Thomas (P.), are there more comments you wanted to add?

I haven't had the time to do a more careful review process yet, but it's on my TODO-list: my colleague Maxime Ripard can testify that I did talk to him today about those Xenomai patches.

Quoted 9 lines

Regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

Hello,

I am sorry but i am very busy this last weeks. (new job, etc...)

But, it is on my TODO-list and I think i will resend patches for the next week-end.

Thanks for the reminder :)

Regards,

Ps: D?sol? Thomas pour le fail :)

Signature · 1 line
Benoit Mauduit
#12 lore raw

cover Add Xenomai real-time framework

Hello Thomas, Beno?t,

2011/9/13 Beno?t Mauduit <[email protected]>:

Quoted 26 lines
Quoted 14 lines · Thomas Petazzoni

Le Mon, 12 Sep 2011 21:24:40 +0200,
Thomas De Schampheleire <[email protected]> a ?crit :

Quoted 6 lines

What is the current status of this? I haven't seen any recent updated patches for xenomai in buildroot.

Benoit, do you have the time to submit a new patch based on the feedback you received?
Thomas (P.), are there more comments you wanted to add?

I haven't had the time to do a more careful review process yet, but it's on my TODO-list: my colleague Maxime Ripard can testify that I did talk to him today about those Xenomai patches.

Quoted 9 lines

Regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

Quoted 8 lines

Hello,

I am sorry but i am very busy this last weeks. (new job, etc...)

But, it is on my TODO-list and I think i will resend patches for the next week-end.

Thanks for the reminder :)

I was in the process of upgrading to buildroot-2011.08, and had to fix my own Xenomai patch anyway, so I decided to switch to your patches. I modified them according to the comments I gave earlier, and tested on a powerpc target with SMP.

I attach the changes to your patches to this mail, for your reference. I'll send the resulting patch as a separate mail.

Feel free to make whatever modifications you still want to make, e.g. on feedback from Thomas.

Best regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xenomai-01-changes.patch
Type: application/octet-stream
Size: 793 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20110914/27d9f76b/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xenomai-02-changes.patch
Type: application/octet-stream
Size: 4226 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20110914/27d9f76b/attachment-0003.obj>