Skip to contentSkip to conversation

Xenomai Example Repository

Xenomai-core Jan Kiszka 3 participants 10 messages Dec 1, 2006 – Dec 3, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

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).

o Regarding RTDM: driver patterns would be nice. Someone (who I don't recall ATM, sorry) once posted a template for a PCI driver. Feel invited to repost an updated version. Any further suggestion or ready code is welcome as well.

Jan

#1 lore raw
Quoted 13 lines · Jan Kiszka

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.

Quoted 6 lines

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.

Quoted 7 lines

o Regarding RTDM: driver patterns would be nice. Someone (who I don't recall ATM, sorry) once posted a template for a PCI driver. Feel invited to repost an updated version. Any further suggestion or ready code is welcome as well.

Jan

Wolfgang.

author
#2 lore raw
Quoted 21 lines · Wolfgang Grandegger
Quoted 13 lines · Jan Kiszka

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.

Quoted 6 lines

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).

Quoted 7 lines

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?

Jan

#3 lore raw
Quoted 28 lines · Jan Kiszka
Quoted 27 lines · Wolfgang Grandegger
Quoted 13 lines · Jan Kiszka

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.

Quoted 6 lines

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

Quoted 6 lines
Quoted 1 line

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.

I tend to agree on the "keep it simple" mantra, but still, there are at least two other aspects which are quite important too:

- Nobody should expect to be able to develop a complete project only relying on paste-and-copy of example code. Since we are specifically talking about Makefile rules, we could not provide any set that would match everyone's project anyway, with respect to software and hardware requirements. Therefore, at some point, people really need to know what they are doing, which means that they should also know how to properly build out-of-tree modules with _their_ own 2.4 setup (well, if any "proper" solution exists, that is). And basically, I do hope that nobody starts implementing kernel modules without having - at least - a vague idea, about how to compile them for its platform in the first place...

- Given that there is life beyond x86, we need to make sure that all Xenomai ports are considered equal, at least with respect to generic issues. Whilst it's ok to provide a x86-only 2.4 Makefile for compiling a x86-centric example, it's not for anything which could demonstrate a feature on any platform.

This said, I agree that adding a fake module directory to capture the flags set by the main kernel Makefile is one step beyond ugliness; the other approach being to only provide a 2.6 Makefile frag. As 2007 approaches, I think that anyone still involved with projects relying on 2.4 kernels do know how to build 2.4 modules for the targeted platform.

Quoted 12 lines

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?

Jan

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#6 lore raw
In reply to Jan Kiszka
Quoted 34 lines · Jan Kiszka
Quoted 20 lines · Wolfgang Grandegger
Quoted 13 lines · Jan Kiszka

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.

Quoted 6 lines

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).

Quoted 7 lines

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.

Quoted 4 lines

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.

Wolfgang.

#4 lore raw
In reply to Philippe Gerum
Quoted 54 lines · Philippe Gerum
Quoted 24 lines · Jan Kiszka
Quoted 23 lines · Wolfgang Grandegger
Quoted 13 lines · Jan Kiszka

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.

Quoted 6 lines

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:

Quoted 8 lines
Quoted 4 lines

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.

I tend to agree on the "keep it simple" mantra, but still, there are at least two other aspects which are quite important too:

- Nobody should expect to be able to develop a complete project only relying on paste-and-copy of example code. Since we are specifically talking about Makefile rules, we could not provide any set that would match everyone's project anyway, with respect to software and hardware requirements. Therefore, at some point, people really need to know what they are doing, which means that they should also know how to properly build out-of-tree modules with _their_ own 2.4 setup (well, if any "proper" solution exists, that is). And basically, I do hope that nobody starts implementing kernel modules without having - at least - a vague idea, about how to compile them for its platform in the first place...

- Given that there is life beyond x86, we need to make sure that all Xenomai ports are considered equal, at least with respect to generic issues. Whilst it's ok to provide a x86-only 2.4 Makefile for compiling a x86-centric example, it's not for anything which could demonstrate a feature on any platform.

Quoted 5 lines

This said, I agree that adding a fake module directory to capture the flags set by the main kernel Makefile is one step beyond ugliness; the other approach being to only provide a 2.6 Makefile frag. As 2007 approaches, I think that anyone still involved with projects relying on 2.4 kernels do know how to build 2.4 modules for the targeted platform.

I think the example modules should compile on any platform and the "kernel CFLAGS capturing" trick is the most straight-forward way to do it for 2.4. It simplifies our life, avoids fiddling with various arch dependent flags in the Makefile, which will be even more ugly, and it serves as an example on how to get proper flags. Therefore I tend to add an appropriate script to the "scripts" subdirectory.

Quoted 11 lines
Quoted 11 lines

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?

Jan

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

#5 lore raw
Quoted 1 line · Wolfgang Grandegger
Quoted 1 line

[...]

Quoted 7 lines
Quoted 6 lines

This said, I agree that adding a fake module directory to capture the flags set by the main kernel Makefile is one step beyond ugliness; the other approach being to only provide a 2.6 Makefile frag. As 2007 approaches, I think that anyone still involved with projects relying on 2.4 kernels do know how to build 2.4 modules for the targeted platform.

Quoted 6 lines

I think the example modules should compile on any platform and the "kernel CFLAGS capturing" trick is the most straight-forward way to do it for 2.4. It simplifies our life, avoids fiddling with various arch dependent flags in the Makefile, which will be even more ugly, and it serves as an example on how to get proper flags. Therefore I tend to add an appropriate script to the "scripts" subdirectory.

