summaryrefslogtreecommitdiff
path: root/linux/linux-ext-rtai.mk
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2011-09-17 22:22:58 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2011-09-18 23:00:07 +0200
commit8797a9cd1fe6723db34b0c125d0d9d04e3483e8d (patch)
treeb85dbf581c7d1a8adda8047971c6b2ee7c6c8873 /linux/linux-ext-rtai.mk
parenta473a616d27e46951a23d90249a31b08006098bf (diff)
Add support for the RTAI real-time extension
[Peter: fix rtai Config.in] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'linux/linux-ext-rtai.mk')
-rw-r--r--linux/linux-ext-rtai.mk47
1 files changed, 47 insertions, 0 deletions
diff --git a/linux/linux-ext-rtai.mk b/linux/linux-ext-rtai.mk
new file mode 100644
index 000000000..a54230d32
--- /dev/null
+++ b/linux/linux-ext-rtai.mk
@@ -0,0 +1,47 @@
+##################################################
+# Linux RTAI extensions
+#
+# Patch the linux kernel with RTAI extension
+##################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_RTAI),y)
+# Add dependency to RTAI (user-space) which provide kernel patches
+LINUX_DEPENDENCIES += rtai-patch
+
+RTAI_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_RTAI_PATCH))
+
+ifeq ($(KERNEL_ARCH),i386)
+RTAI_ARCH = x86
+else ifeq ($(KERNEL_ARCH),x86_64)
+RTAI_ARCH = x86
+else ifeq ($(KERNEL_ARCH),powerpc)
+RTAI_ARCH = ppc
+else
+RTAI_ARCH = $(KERNEL_ARCH)
+endif
+
+# Prepare kernel patch
+ifeq ($(RTAI_PATCH),)
+define RTAI_PREPARE_KERNEL
+ kver=`$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelversion` ; \
+ if test -f $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/hal-linux-$${kver}-*patch ; then \
+ support/script/apply-patches.sh $(LINUX_DIR) \
+ $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/ \
+ hal-linux-$${kver}-*patch ; \
+ else \
+ echo "No RTAI patch for your kernel version" ; \
+ exit 1 ; \
+ fi
+endef
+else
+define RTAI_PREPARE_KERNEL
+ support/script/apply-patches.sh \
+ $(LINUX_DIR) \
+ $(dir $(RTAI_PATCH)) \
+ $(notdir $(RTAI_PATCH))
+endef
+endif
+
+LINUX_POST_PATCH_HOOKS += RTAI_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_RTAI