* [Xenomai-help] Installation and Makefile Help @ 2009-09-10 20:05 Jonathan Haws 2009-09-10 20:20 ` Gilles Chanteperdrix 0 siblings, 1 reply; 8+ messages in thread From: Jonathan Haws @ 2009-09-10 20:05 UTC (permalink / raw) To: xenomai@xenomai.org All, I am new to Xenomai, so please bear with me. I have a question regarding creating Makefiles for building Xenomai enabled programs. I would like to simply use "xeno-config" to set my CFLAGS and LDFLAGS settings in the Makefile. However, the problem I run into is that my target (AMCC 405EX PPC system) requires that I have the --prefix option set to /usr/local/xenomai. However, that is not the real path to where the libraries are installed on my host system. They are at ~/eldk/ppc_4xx/usr/local/xenomai. I then have a script that will build a ramdisk and pull the libraries from the correct location (if anyone has used the root filesystem builder from Denx that is how I am doing it). How can I fix that discrepancy? I would like to accomplish this the correct way and if that is simply creating a symlink, so be it. Thanks! Jonathan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-09-10 20:05 [Xenomai-help] Installation and Makefile Help Jonathan Haws @ 2009-09-10 20:20 ` Gilles Chanteperdrix 2009-09-10 20:41 ` Jonathan Haws 0 siblings, 1 reply; 8+ messages in thread From: Gilles Chanteperdrix @ 2009-09-10 20:20 UTC (permalink / raw) To: Jonathan Haws; +Cc: xenomai@xenomai.org Jonathan Haws wrote: > All, > > I am new to Xenomai, so please bear with me. > > I have a question regarding creating Makefiles for building Xenomai > enabled programs. I would like to simply use "xeno-config" to set my > CFLAGS and LDFLAGS settings in the Makefile. > > However, the problem I run into is that my target (AMCC 405EX PPC > system) requires that I have the --prefix option set to > /usr/local/xenomai. However, that is not the real path to where the > libraries are installed on my host system. They are at > ~/eldk/ppc_4xx/usr/local/xenomai. I then have a script that will > build a ramdisk and pull the libraries from the correct location (if > anyone has used the root filesystem builder from Denx that is how I > am doing it). > > How can I fix that discrepancy? I would like to accomplish this the > correct way and if that is simply creating a symlink, so be it. Use DESTDIR, that is what it was made for. The makefiles use it when running "make install", and xeno-config prepends it to the directories it returns. So, in a makefile, you woud do: XENO_DESTDIR:=~/eldk/ppc_4xx XENO_CONFIG:=$(XENO_DESTDIR)/usr/local/xenomai/bin/xeno-config XENO_CPPFLAGS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --xeno-cflags) XENO_LIBS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --xeno-ldflags) Note that to ease working in a cross-compile embedded environnement you may want to avoid copying header files, documentation, etc... in the directory that will be used to generate the root filesystem. In this case pass a different --prefix and --exec-prefix options to xenomai configure script. -- Gilles. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-09-10 20:20 ` Gilles Chanteperdrix @ 2009-09-10 20:41 ` Jonathan Haws 2009-09-10 20:50 ` Gilles Chanteperdrix 0 siblings, 1 reply; 8+ messages in thread From: Jonathan Haws @ 2009-09-10 20:41 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org > Use DESTDIR, that is what it was made for. The makefiles use it when > running "make install", and xeno-config prepends it to the > directories > it returns. > > So, in a makefile, you woud do: > > XENO_DESTDIR:=~/eldk/ppc_4xx > XENO_CONFIG:=$(XENO_DESTDIR)/usr/local/xenomai/bin/xeno-config > XENO_CPPFLAGS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) -- > xeno-cflags) > XENO_LIBS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --xeno- > ldflags) Ah, that makes sense. Thanks, Gilles. > Note that to ease working in a cross-compile embedded environnement > you may want to avoid copying header files, documentation, etc... in > the directory that will be used to generate the root filesystem. In > this case pass a different --prefix and --exec-prefix options to > xenomai configure script. So, in that case I would do something like the following: ./configure --exec-prefix=~/eldk/ppc_4xx/usr/local/xenomai \ --prefix=/usr/local/xenomai --host=ppc-linux That would put headers, documentation, and other development files in a usable location on the host and the libraries and executables in ~/eldk/ppc_4xx. Correct? Thanks for the help! Jonathan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-09-10 20:41 ` Jonathan Haws @ 2009-09-10 20:50 ` Gilles Chanteperdrix 2009-09-10 20:54 ` Jonathan Haws 0 siblings, 1 reply; 8+ messages in thread From: Gilles Chanteperdrix @ 2009-09-10 20:50 UTC (permalink / raw) To: Jonathan Haws; +Cc: xenomai@xenomai.org Jonathan Haws wrote: >> Use DESTDIR, that is what it was made for. The makefiles use it >> when running "make install", and xeno-config prepends it to the >> directories it returns. >> >> So, in a makefile, you woud do: >> >> XENO_DESTDIR:=~/eldk/ppc_4xx >> XENO_CONFIG:=$(XENO_DESTDIR)/usr/local/xenomai/bin/xeno-config >> XENO_CPPFLAGS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) -- >> xeno-cflags) XENO_LIBS:=$(shell DESTDIR=$(XENO_DESTDIR) >> $(XENO_CONFIG) --xeno- ldflags) > > Ah, that makes sense. Thanks, Gilles. > > >> Note that to ease working in a cross-compile embedded environnement >> you may want to avoid copying header files, documentation, etc... >> in the directory that will be used to generate the root filesystem. >> In this case pass a different --prefix and --exec-prefix options to >> xenomai configure script. > > So, in that case I would do something like the following: > > ./configure --exec-prefix=~/eldk/ppc_4xx/usr/local/xenomai \ > --prefix=/usr/local/xenomai --host=ppc-linux > > That would put headers, documentation, and other development files in > a usable location on the host and the libraries and executables in > ~/eldk/ppc_4xx. Well no, unfortunately not. To get things working properly, you have to pass ~/eldk/ppc_4xx as the DESTDIR when running "make install". At least that is the way the makefiles coming from automake are supposed to be used. So, what you would do is rather: ./configure --exec-prefix=/usr/local/xenomai --prefix=/xenomai-host --host=ppc-linux And then in the script generating the rootfs, prune the ~/eldk/ppc_4xx/xenomai-host directory. -- Gilles. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-09-10 20:50 ` Gilles Chanteperdrix @ 2009-09-10 20:54 ` Jonathan Haws 2009-11-09 20:54 ` Jonathan Haws 0 siblings, 1 reply; 8+ messages in thread From: Jonathan Haws @ 2009-09-10 20:54 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org > >> Use DESTDIR, that is what it was made for. The makefiles use it > >> when running "make install", and xeno-config prepends it to the > >> directories it returns. > >> > >> So, in a makefile, you woud do: > >> > >> XENO_DESTDIR:=~/eldk/ppc_4xx > >> XENO_CONFIG:=$(XENO_DESTDIR)/usr/local/xenomai/bin/xeno-config > >> XENO_CPPFLAGS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) -- > >> xeno-cflags) XENO_LIBS:=$(shell DESTDIR=$(XENO_DESTDIR) > >> $(XENO_CONFIG) --xeno- ldflags) > > > > Ah, that makes sense. Thanks, Gilles. > > > > > >> Note that to ease working in a cross-compile embedded > environnement > >> you may want to avoid copying header files, documentation, > etc... > >> in the directory that will be used to generate the root > filesystem. > >> In this case pass a different --prefix and --exec-prefix options > to > >> xenomai configure script. > > > > So, in that case I would do something like the following: > > > > ./configure --exec-prefix=~/eldk/ppc_4xx/usr/local/xenomai \ > > --prefix=/usr/local/xenomai --host=ppc-linux > > > > That would put headers, documentation, and other development files > in > > a usable location on the host and the libraries and executables in > > ~/eldk/ppc_4xx. > > Well no, unfortunately not. To get things working properly, you have > to > pass ~/eldk/ppc_4xx as the DESTDIR when running "make install". At > least > that is the way the makefiles coming from automake are supposed to > be > used. > > So, what you would do is rather: > ./configure --exec-prefix=/usr/local/xenomai --prefix=/xenomai-host > --host=ppc-linux > > And then in the script generating the rootfs, prune the > ~/eldk/ppc_4xx/xenomai-host directory. Ah, yes. I can see that now that I tried exactly what I just mentioned. This make sense. Thanks. Jonathan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-09-10 20:54 ` Jonathan Haws @ 2009-11-09 20:54 ` Jonathan Haws 2009-11-09 21:42 ` Gilles Chanteperdrix 0 siblings, 1 reply; 8+ messages in thread From: Jonathan Haws @ 2009-11-09 20:54 UTC (permalink / raw) To: Jonathan Haws, Gilles Chanteperdrix; +Cc: xenomai@xenomai.org > > >> Use DESTDIR, that is what it was made for. The makefiles use it > > >> when running "make install", and xeno-config prepends it to the > > >> directories it returns. > > >> > > >> So, in a makefile, you woud do: > > >> > > >> XENO_DESTDIR:=~/eldk/ppc_4xx > > >> XENO_CONFIG:=$(XENO_DESTDIR)/usr/local/xenomai/bin/xeno-config > > >> XENO_CPPFLAGS:=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) - > - > > >> xeno-cflags) XENO_LIBS:=$(shell DESTDIR=$(XENO_DESTDIR) > > >> $(XENO_CONFIG) --xeno- ldflags) > > > > > > Ah, that makes sense. Thanks, Gilles. > > > > > > > > >> Note that to ease working in a cross-compile embedded > > environnement > > >> you may want to avoid copying header files, documentation, > > etc... > > >> in the directory that will be used to generate the root > > filesystem. > > >> In this case pass a different --prefix and --exec-prefix > options > > to > > >> xenomai configure script. > > > > > > So, in that case I would do something like the following: > > > > > > ./configure --exec-prefix=~/eldk/ppc_4xx/usr/local/xenomai \ > > > --prefix=/usr/local/xenomai --host=ppc-linux > > > > > > That would put headers, documentation, and other development > files > > in > > > a usable location on the host and the libraries and executables > in > > > ~/eldk/ppc_4xx. > > > > Well no, unfortunately not. To get things working properly, you > have > > to > > pass ~/eldk/ppc_4xx as the DESTDIR when running "make install". At > > least > > that is the way the makefiles coming from automake are supposed to > > be > > used. > > > > So, what you would do is rather: > > ./configure --exec-prefix=/usr/local/xenomai --prefix=/xenomai- > host > > --host=ppc-linux > > > > And then in the script generating the rootfs, prune the > > ~/eldk/ppc_4xx/xenomai-host directory. > > Ah, yes. I can see that now that I tried exactly what I just > mentioned. This make sense. Follow up question: I am trying to get a kernel module to build correctly and I am running into problems passing the Xenomai information to the kbuild system. Here is what I am seeing: rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.order \ *.symvers main echo -I/home/jhaws/eldk/ppc_4xx/xenomai-host/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -I/home/jhaws/eldk/ppc_4xx/xenomai-host/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ make -C ~/embedded-linux/linux-2.6-xenomai M=/home/jhaws/workspace/benchFPGA modules make[1]: Entering directory `/home/jhaws/embedded-linux/linux-2.6-xenomai' CC [M] /home/jhaws/workspace/benchFPGA/fpgaDriver.o /home/jhaws/workspace/benchFPGA/fpgaDriver.c:34:24: error: native/sem.h: No such file or directory In file included from /home/jhaws/workspace/benchFPGA/fpgaDriver.c:37: /home/jhaws/workspace/benchFPGA/fpga.h:248: error: expected specifier-qualifier-list before 'RT_SEM' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_isr': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:126: error: implicit declaration of function 'rt_sem_v' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:126: error: 'fpga_dev' has no member named 'sarSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_init': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:164: error: 'fpga_dev' has no member named 'openCount' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:166: error: 'fpga_dev' has no member named 'cdev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:167: error: 'fpga_dev' has no member named 'cdev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:168: error: 'fpga_dev' has no member named 'cdev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:169: error: 'fpga_dev' has no member named 'cdev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_exit': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:199: error: 'fpga_dev' has no member named 'cdev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_probe': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:232: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:330: error: implicit declaration of function 'rt_sem_create' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:330: error: 'fpga_dev' has no member named 'sarSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:330: error: 'S_FIFO' undeclared (first use in this function) /home/jhaws/workspace/benchFPGA/fpgaDriver.c:330: error: (Each undeclared identifier is reported only once /home/jhaws/workspace/benchFPGA/fpgaDriver.c:330: error: for each function it appears in.) /home/jhaws/workspace/benchFPGA/fpgaDriver.c:335: error: 'fpga_dev' has no member named 'igsSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:340: error: 'fpga_dev' has no member named 'novaSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:347: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:351: error: implicit declaration of function 'rt_sem_delete' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:351: error: 'fpga_dev' has no member named 'novaSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:352: error: 'fpga_dev' has no member named 'igsSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:353: error: 'fpga_dev' has no member named 'sarSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_remove': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:385: error: 'fpga_dev' has no member named 'novaSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:386: error: 'fpga_dev' has no member named 'igsSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:387: error: 'fpga_dev' has no member named 'sarSem' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:390: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_open': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:408: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:414: error: 'fpga_dev' has no member named 'openCount' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:416: error: 'fpga_dev' has no member named 'openCount' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:422: error: 'fpga_dev' has no member named 'openCount' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:425: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:428: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:429: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:432: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c: In function 'fpga_release': /home/jhaws/workspace/benchFPGA/fpgaDriver.c:455: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:455: error: 'fpga_dev' has no member named 'pcidev' /home/jhaws/workspace/benchFPGA/fpgaDriver.c:458: error: 'fpga_dev' has no member named 'openCount' make[2]: *** [/home/jhaws/workspace/benchFPGA/fpgaDriver.o] Error 1 make[1]: *** [_module_/home/jhaws/workspace/benchFPGA] Error 2 make[1]: Leaving directory `/home/jhaws/embedded-linux/linux-2.6-xenomai' make: *** [modules] Error 2 That is when I run a make clean all. Here is the Makefile: ############################################################################### # # Makefile for FPGA Driver # ############################################################################### # # This makefile is a generic makefile which will compile a module outside the # kernel source tree. KERNELDIR specifies where the location of the kernel # source tree is and is passed on to the subsequent make call for the target. # # Comment / uncomment the following line to disable / enable debugging flags # DEBUG = y ifeq ($(DEBUG),y) DFLAGS = -O -g -DFPGA_DEBUG else DFLAGS = -O2 endif ############################################################################### # Definitions # # To build Xenomai enabled programs, access to xeno-config is needed. It is # typically located in <ELDK-PATH>/ppc_4xx/usr/local/xenomai/bin. # xeno-config is used to get the necessary flags for the compiler and linker # to be able to link the correct libraries in. However, xeno-config returns # the location of the libraries on the target, which is /usr/local/xenomai, # typically. To work around this use DESTDIR. DESTDIR will be prepended to # the paths coming out of the call to xeno-config. # # e.g. -I/usr/local/xenomai would become -I$(DESTDIR)/usr/local/xenomai # # See the definitions below for examples of usage of DESTDIR. ############################################################################### ELDK_ROOTPATH = ~/eldk/ppc_4xx XENOMAI = $(ELDK_ROOTPATH)/usr/local/xenomai XENO_CONFIG = $(XENOMAI)/bin/xeno-config XENO_CFLAGS = $(shell DESTDIR=$(ELDK_ROOTPATH) $(XENO_CONFIG) --xeno-cflags) XENO_LIBS = $(shell DESTDIR=$(ELDK_ROOTPATH) $(XENO_CONFIG) --xeno-ldflags) CC = ppc_4xx-gcc OBJCOPY = ppc_4xx-objcopy READELF = ppc_4xx-readelf LD = ppc_4xx-ld KCFLAGS = -Wall $(XENO_CFLAGS) $(DFLAGS) KAFLAGS = -mregnames LDFLAGS = $(XENO_LIBS) -static LIBS = -lnative -lpthread cacheFuncs.o ############################################################################### # Targets ############################################################################### # Get Kernel Information ifeq ($(KERNELRELEASE),) KERNELDIR := ~/embedded-linux/linux-2.6-xenomai PWD := $(shell pwd) all: modules main modules: echo $(XENO_CFLAGS) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules main: ppc_4xx-gcc $(EXTRA_CFLAGS) $(LDFLAGS) -o main main.c $(LIBS) cacheFuncs.o: ppc_4xx-gcc -mregnames -c cacheFuncs.S modules_install: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install clean: rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.order \ *.symvers main .PHONY: modules modules_install clean else # We are calling make from the kernel build system, therefore we simply define # what the modules are. obj-m := fpgaDriver.o endif It seems like the kbuild system is not seeing the native/sem.h file, and thus is causing all the subsequent errors. However, I have the KCFLAGS set to what they need to be, so what am I missing? Thanks! ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-11-09 20:54 ` Jonathan Haws @ 2009-11-09 21:42 ` Gilles Chanteperdrix 2009-11-09 21:43 ` Jonathan Haws 0 siblings, 1 reply; 8+ messages in thread From: Gilles Chanteperdrix @ 2009-11-09 21:42 UTC (permalink / raw) To: Jonathan Haws; +Cc: xenomai@xenomai.org Jonathan Haws wrote: > else > > # We are calling make from the kernel build system, therefore we simply define > # what the modules are. > > obj-m := fpgaDriver.o EXTRA_CFLAGS+=-Iinclude/xenomai > > endif You can put that in a file named "Kbuild" too, this avoids the big if. There are Makefile examples in xenomai sources "examples" sub-directory. -- Gilles. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xenomai-help] Installation and Makefile Help 2009-11-09 21:42 ` Gilles Chanteperdrix @ 2009-11-09 21:43 ` Jonathan Haws 0 siblings, 0 replies; 8+ messages in thread From: Jonathan Haws @ 2009-11-09 21:43 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org > > else > > > > # We are calling make from the kernel build system, therefore we > simply define > > # what the modules are. > > > > obj-m := fpgaDriver.o > > EXTRA_CFLAGS+=-Iinclude/xenomai > > > > > endif > > You can put that in a file named "Kbuild" too, this avoids the big > if. > > There are Makefile examples in xenomai sources "examples" sub- > directory. Thanks for pointing me to the examples. They helped. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-11-09 21:43 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-09-10 20:05 [Xenomai-help] Installation and Makefile Help Jonathan Haws 2009-09-10 20:20 ` Gilles Chanteperdrix 2009-09-10 20:41 ` Jonathan Haws 2009-09-10 20:50 ` Gilles Chanteperdrix 2009-09-10 20:54 ` Jonathan Haws 2009-11-09 20:54 ` Jonathan Haws 2009-11-09 21:42 ` Gilles Chanteperdrix 2009-11-09 21:43 ` Jonathan Haws
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.