[ale] Kernel cross compilation

mike at trausch.us mike at trausch.us
Tue Sep 18 16:27:47 EDT 2012


On 09/18/2012 01:26 PM, Boris Borisov wrote:
> Never done it that is why I'm asking.
> 
> If you build kernel for MIPS CPU on x86 host but you are using debian
> 6 installation on host for example and build the same kernel but on
> different distro ( Ubuntu ) are these two kernel will be indentical ?

No, the kernels won't be identical.  There are massive fundamental
differences (boot process, low-level things like interrupt handling and
memory management, etc.) that vary between platforms.

The kernels should (more-or-less) appear the same from userspace, since
they're both Linux kernels.

In order to build for MIPS from x86, first you need a MIPS toolchain
(gcc and binutils; a libc is not necessary to build the kernel because
it does not use the standard C library).  Then, you must extract a
source tree (or git clone one) and then run:

$ make ARCH=foo nconfig

To configure the kernel and then:

$ make ARCH=foo

To build it.

If you need to build a kernel for another system in a tree that you've
already built for, say, the local system, you must "make mrproper"
first, so as to clean up all the artifacts and configuration from the
previous build(s) that you've done; this will also reset the build count
for the tree to 1.

Where "foo" is the kernel's name for the given architecture.  As an
example, you can build the Linux kernel to run as a normal process on a
Linux system by specifying "ARCH=um" (for user mode linux).  The list of
architectures is available as the names of the directories in arch/ in
the distribution; for MIPS, it's simply "mips":

$ make ARCH=mips nconfig
$ make ARCH=mips

Also, be sure that you set the config option CONFIG_CROSS_COMPILE
("Cross-compiler tool prefix") so that the kernel's build system knows
how to find your cross-gcc in order to properly build the kernel.

	Good luck!

	Mike

-- 
A man who reasons deliberately, manages it better after studying Logic
than he could before, if he is sincere about it and has common sense.
                                   --- Carveth Read, “Logic”

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 726 bytes
Desc: OpenPGP digital signature
Url : http://mail.ale.org/pipermail/ale/attachments/20120918/6034bc89/attachment.bin 


More information about the Ale mailing list