Skip to contentSkip to conversation

Kernel Cross Compiling

DISCUSSION Herbert Poetzl 7 participants 16 messages Feb 13, 2004 – Feb 17, 2004

lore
Share & tools
lore
#0 lore raw

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

after reading and testing several cross build and toolchain building howtos, I decided to do it a little different, because I do not need glibc to compile the kernel ...

the result are two .spec files[1], or the commands used to build an appropriate toolchain ...

for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux

make

and for the gcc (after the binutils have been installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'

where ${CROSS_ARCH} is the target architecture you want to compile the toochain for, in my case, this where one of the following:

alpha, hppa, hppa64, i386, ia64, m68k, mips,

	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

[1] http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

[2] http://vserver.13thfloor.at/Stuff/Cross/

		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

[3] http://vserver.13thfloor.at/Stuff/Cross/compile.info

ia64: http://www.gelato.unsw.edu.au/kerncomp/
mips: http://www.linux-mips.org/kernel.html
hppa: http://www.parisc-linux.org/kernel/index.html
ppc64: http://linuxppc64.org/

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

Herbert> I got all headers fixed, except for the ia64, which still Herbert> doesn't work

Something sounds wrong here. You shouldn't have to patch headers.

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:

http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

	--david
#2 lore raw
Quoted 11 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

Herbert> I got all headers fixed, except for the ia64, which still Herbert> doesn't work

Something sounds wrong here. You shouldn't have to patch headers.

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:

http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

that might work with the ia64 libraries and headers, but it seems to fail, with the headers included in the gcc tarball, for cross compiling, if you get it to compile without (g)libc which should not be required to build the crossgcc and the kernel, I would be very interested ...

anyway, thanks for the url,
Herbert

Quoted 5 lines
	--david

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:

http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

Herbert> that might work with the ia64 libraries and headers, but it Herbert> seems to fail, with the headers included in the gcc Herbert> tarball, for cross compiling, if you get it to compile Herbert> without (g)libc which should not be required to build the Herbert> crossgcc and the kernel, I would be very interested ...

Ah, I see now what you mean. I suspect that's a setup that's rarely tested, so I'm not surprised to see some breakage.

Having said that, I got gcc v3.3.3 20031212 (prerelease) to build with minor tweaks (see patch below). I'm no GCC-built-environment expert and I'm quite certain that the patch isn't totally correct, but all the unwind-related stuff isn't really needed in your case, because that code only comes into play for exception-handling and C cleanup handlers.

The unwind-sjlj.c problem should occur on most other platforms too, so I don't think that problem is ia64-specific.

	--david

Index: gcc/unwind-sjlj.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-sjlj.c,v
retrieving revision 1.11.2.2

unwind-sjlj.c +2 -0
diff -u -r1.11.2.2 unwind-sjlj.c
@@ -22,7 +22,9 @@
 #include "tconfig.h"
 #include "tsystem.h"
 #include "unwind.h"
+#ifndef inhibit_libc
 #include "gthr.h"
+#endif
 
 #ifdef __USING_SJLJ_EXCEPTIONS__
 

Index: gcc/unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.h,v
retrieving revision 1.7.2.6

unwind.h +3 -1
diff -u -r1.7.2.6 unwind.h
@@ -195,7 +195,9 @@
    compatible with the standard ABI for IA-64, we inline these.  */
 
 #ifdef __ia64__
-#include <stdlib.h>
+# ifndef inhibit_libc
+#  include <stdlib.h>
+# endif
 
 static inline _Unwind_Ptr
 _Unwind_GetDataRelBase (struct _Unwind_Context *_C)

Index: gcc/config/ia64/fde-glibc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/fde-glibc.c,v retrieving revision 1.5

config/ia64/fde-glibc.c +5 -0
diff -u -r1.5 fde-glibc.c
@@ -31,6 +31,9 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+
+#ifndef inhibit_libc
+
 #include "config.h"
 #include <stddef.h>
 #include <stdlib.h>
@@ -162,3 +165,5 @@
 
   return data.ret;
 }
