PowerPC Host Userspace

From KVM
Revision as of 17:03, 13 May 2009 by HollisBlanchard (talk | contribs) (link text with URL)

What You Need

  1. A copy of the qemu development source tree.
  2. A copy of the Linux kernel source tree. Note: qemu.git will not build with Linux 2.6.28 or earlier.
  3. An installed copy of libfdt, built for PowerPC.

If you are cross-compiling from a non-PowerPC host, you also need:

  1. A cross-compiler, such as one built by crosstool.
  2. An installed copy of the zlib library, built for PowerPC.

Where to install the libraries

Before building qemu, you install the libfdt and zlib libraries where your toolchain will find them. If you are not cross-compiling, skip this section (because your toolchain will find them in the usual /usr/lib).

You can use cpp -v to find your toolchain's built-in prefix. For example, if your toolchain was created by crosstool, cpp will say something like this:

% powerpc-440-linux-gnu-cpp -v
...
#include "..." search starts here:
#include <...> search starts here:
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/3.4.5/include
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/3.4.5/../../../../powerpc-440-linux-gnu/sys-include
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/3.4.5/../../../../powerpc-440-linux-gnu/include
End of search list.

The prefix here is /opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-440-linux-gnu/powerpc-440-linux-gnu. (Basically pick the last ".../include" path and go up one directory.) Use that prefix to install zlib and libfdt.

Building Qemu for PowerPC KVM

Here is an example for the configure script at the top level of the kvm-userspace repository:

If cross-compiling, run this first:

cross=powerpc-440-linux-gnu-

./configure \
       --disable-sdl \
       --disable-gfx-check \
       --target-list=ppcemb-softmmu \
       --cross-prefix="$cross" \
       --kerneldir="/home/hollisb/source/kvmppc-dev.hg"

Build

make will produce qemu/ppcemb-softmmu/qemu-system-ppcemb. You must transfer that executable and qemu/pc-bios/bamboo.dtb to the target.