Qemu 'native-emulated' compiling
Introduction
Since qemu finally works form mips and mipsel, it is possible to do all your 'native-emulated' compiling on you host machine. Using qemu in user mode, not in system mode. This may be the easiest way ( and quicker then native compiling on an embedded device ) to compile for a different architecture. Of course qemu emulation is used, so it won't be as fast as cross compiling. But using the 'native-emulated' method you don't need to take anything into account you normally would have to do for cross compiling.
Instructions
- make menuconfig
- select architecture ( mips, mipsel, arm )
- select Debian release ( sid, squeeze )
- make sure "Use qemu to perform Debian second stage install on the host" is enabled
- make debian/rootfs ( it will create a Debian root filesystem for the selected architecture )
- make chr ( enter the change root - in the background qemu-<arch>-static is called which transparently starts emulating for <arch>
- apt-get update
- apt-get install build-essential
- add deb-src line to /etc/apt/sources.list
- make, gcc, dpkg-buildpackage, etc all will be available!
Example: build the tool 'sl'
- make chr
- apt-get source sl
- apt-get build-dep sl
- cd sl-<version>
- dpkg-buildpackage
- cd ..
- dpkg -i sl_<version>_<arch>.deb
- /usr/games/sl
Scratch-box 2
Scratch box 2 uses a combination of cross compiling and emulation, transparently. This is the fastest, transparent way of compiling. All the cross compile related pains are taken care of by scratch-box 2. Scratch-box 2 automatically detect if it need to start qemu, or not. E.g. it transparently uses the installed cross-compiler, but if some binary needs to be executed for the target architecture, qemu is launched. Very neat.