+
+#endif

Index: gcc/config/ia64/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/linux.h,v
retrieving revision 1.23

config/ia64/linux.h +1 -1
diff -u -r1.23 linux.h
@@ -58,7 +58,7 @@
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
-#ifdef IN_LIBGCC2
+#ifdef x_IN_LIBGCC2
 #include <signal.h>
 #include <sys/ucontext.h>
 
#4 lore raw
Quoted 23 lines · David Mosberger
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:

http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

Herbert> that might work with the ia64 libraries and headers, but it Herbert> seems to fail, with the headers included in the gcc Herbert> tarball, for cross compiling, if you get it to compile Herbert> without (g)libc which should not be required to build the Herbert> crossgcc and the kernel, I would be very interested ...

Ah, I see now what you mean. I suspect that's a setup that's rarely tested, so I'm not surprised to see some breakage.

Having said that, I got gcc v3.3.3 20031212 (prerelease) to build with minor tweaks (see patch below). I'm no GCC-built-environment expert and I'm quite certain that the patch isn't totally correct, but all the unwind-related stuff isn't really needed in your case, because that code only comes into play for exception-handling and C cleanup handlers.

Quoted 2 lines

The unwind-sjlj.c problem should occur on most other platforms too, so I don't think that problem is ia64-specific.

ah, thanks, will test it, and maybe upgrade to 3.3.3 if this seems necessary ...

best,
Herbert

Quoted 76 lines
	--david

Index: gcc/unwind-sjlj.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-sjlj.c,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 unwind-sjlj.c

unwind-sjlj.c +2 -0
@@ -22,7 +22,9 @@
 #include "tconfig.h"
 #include "tsystem.h"
 #include "unwind.h"
+#ifndef inhibit_libc
 #include "gthr.h"
+#endif
 
 #ifdef __USING_SJLJ_EXCEPTIONS__
 

Index: gcc/unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.h,v
retrieving revision 1.7.2.6
diff -u -r1.7.2.6 unwind.h

unwind.h +3 -1
@@ -195,7 +195,9 @@
    compatible with the standard ABI for IA-64, we inline these.  */
 
 #ifdef __ia64__
-#include <stdlib.h>
+# ifndef inhibit_libc
+#  include <stdlib.h>
+# endif
 
 static inline _Unwind_Ptr
 _Unwind_GetDataRelBase (struct _Unwind_Context *_C)

Index: gcc/config/ia64/fde-glibc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/fde-glibc.c,v retrieving revision 1.5
diff -u -r1.5 fde-glibc.c

config/ia64/fde-glibc.c +5 -0
@@ -31,6 +31,9 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+
+#ifndef inhibit_libc
+
 #include "config.h"
 #include <stddef.h>
 #include <stdlib.h>
@@ -162,3 +165,5 @@
 
   return data.ret;
 }
+
+#endif

Index: gcc/config/ia64/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/linux.h,v
retrieving revision 1.23
diff -u -r1.23 linux.h

config/ia64/linux.h +1 -1
@@ -58,7 +58,7 @@
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
-#ifdef IN_LIBGCC2
+#ifdef x_IN_LIBGCC2
 #include <signal.h>
 #include <sys/ucontext.h>
 
#5 lore raw
Quoted 24 lines · Herbert Poetzl
Quoted 23 lines · David Mosberger
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:

http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

Herbert> that might work with the ia64 libraries and headers, but it Herbert> seems to fail, with the headers included in the gcc Herbert> tarball, for cross compiling, if you get it to compile Herbert> without (g)libc which should not be required to build the Herbert> crossgcc and the kernel, I would be very interested ...

Ah, I see now what you mean. I suspect that's a setup that's rarely tested, so I'm not surprised to see some breakage.

