John Utz wrote:
> Hello;
>
> Can anybody tell me what variable i need to set in the kernel makefile
> or elsewhere that points the build to my cross compile gcc?
>
> i have tried setting, CC, HOSTCC and a few other things and it hasnt
> worked.
>
> no matter what i try, the build seems to keep using the system gcc and
> that is mighty annoying.
>
> the only way i have managed to cross build a kernel is to actually mv
> the system gcc out of the way and make a softlink to my cross-compiler.
>
> which works, but causes a large chunk of grief when i try and build an
> app for my desktop and then get the wrong executable format for my
> desktop because i have forgotten to return the gcc link back to
> pointing at the system gcc. :-(
>
> what am i failing to understand about the kernel build process?
>
> tnx!
>
> johnu
>
>
To cross compile the kernel, call make while setting CROSS_COMPILE to
the prefix of the crosscompiling gcc. Also set ARCH to something
appropriate so that the kernel options for the appropriate architecture
to be used. For instance, if crosscompiling on an x86_64 system a kernel
for an i686 system, run "make ARCH=x86 CROSS_COMPILE=i686-pc-linux-gnu-"
if the name of the crosscompiling gcc is "i686-pc-linux-gnu". Be sure to
include the trailing dash. The kernel's makefile will append the name of
the gcc or binutils program it needs to call to the CROSS_COMPILE
variable. When it needs gcc, it calls ${CROSS_COMPILE}gcc, which expands
to the concatenation of the string "i686-pc-linux-gnu-" and "gcc", thus
calling i686-pc-linux-gnu-gcc, your crosscompiler.
I think this stuff is clearly explained in the Gentoo Crosscompiling
documentation found at http://embedded.gentoo.org/handbook/.
--
[email protected] mailing list