SkayaWiki

ToolChain

JeromePetazzoni :: DerniersChangements :: DerniersCommentaires? :: ParametresUtilisateur :: http://www.enix.org/ :: Vous êtes ec2-18-224-54-118.us-east-2.compute.amazonaws.com

Introduction


There are some cases when you want to compile programs for a computer (we say target then), but can't compile them directly on the target for miscellaneous reasons :


As long as you are compiling, for instance, x86 code for another x86 computer, things are trivial ; but when you want to compile a kernel for your powermac on a x86 PC, or when you want to compile binaries for a small embedded platform (not enough RAM and disk space) on your x86 (or anything) workstation, you have to cross-compile. You will simply use a compiler running on your workstation to produce binaries which will run on another architecture. The very popular GCC supports cross-compilation easily, but for each target (powerpc, mips, sparc...) you have to compile (or install) a new cross-compiler.

For the BroadCom96345


Follow the following indications ; this router is a MIPS32-compatible CPU running in big-endian mode, so the arch is mips.

Compilation of a cross-compiler


I will assume that you're using Debian ; if you use another distro, you have three(+1) choices :

Instead of supplying every possible cross-compiler (which would mean a very large number of packages), Debian offers a simple way to compile your own cross-compiler. You can read the HOWTO, or follow those simple steps :

Notes


A couple of things to know :

Kernel cross-compilation


Go to your kernel sources ; and when running make menuconfig, append ARCH=mips (or ARCH=powerpc, etc.) on the command-line. Then, when compiling the kernel, try to append ARCH=mips CROSS_COMPILE=mips-linux- to the make bzImage invocation. Note that when specifying ARCH, you don't add the -linux suffix ; and don't forget the trailing dash in CROSS_COMPILE. You might have to modify the top-level Makefile to set the CROSS_COMPILE variable here. Another way to do it (which works reliably) is to use make-kpkg ; if you don't use it yet to compile your kernels, don't hesitate to learn it ! It is a very convenient way to produce Debian packages of kernel images + modules + configuration + system.map, ready to be installed. You can use it for cross-compilation like that : make-kpkg clean && make-kpkg --arch powerpc --cross-compile=powerpc-linux- --append-to-version -g3 kernel_image kernel_headers ; that's actually the line I used to cross-compile a kernel for a g3 powermac. Note that you can omit the kernel_image kernel_headers parts ; it will then compile the kernel but won't create packages.
Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]