Skip to contentSkip to conversation

Patches: README.install & examples/common for cross-compiling

Xenomai-core Niklaus Giger 3 participants 6 messages Dec 21, 2006 – Dec 23, 2006

lore
Share & tools
lore
#0 lore raw

Hi

After switching my development environment to a MacMini and using the ELDK 4.0 I discovered that my examples for building using a cross-compiler for my PPC405 target were not correct. (Maybe a few of my previous problems were caused by not correctly specifying the target ARCH.)

Also I would like to adapt and document the examples/common/Makefile to the needs for cross-compiling (KSRC/XENOCONFIG/DESTDIR useage). Also I added a target "install" to copy the generated application to $(DESTDIR)/usr/xenomai.

Could someone please commit these (or a improved version of it) patches?

Thanks in advance

Signature · 1 line
Niklaus Giger
common/Makefile +9 -3
Index: examples/common/Makefile
===================================================================
@@ -3,9 +3,9 @@
 ### List of applications to be build
 APPLICATIONS = hw_direct_io
 
-### Note: to override the search path for the xeno-config script, use "make XENO=..."
+### Note: to override the search path for the xeno-config script, use "make XENOCONFIG=..."
+### Note: if you installed it into a non standard place add DESTDIR=/path/to/installed/xenomai"
 
-
 ### List of modules to be build
 MODULES =
 
@@ -24,7 +24,9 @@
 ### Sanity check
 ifeq ($(XENOCONFIG),)
 all::
-	@echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"
+	@echo ">>> Invoke make like this: \"make XENOCONFIG=/path/to/xeno-config\" <<<"
+	@echo ">>> add KSRC=.. to override the default kernel source at /lib/modules/$(shell uname -r)/build <<<"
+	@echo ">>> add DESTDIR=/path/to/installed/xenomai if you installed it into a non standard place <<<"
 	@echo
 endif
 
@@ -40,6 +42,9 @@
 clean::
 	$(RM) $(APPLICATIONS) *.o
 
+install:   $(APPLICATIONS)
+	cp $(APPLICATIONS) $(DESTDIR)/usr/xenomai/bin
+
 endif
 
 
@@ -80,3 +85,4 @@
 	$(RM) -R .tmp*
 
 endif
+
README.INSTALL +7 -6
Index: README.INSTALL
===================================================================
@@ -276,19 +276,20 @@
 -----------------------------------------
 
 A typical cross-compilation setup, in order to build Xenomai for a
-PowerPC-405-based system:
+PowerPC-405-based system (assuming an ELDK cross-compiler and a 2.6.14 kernel)
 
 $ $xenomai_root/scripts/prepare-kernel.sh --arch=powerpc \
   --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-X.Y-ZZ.patch \
   --linux=$linux_tree
 $ cd $linux_tree
-$ mkdir ../build-powerpc-405-2.6.14
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 xconfig/gconfig/menuconfig 
+$ build_root /path/to/build-powerpc-405-2.6.14
+$ mkdir $build_root
+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root xconfig/gconfig/menuconfig 
 # select the kernel and Xenomai options
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 bzImage modules 
+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root bzImage modules 
 # then install as needed
-$ mkdir $build_root && cd $build_root
-$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu
+$ cd $build_root
+$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu CC=ppc_4xx-gcc CXX=ppc_4xx-g++ LD=ppc_4xx-ld
 $ make install
 
 2.3 Building for the IPF
#1 lore raw

Dear Niklaus,

README.INSTALL line 279

Quoted 3 lines · in message <[email protected]> you wrote:
README.INSTALL +1 -1
-PowerPC-405-based system:
+PowerPC-405-based system (assuming an ELDK cross-compiler and a 2.6.14 kernel)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
			     This...
Quoted 3 lines

+$ build_root /path/to/build-powerpc-405-2.6.14
+$ mkdir $build_root
+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root xconfig/gconfig/menuconfig

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...

Quoted 1 line

+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root bzImage modules

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...

Quoted 1 line

+$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu CC=ppc_4xx-gcc CXX=ppc_4xx-g++ LD=ppc_4xx-ld

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...and this seems contradictory to me. If you use the ELDK, then it's
"CROSS_COMPILE=ppc_4xx-"; also, I would expect that you set
"--target=powerpc-linux". I mean, with ELDK, "powerpc-405-linux-gnu" will neither work as CROSS_COMPILE prefix, nor as a host / target name.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
People are always a lot more complicated than you  think.  It's  very
important to remember that.             - Terry Pratchett, _Truckers_
#4 lore raw
In reply to Niklaus Giger