Having said that, I got gcc v3.3.3 20031212 (prerelease) to build with minor tweaks (see patch below). I'm no GCC-built-environment expert and I'm quite certain that the patch isn't totally correct, but all the unwind-related stuff isn't really needed in your case, because that code only comes into play for exception-handling and C cleanup handlers.

Quoted 5 lines
Quoted 2 lines

The unwind-sjlj.c problem should occur on most other platforms too, so I don't think that problem is ia64-specific.

ah, thanks, will test it, and maybe upgrade to 3.3.3 if this seems necessary ...

okay, status update ... thanks to David, ia64 gcc is now working, I updated the fix for ia64 and made a testrun for 2.4.25-rc2 ...

linux-2.4.25-rc2 config dep kernel modules

ia64/ia64: OK OK FAILED FAILED

Quoted 84 lines

best,
Herbert

Quoted 68 lines
	--david

Index: gcc/unwind-sjlj.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-sjlj.c,v
retrieving revision 1.11.2.2
diff -u -r1.11.2.2 unwind-sjlj.c

unwind-sjlj.c +2 -0
@@ -22,7 +22,9 @@
 #include "tconfig.h"
 #include "tsystem.h"
 #include "unwind.h"
+#ifndef inhibit_libc
 #include "gthr.h"
+#endif
 
 #ifdef __USING_SJLJ_EXCEPTIONS__
 

Index: gcc/unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.h,v
retrieving revision 1.7.2.6
diff -u -r1.7.2.6 unwind.h

unwind.h +3 -1
@@ -195,7 +195,9 @@
    compatible with the standard ABI for IA-64, we inline these.  */
 
 #ifdef __ia64__
-#include <stdlib.h>
+# ifndef inhibit_libc
+#  include <stdlib.h>
+# endif
 
 static inline _Unwind_Ptr
 _Unwind_GetDataRelBase (struct _Unwind_Context *_C)

Index: gcc/config/ia64/fde-glibc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/fde-glibc.c,v retrieving revision 1.5
diff -u -r1.5 fde-glibc.c

config/ia64/fde-glibc.c +5 -0
@@ -31,6 +31,9 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+
+#ifndef inhibit_libc
+
 #include "config.h"
 #include <stddef.h>
 #include <stdlib.h>
@@ -162,3 +165,5 @@
 
   return data.ret;
 }
+
+#endif

Index: gcc/config/ia64/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/linux.h,v
retrieving revision 1.23
diff -u -r1.23 linux.h

config/ia64/linux.h line 64

Quoted 8 lines
config/ia64/linux.h +1 -1
@@ -58,7 +58,7 @@
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
-#ifdef IN_LIBGCC2
+#ifdef x_IN_LIBGCC2
 #include <signal.h>
 #include <sys/ucontext.h>
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Herbert Poetzl

Herbert> linux-2.4.25-rc2 config dep kernel modules

2.4? That's pretty hopeless. 2.6 builds out of the box for ia64.

	--david
#9 lore raw
In reply to Herbert Poetzl

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

Tim

Quoted 173 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)
#10 lore raw
Quoted 6 lines · Timothy D. Witham

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

thanks, yes, I knew about that, but the thing is, I would like to use this as automated test (well first step of an automated test) for linux-vserver[1] development, and for that purpose i386/ia64 and ppc/ppc64 is a good start but not nearly sufficient, we currently 'support' (or at least try to ;) the following archs:

alpha, i386, ia64, mips/64, hppa/64, ppc/64 sparc/64, s390/x, x86_64, uml

and got an officially assigned syscall number for

i386, s390, sparc/64, sh3/4, x86_64

but if you are interested in extending this and making it available for linux-vserver kernel compile tests too, I'm willing to help if I can ...

TIA,
Herbert

Quoted 187 lines

Tim

Quoted 173 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 10 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#11 lore raw

Well it seems to me it makes more sense to extend rather
than start over.

Tim

Quoted 216 lines · Herbert Poetzl
Quoted 6 lines · Timothy D. Witham

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

