Re: buliding and testing PowerPC KVM

Jerone Young
2008-03-25T18:23:10Z

* Sorry was going for paste, and somehow hit send.

So it's actually really easy using cross compiler to build everything. I
use my laptop and then copy over to our nfs root that our boards use.

Here are some instructions I wrote up for someone earlier. Excuse the
<fill me> parts but it is enough to get you going:

This is a run through of how to build kvmppc kernel & kvm-userspace

You will need (all will have info how to get and install):

- cross tools
- zlib
- Linux kernel with KVM powerpc patches
- kvm-userspace tools

1) Grabbing need tools
=======================

1a) Cross Tools
----------------
- If you are running on an x86 based machine you need these tools
- cross tools can be found at:
http://www.kegel.com/crosstool/crosstool-0.43.tar.gz
Installation
------------
- Untar tarball and go into folder
- If you are using Ubuntu linux .. replace /bin/sh symlink:
sudo ln -sf /bin/bash /bin/sh
- As root, create folder /opt/crosstool. Then change the
permissions to allow everyone write access..this can be done
by running:
"chmod 777 /opt/crosstool"
- As a normal user run:
./demo-powerpc-405.sh
- Once done you should have directory in that is something like:
/opt/crosstool/gcc-<version>-glibc-<version>
- Now you want to add the bin direcotry to your $PATH
/opt/crosstool/gcc-<version>-glibc-<version>/powerpc-405-linux-gnu/bin
- Done

1b) Zlib
----------------
- Now you need to compile a version of Zlib for powerpc
- This will be used when building qemu while building kvm-userspace
- zlib source can be found at:
http://www.zlib.net/zlib-1.2.3.tar.gz
Installation
------------
- Untar tarball and go into folder
- Type the following in the follwoing.
type in:
CC=powerpc405-linux-gnu-gcc ./configure
- The run:
make
- DO NOT INSTALL
- You will now want to keep this directory around for later.

1c) Linux kernel with KVM PPC
-----------------------------
- Currently patches are not upstream yet. You will need to get source
from Hollis Blanchard or myself

1d) Kvm-userspace
------------------
- You will need to get the bleeding edge latest version of
kvm-userspace
tools to work for powerpc.
- To get these you will have to grab them from the git repository.
- You must first install git tools that can be found here:
http://git.or.cz/
- Now you can grab the folder by running the command:
git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git

2) Compiling Linux Kernel with kvm powerpc
==========================================
- Untar and go into directory

2a) Compiling a host kernel
---------------------------
- You will first need to copy over the default configuration for the
board
you are running on.
-For 440EP Bamboo:
cp arch/powerpc/configs/bamboo_defconfig .config
-For 440EPx Sequioa:
cp arch/powerpc/configs/sequoia_defconfig .config
- Now go into the menuconfiguration with the follwoing command:
make ARCH=powerpc CROSS_COMPILE=powerpc405-linux-gnu- menuconfig
- Once in menu, enable menu option "Virtualization"
- Then enable Virtualization->Kernel-based Virtual Machine (KVM)
support
- Also enable Virtualization->KVM guest support for PowerPC 440
- Save configuration
- Now to compile your kernel
-For 440EP Bamboo:
- make ARCH=powerpc CROSS_COMPILE=powerpc405-linux-gnu- treeImage
-For 440EPx Sequioa:
- make ARCH=powerpc CROSS_COMPILE=powerpc440-linux-gnu- cuImage

- Once compilation is done you will find kernel in proper format in
arch/powerpc/boot/
-For 440EP Bamboo it will be "treeImage"
-For 440EPx Sequioa it will be "cuImage"

2b) Compiling a guest kernel for KVM
------------------------------------
- <will fill in, this is in the process of changing>

3) Builing kvm-userspace
------------------------------------
- you will need a zlib compiled for powerpc
- you will need a complied copy of Linux kernel with kvm powerpc

3a) Compiling kvm-userspace
---------------------------
- Go into kvm-userspace directory
- To configure kvm-userspace you need to run the follwing command.
NOTE to fill in areas where there is <?>:
./configure --arch=powerpc --cross-prefix=powerpc-405-linux-gnu- \
--with-patched-kernel --kerneldir=<compiled Linux kernel dir> \
--disable-sdl --disable-vnc-tls --disable-gfx-check
--disable-gcc-check \
--qemu-cflags="-I<zlib dir> -I<compile Linux kernel dir>" \
--qemu-ldflags="-L<zlib dir>" \
--disable-cpu-emulation

- Run make
- Once done you can grab the binary for qemu in:
qemu/ppcemb-softmmu/qemu-system-ppcemb

- This is the binary to use.
<will fill this in more, but again things are changing>

4) Running the code
===================

4a) Load kernel module & setup device node
------------------------------------------
<fill in>

4b) Running qemu
-----------------
<fill in>

>
> On Tue, 2008-03-25 at 18:56 +0200, Avi Kivity wrote:
> > Hollis Blanchard wrote:
> > > On Fri, 2008-03-21 at 13:02 +0200, Avi Kivity wrote:
> > >
> > >> Other than that, and the few minor comments that popped up, this
> > >> (very
> > >> nice) patchset will be very easy to merge. IIRC you mentioned it is
> > >> possible for me to get an s390 account; this will be very useful in
> > >> avoiding breaking this port, as happens quite often with ppc and
> > >> ia64.
> > >> I'd like to be able to do both build and run testing.
> > >>
> > >
> > > As for building the PowerPC code, cross-compiling is easy with
> > > http://kegel.com/crosstool . There are also a number of servers offering
> > > remote PowerPC ssh access: see http://penguinppc.org/dev/#remote .
> > >
> > >
> >
> > I now have a ppc account. Once you point me at the ppc kernel repo I
> > can start build testing.
> >