Hi Niklaus,

Quoted 5 lines · Niklaus Giger

Hi

After switching my development environment to a MacMini and using the ELDK 4.0 I discovered that my examples for building using a cross-compiler for my PPC405 target were not correct. (Maybe a few of my previous problems were caused by not correctly specifying the target ARCH.)

Also I would like to adapt and document the examples/common/Makefile to the needs for cross-compiling (KSRC/XENOCONFIG/DESTDIR useage). Also I added a target "install" to copy the generated application to $(DESTDIR)/usr/xenomai.

Hm, I don't have examples/common/Makefile in my SVN Xenomai tree. And /usr/xenomai should be the configurable.

Quoted 59 lines

Could someone please commit these (or a improved version of it) patches?

Thanks in advance

------------------------------------------------------------------------

Index: examples/common/Makefile
===================================================================

common/Makefile +9 -4
@@ -3,9 +3,9 @@
 ### List of applications to be build
 APPLICATIONS = hw_direct_io
 
-### Note: to override the search path for the xeno-config script, use "make XENO=..."
+### Note: to override the search path for the xeno-config script, use "make XENOCONFIG=..."
+### Note: if you installed it into a non standard place add DESTDIR=/path/to/installed/xenomai"
 
-
 ### List of modules to be build
 MODULES =
 
@@ -24,7 +24,9 @@
 ### Sanity check
 ifeq ($(XENOCONFIG),)
 all::
-	@echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"
+	@echo ">>> Invoke make like this: \"make XENOCONFIG=/path/to/xeno-config\" <<<"
+	@echo ">>> add KSRC=.. to override the default kernel source at /lib/modules/$(shell uname -r)/build <<<"
+	@echo ">>> add DESTDIR=/path/to/installed/xenomai if you installed it into a non standard place <<<"
 	@echo
 endif
 
@@ -40,6 +42,9 @@
 clean::
 	$(RM) $(APPLICATIONS) *.o
 
+install:   $(APPLICATIONS)
+	cp $(APPLICATIONS) $(DESTDIR)/usr/xenomai/bin
+
 endif
 
 
@@ -80,3 +85,4 @@
 	$(RM) -R .tmp*
 
 endif
+
 
 
------------------------------------------------------------------------

Index: README.INSTALL
===================================================================

README.INSTALL line 283

Quoted 9 lines
README.INSTALL +1 -1
@@ -276,19 +276,20 @@
 -----------------------------------------
 
 A typical cross-compilation setup, in order to build Xenomai for a
-PowerPC-405-based system:
+PowerPC-405-based system (assuming an ELDK cross-compiler and a 2.6.14 kernel)
 
 $ $xenomai_root/scripts/prepare-kernel.sh --arch=powerpc \
   --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-X.Y-ZZ.patch \
   --linux=$linux_tree

For the time beeing, we must distinguish between --arch=ppc (ARCH=ppc) and --arch=powerpc (ARCH=powerpc). The latter is not yet supported.

README.INSTALL line 286

Quoted 3 lines
README.INSTALL +0 -2
 $ cd $linux_tree
-$ mkdir ../build-powerpc-405-2.6.14
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 xconfig/gconfig/menuconfig 

For the ELDK CROSS_COMPILE must be ppc_4xx- for AMCC 4xx processors.

README.INSTALL line 292

Quoted 11 lines
README.INSTALL +6 -3
+$ build_root /path/to/build-powerpc-405-2.6.14
+$ mkdir $build_root
+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root xconfig/gconfig/menuconfig 
 # select the kernel and Xenomai options
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 bzImage modules 
+$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=$build_root bzImage modules 
 # then install as needed
-$ mkdir $build_root && cd $build_root
-$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu
+$ cd $build_root
+$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu CC=ppc_4xx-gcc CXX=ppc_4xx-g++ LD=ppc_4xx-ld
   $ $xenomai_root/configure --host=ppc-linux

already works fine for all ELDK tool chains. The --prefix should also be configurable.

Quoted 11 lines
README.INSTALL +0 -1
 $ make install
 
 2.3 Building for the IPF
 
 
------------------------------------------------------------------------

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

#5 lore raw