thanks, yes, I knew about that, but the thing is, I would like to use this as automated test (well first step of an automated test) for linux-vserver[1] development, and for that purpose i386/ia64 and ppc/ppc64 is a good start but not nearly sufficient, we currently 'support' (or at least try to ;) the following archs:

alpha, i386, ia64, mips/64, hppa/64, ppc/64 sparc/64, s390/x, x86_64, uml

and got an officially assigned syscall number for

i386, s390, sparc/64, sh3/4, x86_64

but if you are interested in extending this and making it available for linux-vserver kernel compile tests too, I'm willing to help if I can ...

TIA,
Herbert

Quoted 187 lines

Tim

Quoted 173 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 10 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)
#12 lore raw
Quoted 2 lines · Timothy D. Witham

Well it seems to me it makes more sense to extend rather
than start over.

okay, what do you have in mind, how _can_ we extend that and _how_ could I _use_ that for linux-vserver?

TIA,
Herbert

Quoted 225 lines

Tim

Quoted 216 lines · Herbert Poetzl
Quoted 6 lines · Timothy D. Witham

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

thanks, yes, I knew about that, but the thing is, I would like to use this as automated test (well first step of an automated test) for linux-vserver[1] development, and for that purpose i386/ia64 and ppc/ppc64 is a good start but not nearly sufficient, we currently 'support' (or at least try to ;) the following archs:

alpha, i386, ia64, mips/64, hppa/64, ppc/64 sparc/64, s390/x, x86_64, uml

and got an officially assigned syscall number for

i386, s390, sparc/64, sh3/4, x86_64

but if you are interested in extending this and making it available for linux-vserver kernel compile tests too, I'm willing to help if I can ...

TIA,
Herbert

Quoted 187 lines

Tim

Quoted 173 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 10 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)
#8 lore raw
In reply to David Mosberger
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"David" == David Mosberger <[email protected]> writes:

On Fri, 13 Feb 2004 21:57:43 +0100, Herbert Poetzl <[email protected]> said:

Herbert> I got all headers fixed, except for the ia64, which still Herbert> doesn't work

David> Something sounds wrong here. You shouldn't have to patch David> headers.

David> A recipe for building ia32->ia64 cross-toolchain on Debian can David> be found here:

David> http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

He's trying to use gcc 3.3.2 which isn't packaged in toolchain-source yet. And he's running on a RedHat-like system.

And there's currently a problem: To build gcc you need access to an appropriate libc6 header package; dpkg-cross refuses to install one without linux-kernel-headers-cross-ia64; but will also not install linux-kernel-headers. You need the patch at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=222168

Peter C

#13 lore raw
In reply to Herbert Poetzl
Quoted 18 lines · On Sat, 14 Feb 2004 14:03:22 +0100 Herbert Poetzl <[email protected]> wrote:
Quoted 6 lines · Timothy D. Witham

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

thanks, yes, I knew about that, but the thing is, I would like to use this as automated test (well first step of an automated test) for linux-vserver[1] development, and for that purpose i386/ia64 and ppc/ppc64 is a good start but not nearly sufficient, we currently 'support' (or at least try to ;) the following archs:

alpha, i386, ia64, mips/64, hppa/64, ppc/64
sparc/64, s390/x, x86_64, uml

Quoted 7 lines

and got an officially assigned syscall number for

i386, s390, sparc/64, sh3/4, x86_64

but if you are interested in extending this and making it available for linux-vserver kernel compile tests too, I'm willing to help if I can ...

We're always grateful for help. Our build engine is called the Patch Lifecycle Manager, ( http://www.osdl.org/plm-cgi/plm ) and the code is always available either from BK
( bk://developer.osdl.org/plm ) or as a tarball from Sourceforge ( not CVS ) ( http://sourceforge.net/projects/plm )

Basically, the farm here at OSDL auto-builds
- each release
- a daily BK snapshot ( from kernel.org )
- each new tree from a few maintainers ( -mm, -ac, -mjb, -osdl )

We do some cross compiles, using Dan Kegel's fine tools.

Several things you/we could do:
- You could of course use our stuff to run your compilie farm, we're
always glad to help. :)
- we always need help with the project. Mailing list is [email protected].
- we're planning on expanding the number of arch's we cross-compile for, x86_64 and ppc64 are the next two probable targets. We probably wouldn't want to add a lot of other archs doing large compiles,
but if you have a simple target, we can add quite a few.
( we noticed you are doing a defconfig. We've done separate config files for those
builds, to reduce time )