That would be acceptable too; the capture trick is ugly, but if we really want to have the generic examples available to all platforms, I see no other way to get the exact compilation and link flags. So it's basically a matter of choice: either we don't provide any Makefile frag for 2.4, or we implement the capture trick so that every platform can compile them.

Signature · 1 line
Philippe.
author
#7 lore raw
In reply to Wolfgang Grandegger
Quoted 53 lines · Wolfgang Grandegger
Quoted 51 lines · Jan Kiszka
Quoted 28 lines · Wolfgang Grandegger
Quoted 18 lines · Jan Kiszka

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

Quoted 8 lines

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).

Quoted 9 lines

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

Quoted 9 lines
Quoted 4 lines

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.

driver-api/Makefile +9 -5
Index: rtdm/driver-api/Makefile
===================================================================
@@ -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

#8 lore raw

Hi Jan,

Quoted 55 lines · Jan Kiszka
Quoted 53 lines · Wolfgang Grandegger
Quoted 51 lines · Jan Kiszka
Quoted 28 lines · Wolfgang Grandegger
Quoted 18 lines · Jan Kiszka

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

Quoted 8 lines

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).

Quoted 9 lines

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

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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.

The attached Makefile works. I had to fix two problems. First, cross compilation was not supported. I now take the CC from "xeno-config --cc" for user space applications. I think "xeno-config" is intended only for making user space applications and therefore CC should be specified on the command line for kernel modules:

$ make KSRC=/devel/linuxppc_2_4_devel ARCH=ppc CC=ppc-linux-gcc
ppc-linux-gcc -D__KERNEL__ -I/devel/linuxppc_2_4_devel/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -I/devel/linuxppc_2_4_devel/arch/ppc -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring -g -ggdb -DMODULE -I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai -I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai/compat -I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai/posix    -c -o heartbeat-x86.o heartbeat-x86.c

Furthermore I removed "-I$(KSRC)/include", it is already included in the captured CFLAGS.

Wolfgang.

Quoted 44 lines

Index: rtdm/driver-api/Makefile
===================================================================

driver-api/Makefile +9 -5
@@ -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)"
Quoted 3 lines

Jan

###### CONFIGURATION ######

### List of applications to be build
APPLICATIONS =

### Note: to override the search path for the xeno-config script, use "make XENO=..."

### List of modules to be build
MODULES = heartbeat-x86

### Default to sources of currently running kernel KSRC ?= /lib/modules/$(shell uname -r)/build

### Note: to override the kernel source path, use "make KSRC=..."

###### USER SPACE BUILD (no change required normally) ###### ifneq ($(APPLICATIONS),)

XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config 2>/dev/null)

### Sanity check
ifeq ($(XENOCONFIG),)
all::

	@echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"
	@echo

endif

CC=$(shell $(XENOCONFIG) --cc)

CFLAGS=$(shell $(XENOCONFIG) --xeno-cflags) $(MY_CFLAGS)

LDFLAGS=$(shell $(XENOCONFIG) --xeno-ldflags) $(MY_LDFLAGS) -lnative -lrtdm

all:: $(APPLICATIONS)

clean::

	$(RM) $(APPLICATIONS) *.o

endif

###### KERNEL MODULE BUILD (no change required normally) ###### ifneq ($(MODULES),)

OBJS := ${patsubst %, %.o, $(MODULES)}
CLEANMOD := ${patsubst %, .%*, $(MODULES)}
PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)

### 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)

all::

	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules

### Kernel 2.4
else

ARCH ?= $(shell uname -i)
INCLUDE := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix CFLAGS += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) modules) $(INCLUDE) $(ADD_CFLAGS)

all:: $(OBJS)

endif

clean::

	$(RM) $(CLEANMOD) *.cmd *.o *.ko *.mod.c Module*.symvers
	$(RM) -R .tmp*

endif

## Target for capturing 2.4 module CFLAGS
modules:

	@echo "$(CFLAGS)"
author
#9 lore raw
Quoted 60 lines · Wolfgang Grandegger

Hi Jan,

Quoted 48 lines · Jan Kiszka
Quoted 46 lines · Wolfgang Grandegger
Quoted 44 lines · Jan Kiszka
Quoted 23 lines · Wolfgang Grandegger
Quoted 12 lines · Jan Kiszka

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

Quoted 9 lines

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).

Quoted 7 lines

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?

Quoted 8 lines
Quoted 5 lines

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.

Quoted 7 lines

The attached Makefile works. I had to fix two problems. First, cross compilation was not supported. I now take the CC from "xeno-config --cc" for user space applications. I think "xeno-config" is intended only for making user space applications and therefore CC should be specified on the command line for kernel modules:

$ make KSRC=/devel/linuxppc_2_4_devel ARCH=ppc CC=ppc-linux-gcc

Yes, this is the intended usage. I also have to apply this here to build against good-old gcc3 (looking forward to 2.4.34 supporting gcc4).

Quoted 10 lines

ppc-linux-gcc -D__KERNEL__ -I/devel/linuxppc_2_4_devel/include -Wall

(quoted diff) +0 -8
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
-fomit-frame-pointer -I/devel/linuxppc_2_4_devel/arch/ppc -fsigned-char
-msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring -g
-ggdb -DMODULE
-I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai
-I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai/compat
-I/devel/linuxppc_2_4_devel-2006_11_21_1134/include/xenomai/posix    -c
-o heartbeat-x86.o heartbeat-x86.c
Quoted 2 lines

Furthermore I removed "-I$(KSRC)/include", it is already included in the captured CFLAGS.

Good point.

Ok, I will merge these changes into all existing Makefiles and commit the stuff "later".

Thanks,
Jan