Am Freitag, 22. Dezember 2006 08:45 schrieb Wolfgang Grandegger:

Quoted 11 lines

Hi Niklaus,

Quoted 8 lines · Niklaus Giger

Hi

After switching my development environment to a MacMini and using the ELDK 4.0 I discovered that my examples for building using a cross-compiler for my PPC405 target were not correct. (Maybe a few of my previous problems were caused by not correctly specifying the target ARCH.)

Quoted 6 lines
Quoted 4 lines

Also I would like to adapt and document the examples/common/Makefile to the needs for cross-compiling (KSRC/XENOCONFIG/DESTDIR useage). Also I added a target "install" to copy the generated application to $(DESTDIR)/usr/xenomai.

Hm, I don't have examples/common/Makefile in my SVN Xenomai tree. And

Added by revision 1970 only. Makefile came from Jan for my example hw_direct_io.

Quoted 1 line

/usr/xenomai should be the configurable.

Does the attached patch look better for you (using EXEC_PREFIX) ?

Best regards

Signature · 1 line
Niklaus Giger
common/Makefile +11 -3
Index: examples/common/Makefile
===================================================================
@@ -3,9 +3,9 @@
 ### List of applications to be build
 APPLICATIONS = hw_direct_io
 
-### Note: to override the search path for the xeno-config script, use "make XENO=..."
+### Note: to override the search path for the xeno-config script, use "make XENOCONFIG=..."
+### Note: if you installed it into a non standard place add DESTDIR=/path/to/installed/xenomai"
 
-
 ### List of modules to be build
 MODULES =
 
@@ -14,6 +14,8 @@
 
 ### Note: to override the kernel source path, use "make KSRC=..."
 
+# default place to install the resulting binaries
+EXEC_PREFIX := $(DESTDIR)/usr/xenomai/bin
 
 
 ###### USER SPACE BUILD (no change required normally) ######
@@ -24,7 +26,9 @@
 ### Sanity check
 ifeq ($(XENOCONFIG),)
 all::
-	@echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"
+	@echo ">>> Invoke make like this: \"make XENOCONFIG=/path/to/xeno-config\" <<<"
+	@echo ">>> add KSRC=.. to override the default kernel source at /lib/modules/$(shell uname -r)/build <<<"
+	@echo ">>> add DESTDIR=/path/to/installed/xenomai if you installed it into a non standard place <<<"
 	@echo
 endif
 
@@ -40,6 +44,9 @@
 clean::
 	$(RM) $(APPLICATIONS) *.o
 
+install::   $(APPLICATIONS)
+	cp $(APPLICATIONS) $(EXEC_PREFIX)/
+
 endif
 
 
@@ -80,3 +87,4 @@
 	$(RM) -R .tmp*
 
 endif
+
#2 lore raw

Re: [Xenomai-core] Patches: README.install

In reply to Wolfgang Denk

Am Donnerstag, 21. Dezember 2006 23:40 schrieb Wolfgang Denk:

Quoted 2 lines

Dear Niklaus,

Dear Wolfgang

Thanks your for spotting my errors. I should have rechecked this patch before submitting it, as it was based on a outdated script. Please review the attached patch again which is based on a script which actually ran and produced a running kernel.

I would also thanks you for providing the ELDK. It was really a lot easier to setup the ELDK once I switched from my PPC PowerBook to a MacMini. I can really recommend it.

The only addition to the ELDK I made to run xeno-test was to copy my Debian /usr/bin/which to the rootfs.

<..>

Best regards

Signature · 1 line
Niklaus Giger
README.INSTALL +18 -9
Index: README.INSTALL
===================================================================
@@ -192,6 +192,12 @@
 from the cross-compilation tools prefix, you will have to manually
 pass the name of all compilation tools on configure command line. 
 