hope to hear from you
cliffw

Quoted 197 lines

TIA,
Herbert

Quoted 172 lines

Tim

Quoted 169 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/
Quoted 15 lines
Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 10 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
The church is near, but the road is icy.
The bar is far, but i will walk carefully. - Russian proverb
#14 lore raw
Quoted 2 lines · cliff white

On Sat, 14 Feb 2004 14:03:22 +0100
Herbert Poetzl <[email protected]> wrote:

Hi Cliff!

Quoted 26 lines
Quoted 18 lines · Timothy D. Witham
Quoted 6 lines

Just to point out that we (OSDL) already do this.

http://www.osdl.org/projects/26lnxstblztn/results/

We are willing to add more but it is always willing
to look at adding more.

thanks, yes, I knew about that, but the thing is, I would like to use this as automated test (well first step of an automated test) for linux-vserver[1] development, and for that purpose i386/ia64 and ppc/ppc64 is a good start but not nearly sufficient, we currently 'support' (or at least try to ;) the following archs:

alpha, i386, ia64, mips/64, hppa/64, ppc/64
sparc/64, s390/x, x86_64, uml

Quoted 7 lines

and got an officially assigned syscall number for

i386, s390, sparc/64, sh3/4, x86_64

but if you are interested in extending this and making it available for linux-vserver kernel compile tests too, I'm willing to help if I can ...

Quoted 5 lines

