Version 2 (modified by amain, 8 years ago) (diff)

--

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 quickest and easiest way 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
  • make, gcc, dpkg-buildpackage, etc all will be available!

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.