PowerPC Run

From KVM
Revision as of 12:54, 30 October 2009 by HollisBlanchard (talk | contribs) (replace moinmoin smileys)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Run

Log in to target and run:

./qemu-system-ppcemb --enable-kvm \
  -nographic \
  -m 128 \
  -M bamboo \
  -kernel uImage.bamboo \
  -L . \
  -append "your guest kernel command line"

The location specified with -L must contain the bamboo.dtb device tree file.

Note: Consult the QEMU documentation for a more complete list and explanation of these options.

virtio

In the case that virtio is activated in the guest kernel, you can add virtio devices at the qemu command line.

Examples (nothing special for ppc):

network

This adds a virtio network device visible to the guest and the external network:

 ./qemu-system-ppcemb [...] -net nic,model=virtio -net tap 

Note: You must have CONFIG_VIRTIO_NET=y in your guest kernel .config.
Note: You must have Qemu networking configured to use a tap device. See Networking for details.

disk

This adds a virtio disk device:

 ./qemu-system-ppcemb [...] -drive file=pathtoyourfile.img,if=virtio 

The device appears as /dev/vda in the guest.

Note: You must have CONFIG_VIRTIO_BLK=y in your guest kernel .config.

Known Pitfalls

no guest console

Specifying a console in the guest kernel parameters might let the guest output fail. If you think your output is missing try without any "console=" parameter

virtio net requirements

You will need to enable tap and bridge support in the host kernel.

You may also need to download and install bridge-utils (use configure --host=i386-linux --target=ppc-linux and all other cross build stuff you need).

Usually embedded boards use a nfs root device, this may conflict with the need to ifdown the device you want to bridge, but you might use the second ethernet device in that case. You need to edit /etc/qemu-ifup to your needs here is an example that creates bridge br0 on demand and uses eth1 as external device on that bridge:

#!/bin/bash

bridge=br0
netdev=eth1
guestdev=$1

if [ ! -c /dev/net/tun ]
then
	echo "network init failed - /dev/net/tun does not exist"
	exit 1
fi

echo "test for existing bridge $bridge"
brctl showmacs $bridge

if [ $? -eq 0 ]
then
	echo "ok - bridge $bridge already available"
else
	echo "need to create bridge $bridge"
	ifconfig $netdev down
	brctl addbr $bridge
	ifconfig $bridge up
	ifconfig $netdev up
	brctl addif $bridge $netdev
	echo "created bridge $bridge"
	brctl show
fi

ifconfig $guestdev up
brctl addif $bridge $guestdev