We're always grateful for help. Our build engine is called the Patch Lifecycle Manager, ( http://www.osdl.org/plm-cgi/plm ) and the code is always available either from BK
( bk://developer.osdl.org/plm ) or as a tarball from Sourceforge ( not CVS ) ( http://sourceforge.net/projects/plm )

tried that one for vs1.20 (2.4.21,2.4.22,2.4.23) was a little inflexible, but I didn't understand the results:

PPC-Cross Compile Regress 447 warnings, 21 errors PASS?

and what I would need is the following:

- vanilla kernel + config which compiles for arch X
- vanilla kernel + vserver patches + same config which is tested for arch X
- differences in the warnings/errors to the default (vanilla) build
- ability to check a 'special' config

Quoted 4 lines

Basically, the farm here at OSDL auto-builds
- each release
- a daily BK snapshot ( from kernel.org )
- each new tree from a few maintainers ( -mm, -ac, -mjb, -osdl )

currently there are three linux-vserver branches, stable (2.4), devel (2.4) and experimental (2.6) very soon the experimental branch will become the devel branch, and the devel branch the last stable for (2.4) devel and stable will move on to 2.6 then

Quoted 1 line

We do some cross compiles, using Dan Kegel's fine tools.

tried those, but decided not to use them, as they require building the (g)libc which isN#t required for kernel builds at all ...

Quoted 3 lines

Several things you/we could do:
- You could of course use our stuff to run your compilie farm, we're always glad to help. :)

okay, how could this be done, and what would be my part especially:

- how to add new patches/releases/branches
- how to activate a testbuild for a kernel/patch combination
- how to use it 'just' for a test, to detect and correct build errors (the main purpose)

Quoted 2 lines

- we always need help with the project. Mailing list is [email protected].

how could I help?

Quoted 4 lines

- we're planning on expanding the number of arch's we cross-compile for, x86_64 and ppc64 are the next two probable targets. We probably wouldn't want to add a lot of other archs doing large compiles, but if you have a simple target, we can add quite a few.

currently my cross compile toolchains support the following archs:

alpha arm cris hppa hppa64 i386 ia64 m68k mips mips64 ppc ppc64 s390 sh sh64 sparc sparc64 v850 x86_64

the 'defconfig' only works for a subset of those and some arch have even troubles building without heavy patches ...

so planning sounds good, but we are already supporting
alpha, hppa64, i386, s390, sparc/64 and x86_64

Quoted 2 lines

( we noticed you are doing a defconfig. We've done separate config files for those builds, to reduce time )

sounds like a reasonable approach ...

Quoted 2 lines

hope to hear from you
cliffw

TIA,
Herbert

Quoted 201 lines
Quoted 196 lines

TIA,
Herbert

Quoted 172 lines

Tim

Quoted 169 lines · Herbert Poetzl

Hi Folks!

I'm currently investigating the requirements/doability of a kernel cross compiling test bed/setup, able to do automated kernel builds for different architecture, just to see if it compiles and later to verify if a given patch breaks that compile on any of the tested archs ...

here a short status, and some issues I ran into so far, some of them with solutions, others without, and some interesting? observations ...

I would be happy if somebody who has done similar, or knows how to do it properly ;) could comment on that, and/or point out possible improvements ...

TIA,
Herbert

1) CROSS COMPILER / TOOLCHAIN

   after reading and testing several cross build and
   toolchain building howtos, I decided to do it a little 
   different, because I do not need glibc to compile the 
   kernel ...

   the result are two .spec files[1], or the commands 
   used to build an appropriate toolchain ...
   
   for the binutils the required commands are:

   	configure  	    	    	    	    	\
		--disable-nls                           \
		--prefix=/usr                           \
		--mandir=/usr/share/man                 \
		--infodir=/usr/share/info               \
		--target=${CROSS_ARCH}-linux
   	make
   
   and for the gcc (after the binutils have been
   installed on the host):

   	configure  	    	    	    	    	\
		--enable-languages=c			\
        	--disable-nls                           \
		--disable-threads			\
		--disable-shared			\
		--disable-checking			\
        	--prefix=/usr                           \
        	--mandir=/usr/share/man                 \
        	--infodir=/usr/share/info               \
        	--target=${CROSS_ARCH}-linux
   	make  TARGET_LIBGCC2_CFLAGS='-Dinhibit_libc  \
		-D__gthr_posix_h'
   
   where ${CROSS_ARCH} is the target architecture you want
   to compile the toochain for, in my case, this where one
   of the following:

   	alpha, hppa, hppa64, i386, ia64, m68k, mips, 
	mips64, ppc, ppc64, s390, sparc, sparc64, x86_64

PROBLEMS HERE:

I decided to use binutils 2.14.90.0.8, and gcc 3.3.2, but soon discovered that gcc-3.3.2 will not be able to build a cross compiler for some archs like the alpha, ia64, powerpc and even i386 ;) without some modifications[2] but with some help, I got all headers fixed, except for the ia64, which still doesn't work

2) KERNEL CROSS COMPILING

equipped with the cross compiling toolchains for all but one of the architectures mentioned above, I wrote a little script, which basically does nothing else but compiling a given kernel for all possible archs.

basically this can be accomplished by doing:

make ARCH=<arch> CROSS_COMPILE=<arch>-linux-

the first result was harrowing:

				2.4.25-pre  2.6.2-rc
   ----------------------------------------------------
	[ARCH alpha/alpha]      succeeded.  succeeded.
	[ARCH hppa/parisc]      failed.     failed.
	[ARCH hppa64/parisc]    failed.     failed.
	[ARCH i386/i386]        succeeded.  succeeded.
	[ARCH m68k/m68k]        failed.     failed.
	[ARCH mips/mips]        failed.     failed.
	[ARCH mips64/mips]      failed.     failed.
	[ARCH ppc/ppc]          succeeded.  succeeded.
	[ARCH ppc64/ppc64]      failed.     failed.
	[ARCH s390/s390]        failed.     failed.
	[ARCH sparc/sparc]      failed.     succeeded.
	[ARCH sparc64/sparc]    failed.     failed.
	[ARCH x86_64/x86_64]    failed.     succeeded.

