|
|
Log in / Subscribe / Register

What about cross-compilation?

What about cross-compilation?

Posted Feb 6, 2003 18:35 UTC (Thu) by sjmadsen (guest, #4035)
Parent article: Driver porting: compiling external modules

The Makefile trickery at the end isn't going to work in cross-compiler enviornments. My company is building a product that uses Linux as the embedded OS, but builds typically take place on Solaris.

Even if we were building on Linux, it's unlikely that the OS on the build machine is going to match the embedded environment.


to post comments

What about cross-compilation?

Posted Feb 6, 2003 21:02 UTC (Thu) by Peter (guest, #1127) [Link]

The Makefile trickery at the end isn't going to work in cross-compiler enviornments. My company is building a product that uses Linux as the embedded OS, but builds typically take place on Solaris.

True enough. In fact, there is no automated way for the computer to read your mind and know, for a specific module build, where the matching kernel tree resides. If you don't give the computer any more information, one reasonable guess is "wherever the currently-running kernel was built, assuming it was built on this machine". In fact, I can't think of a better default guess. But if this turns out to be wrong - for various reasons, including cross-compilation - you are going to have to specify the source location.

Putting that location in the Makefile as a special macro like KERNELDIR makes it possible to override on the command line: 'make KERNELDIR=...'. The other option, of course, is to work to get your module integrated into the official kernel tree, at which time you are rid of this headache once and for all.

What about cross-compilation?

Posted Feb 7, 2003 15:50 UTC (Fri) by dwmw2 (subscriber, #2063) [Link] (4 responses)

It works perfectly for cross-compilation for me. If you override CROSS_COMPILE (or have it set in your kernel's top-level Makefile) that works just as it always did:@
make KDIR=/local/arm-kernel CROSS_COMPILE=arm-linux-gnu-

Note also that the article is somewhat misleading -- the Makefile fragment

> KERNELDIR = /usr/src/linux
> CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O
>
> all: module.o

... was _always_ broken and nonportable -- building using the kernel makefiles was the only way to get it working portably since about the 2.0 kernel. It doesn't kernel+arch-specific CFLAGS like -mregparm= -mno-gp-opt -mno-implicit-fp right.

What about cross-compilation?

Posted Mar 3, 2005 10:48 UTC (Thu) by mhb (guest, #28187) [Link] (3 responses)

I have tried this on the simple hello.c module.
I use the ELDK cross compiler to generate code for
a ppc 440 from an X86 based machine. It fails
with some emulation mode problems, any ideas ?

[root@basher ebonymnt]# export CROSS_COMPILE=ppc_4xx-
[root@basher ebonymnt]# make -C /home/simon/ebonymnt/linux-2.6.10 M=`pwd`
make: Entering directory `/home/simon/ebonymnt/linux-2.6.10'
LD /home/simon/ebonymnt/built-in.o
CC [M] /home/simon/ebonymnt/hello.o
Building modules, stage 2.
MODPOST
CC /home/simon/ebonymnt/hello.mod.o
LD [M] /home/simon/ebonymnt/hello.ko
ppc_4xx-ld: unrecognised emulation mode: elf_i386
Supported emulations: elf32ppclinux elf32ppc elf32ppcsim
make[1]: *** [/home/simon/ebonymnt/hello.ko] Error 1
make: *** [modules] Error 2
make: Leaving directory `/home/simon/ebonymnt/linux-2.6.10'
[root@basher ebonymnt]#


What about cross-compilation?

Posted Oct 14, 2005 0:02 UTC (Fri) by msprauve (guest, #33084) [Link] (1 responses)

Did anyone develop a resolution to this problem?

What about cross-compilation?

Posted May 2, 2006 13:59 UTC (Tue) by DeferX (guest, #37486) [Link]

Tray this
make CROSS_COMPILE=ppc_6xx- ARCH=ppc
It's work

By
defer

What about cross-compilation?

Posted Nov 10, 2005 22:02 UTC (Thu) by urs (guest, #33777) [Link]

You should call

make CROSS_COMPILE=ppc_4xx- -C ...

instead of your command

CROSS_COMPILE=ppc_4xx- make -C ...

which handles make variables differently. See the make manual for details.

urs


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds