Wolfgang Grandegger wrote:

> Jan Kiszka wrote:
>   
>> Wolfgang Grandegger wrote:
>>     
>>> Jan Kiszka wrote:
>>>       
>>>> Hi,
>>>>         
>>>> the new Xenomai example repository has been created. I don't want to
>>>>         
>>>> repeat here what is explained already on the related wiki page, please
>>>>         
>>>> have a look at
>>>>         
>>>>     http://www.xenomai.org/index.php/Examples
>>>>         
>>>> Instead, let me sketch what could be done next:
>>>>         
>>>>  o Port existing examples, snippets, demos from ksrc/skins/* over, make
>>>>         
>>>>    them compilable and runnable if required.
>>>>         
>>>>  o Identify what kind of examples are lacking. You, the user, is needed
>>>>         
>>>>    here. What do *you* think is missing, what would be helpful to show?
>>>>         
>>>>  o Check what is needed to compile kernel-based examples over PPC 2.4.
>>>>         
>>>>    Philippe indicated that some switches are likely missing (x86 is fine
>>>>         
>>>>    already, other archs are 2.6-only).
>>>>         
>>> Some time ago I sent a patch for RTnet using the "kernel CFLAGS
>>>       
>>> capturing" trick to get proper switches for 2.4:
>>>       
>>> http://sourceforge.net/mailarchive/forum.php?thread_id=9493711&forum_id=24610
>>>       
>>>       
>>> We could do the same trick here.
>>>       
>> Yeah, I had a look at this before. The point is that I would prefer to
>>     
>> keep things _simple_ and self-contained. This capturing requires some
>>     
>> helper Makefile and complex call nestings that likely only people with
>>     
>> advanced make and shell skills can understand and adopt to their projects.
>>     
>> But maybe things are that complicated already, and this is just
>>     
>> different complexity. How do you compile simple out-of-tree modules
>>     
>> against 2.4 PPC kernels? Are there any standard flags? Or is it
>>     
>> different for each board or each compiler version or whatever?
>>     
> I just cut and paste the flags from a kernel module make. For PPC, there 
> are plenty of flags, not board but some are processor depended, but I'm 
> unable to tell which one are really required. For this reason I like the 
> module capturing trick.
>   
What about this patch? I /seems/ to work (yeah, only tested on x86...), merging 
the
whole capturing stuff into the same Makefile. Please give it hell on PPC.

Index: rtdm/driver-api/Makefile
===================================================================
--- rtdm/driver-api/Makefile    (Revision 1916)
+++ rtdm/driver-api/Makefile    (Arbeitskopie)
@@ -47,23 +47,23 @@ ifneq ($(MODULES),)
 
 OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
+PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-# Kernel 2.6
+### Kernel 2.6
 ifeq ($(findstring 2.6,$(KSRC)),2.6)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
-PWD          := $(shell pwd)
 
 all::
        $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
 
-# Kernel 2.4
+### Kernel 2.4
 else
 
+ARCH    ?= $(shell uname -i)
 INCLUDE := -I$(KSRC)/include -I$(KSRC)/include/xenomai 
-I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix
-CFLAGS  += -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -DMODULE -D__KERNEL__ 
-DLINUX \
-           -fno-strict-aliasing -fno-common $(INCLUDE) $(ADD_CFLAGS)
+CFLAGS  += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) 
modules) $(INCLUDE) $(ADD_CFLAGS)
 
 all:: $(OBJS)
 
@@ -74,3 +74,7 @@ clean::
        $(RM) -R .tmp*
 
 endif
+
+## Target for capturing 2.4 module CFLAGS
+modules:
+       @echo "$(CFLAGS)"


Jan


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to