+If you want to avoid to build your own cross compiler, you might if find
+easier to use ELDK (see http://www.denx.de/wiki/DULG/ELDK). It includes
+the GNU cross development tools, such as the compilers, binutils, gdb, 
+etc., and a number of pre-built target tools and libraries necessary
+to provide some functionality on the target system.
+
 See sections 2.2, 2.3 and 2.4 for examples.
 
 1.4 Building the Linux kernel in the user-space support build tree
@@ -276,19 +282,22 @@
 -----------------------------------------
 
 A typical cross-compilation setup, in order to build Xenomai for a
-PowerPC-405-based system:
+PowerPC-405-based system. Here we use an ELDK cross-compiler and a
+2.6.14 kernel.
 
-$ $xenomai_root/scripts/prepare-kernel.sh --arch=powerpc \
-  --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-X.Y-ZZ.patch \
+$ $xenomai_root/scripts/prepare-kernel.sh --arch=ppc \
+  --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-1.5-*.patch \
   --linux=$linux_tree
 $ cd $linux_tree
-$ mkdir ../build-powerpc-405-2.6.14
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 xconfig/gconfig/menuconfig 
+$ build_root /path/to/eldk
+$ mkdir $build_root
+$ make ARCH=ppc CROSS_COMPILE=ppc_4xx- O=$build_root xconfig/gconfig/menuconfig
 # select the kernel and Xenomai options
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 bzImage modules 
-# then install as needed
-$ mkdir $build_root && cd $build_root
-$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu
+$ make ARCH=ppc CROSS_COMPILE=ppc_4xx- O=$build_root bzImage modules \
+  modules_install
+$ cd $build_root
+$ $xenomai_root/configure --build=i686-linux --host=ppc CC=ppc_4xx-gcc \
+  CXX=ppc_4xx-g++ LD=ppc_4xx-ld
 $ make install
 
 2.3 Building for the IPF
#3 lore raw

Re: [Xenomai-core] Patches: README.install

Dear Niklaus,

Quoted 9 lines · in message <[email protected]> you wrote:

Thanks your for spotting my errors. I should have rechecked this patch before submitting it, as it was based on a outdated script. Please review the attached patch again which is based on a script which actually ran and produced a running kernel.

I would also thanks you for providing the ELDK. It was really a lot easier to setup the ELDK once I switched from my PPC PowerBook to a MacMini. I can really recommend it.

Thanks. I'm glad you like it.

Quoted 2 lines

The only addition to the ELDK I made to run xeno-test was to copy my Debian /usr/bin/which to the rootfs.

alias which='type -p'

Quoted 6 lines

-----------------------------------------

A typical cross-compilation setup, in order to build Xenomai for a

README.INSTALL +2 -1
-PowerPC-405-based system:
+PowerPC-405-based system. Here we use an ELDK cross-compiler and a
+2.6.14 kernel.

README.INSTALL line 292

Quoted 10 lines
README.INSTALL +3 -4
 
-$ $xenomai_root/scripts/prepare-kernel.sh --arch=powerpc \
-  --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-X.Y-ZZ.patch \
+$ $xenomai_root/scripts/prepare-kernel.sh --arch=ppc \
+  --adeos=$xenomai_root/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.14-ppc-1.5-*.patch \
   --linux=$linux_tree
 $ cd $linux_tree
-$ mkdir ../build-powerpc-405-2.6.14
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 xconfig/gconfig/menuconfig 
+$ build_root /path/to/eldk

"/path/to/eldk" might be misleading - at least it needs an expla- nation; I would interpret this as "/opt/eldk", which is the default installation directory of the ELDK, while I guess you actually mean "/opt/eldk/ppc_4xx" ?

README.INSTALL line 297

Quoted 9 lines

+$ mkdir $build_root
+$ make ARCH=ppc CROSS_COMPILE=ppc_4xx- O=$build_root xconfig/gconfig/menuconfig

 # select the kernel and Xenomai options
-$ make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- O=../build-powerpc-405-2.6.14 bzImage modules 
README.INSTALL +2 -3
-# then install as needed
-$ mkdir $build_root && cd $build_root
-$ $xenomai_root/configure --build=i686-linux --host=powerpc-405-linux-gnu
+$ make ARCH=ppc CROSS_COMPILE=ppc_4xx- O=$build_root bzImage modules \
+  modules_install

Be careful here. "modules_install" will try to run the native depmod, which will not work. Recent builds (*) of the ELDK will allow to add a "DEPMOD=/opt/eldk/usr/bin/depmod.pl" argument to the make call.

[This extension was added in July, so you will have to wait for ELDK version 4.1 unless you build the ELDK from scratch from the sources.]

Thanks, and a Merry Christmas and a Happy New Year!

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
READ THIS BEFORE OPENING PACKAGE: According to Certain Suggested Ver-
sions of the Grand Unified Theory, the Primary Particles Constituting
this Product May Decay to Nothingness Within the  Next  Four  Hundred
Million Years.