so only alpha, i386 and ppc did work on the first run.

what I discovered was, that there IS a big difference between an empty .config file and a non exististing one, where latter allowed the make oldconfig to work similar to the make defaultconfig available on 2.6, and added some archs (see [3] for details)

PROBLEMS & SOLUTIONS HERE:

ppc64:
CROSS32_COMPILE=ppc-linux-
is needed to make this work as expected.

hppa/hppa64:
seems not to compile without using a very big patch, which changes a lot inside the kernel

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

m68k:
fails with a hundred errors in the includes

3) CONCLUSIONS

it seems that recent kernels (2.4 and 2.6) do not support most of the architectures they contain without heavy patching (haven't tested for arm, sh3/4, ...)

building cross compiler toolchains isn't that often done otherwise it would not require such modifications, and the documentation would be up to date ...

it seems that with some minor patches and kernel tweaks an automated build is in reach, although some archs seem to break from one release to the other ...

the non mainline branches, if they exist are some kernel versions behind the current mainstream kernel, which might not mean anything ...

4) LINKS & REFERENCES

   [1]	http://vserver.13thfloor.at/Stuff/Cross/binutils-cross.spec
	http://vserver.13thfloor.at/Stuff/Cross/gcc-cross.spec

   [2]  http://vserver.13thfloor.at/Stuff/Cross/
		gcc-3.3.2-cross-alpha-fix.diff.bz2
		gcc-3.3.2-cross-i386-fix.diff.bz2
		gcc-3.3.2-cross-ia64-fix.diff.bz2
		gcc-3.3.2-cross-powerpc-fix.diff.bz2

   [3]  http://vserver.13thfloor.at/Stuff/Cross/compile.info

   ia64:	http://www.gelato.unsw.edu.au/kerncomp/
   mips:	http://www.linux-mips.org/kernel.html
   hppa:	http://www.parisc-linux.org/kernel/index.html
   ppc64:	http://linuxppc64.org/
Quoted 15 lines
Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 10 lines
Timothy D. Witham - Lab Director - [email protected]
Open Source Development Lab Inc - A non-profit corporation
12725 SW Millikan Way - Suite 400 - Beaverton OR, 97005
(503)-626-2455 x11 (office)    (503)-702-2871     (cell)
(503)-626-2436     (fax)

-
To unsubscribe from this list: send the line "unsubscribe linux-gcc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
The church is near, but the road is icy.
The bar is far, but i will walk carefully. - Russian proverb
#7 lore raw
In reply to David Mosberger
Quoted 3 lines · David Mosberger
Quoted 3 lines
Quoted 3 lines

A recipe for building ia32->ia64 cross-toolchain on Debian can be found here:
http://www.gelato.unsw.edu.au/IA64wiki/CrossCompilation

I recommend Dan Kegel's page for anyone trying to build a cross compiler to linux. See
http://kegel.com/crosstool
This isn't very hard to follow, and it gives you a properly configured and built gcc/glibc for the target.

I don't recommend the inhibit_libc trick for building linux crosses. It may work well enough for kernel builds, but it will give you a subtly broken gcc, and that may lead to confusion later.

Signature · 1 line
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
#15 lore raw
In reply to Herbert Poetzl
Quoted 4 lines · Herbert Poetzl

mips/mips64:
seem to use the 'obsoleted' -mcpu= option which results in a cc1: error: invalid option `cpu=<cpu-here>'

FYI, this has been addressed in the MIPS CVS tree not so long ago, so
changes are not merged to the mainline yet. Actually, even the CVS version isn't fully complete yet -- a small update is still pending approval. The problem isn't related to doing a build with cross-tools -- it happens when building natively as well.

Otherwise, cross-compilation is the usual way of doing builds for MIPS
and it works in general.

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +