Gentoo Archives: gentoo-embedded

From: Nathan Brink <ohnobinki@××××××××××××××××××××××××.net>
To: gentoo-embedded@l.g.o
Subject: Re: [gentoo-embedded] cross compilation kernel makefile variable
Date: Sat, 19 Jan 2008 01:42:27
Message-Id: 4791557C.9000208@ohnopublishing.homelinux.net
In Reply to: [gentoo-embedded] cross compilation kernel makefile variable by John Utz
1 John Utz wrote:
2 > Hello;
3 >
4 > Can anybody tell me what variable i need to set in the kernel makefile
5 > or elsewhere that points the build to my cross compile gcc?
6 >
7 > i have tried setting, CC, HOSTCC and a few other things and it hasnt
8 > worked.
9 >
10 > no matter what i try, the build seems to keep using the system gcc and
11 > that is mighty annoying.
12 >
13 > the only way i have managed to cross build a kernel is to actually mv
14 > the system gcc out of the way and make a softlink to my cross-compiler.
15 >
16 > which works, but causes a large chunk of grief when i try and build an
17 > app for my desktop and then get the wrong executable format for my
18 > desktop because i have forgotten to return the gcc link back to
19 > pointing at the system gcc. :-(
20 >
21 > what am i failing to understand about the kernel build process?
22 >
23 > tnx!
24 >
25 > johnu
26 >
27 >
28 To cross compile the kernel, call make while setting CROSS_COMPILE to
29 the prefix of the crosscompiling gcc. Also set ARCH to something
30 appropriate so that the kernel options for the appropriate architecture
31 to be used. For instance, if crosscompiling on an x86_64 system a kernel
32 for an i686 system, run "make ARCH=x86 CROSS_COMPILE=i686-pc-linux-gnu-"
33 if the name of the crosscompiling gcc is "i686-pc-linux-gnu". Be sure to
34 include the trailing dash. The kernel's makefile will append the name of
35 the gcc or binutils program it needs to call to the CROSS_COMPILE
36 variable. When it needs gcc, it calls ${CROSS_COMPILE}gcc, which expands
37 to the concatenation of the string "i686-pc-linux-gnu-" and "gcc", thus
38 calling i686-pc-linux-gnu-gcc, your crosscompiler.
39 I think this stuff is clearly explained in the Gentoo Crosscompiling
40 documentation found at http://embedded.gentoo.org/handbook/.
41 --
42 gentoo-embedded@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-embedded] cross compilation kernel makefile variable Mike Frysinger <vapier@g.o>