Want to do a test boot of a powerpc machine, but don't have one handy? The qemu ppc64-softmmu emulator is currently working well with the
pseries target, and it's fairly simple to get an emulated machine booting.
You'll need qemu version 1.6.0 or above. If this isn't provided by your distribution, you can build from upstream sources:
git clone git://git.qemu-project.org/qemu.git cd qemu ./configure --target-list=ppc64-softmmu make
the resulting qemu binary will be at
To run a pseries-like machine, we just need the
-M pseries option.
The default qemu device setup is okay, but I tend to configure my qemu a little differently: no video, and console on serial ports. This is what I generally do:
qemu-system-ppc64 -M pseries -m 1024 \ -nodefaults -nographic -serial pty -monitor stdio \ -netdev user,id=net0 -device virtio-net-pci,netdev=net0 \ -kernel vmlinux -initrd initrd.img -append root=/dev/ram0
This will print out a message telling you which PTY is being used for the serial port:
[jk@pablo qemu]$ qemu-system-ppc64 -M pseries -m 1024 \ -nodefaults -nographic -serial pty -monitor stdio \ -netdev user,id=net0 -device virtio-net-pci,netdev=net0 \ -kernel vmlinux -initrd initrd.img -append root=/dev/ram0 char device redirected to /dev/pts/11 (label serial0) QEMU 1.6.0 monitor - type 'help' for more information (qemu)
You can then interact with the emulated serial device from a separate terminal, using screen:
screen session, the sequence ctrl+a, ctrl+k will exit. Typing
quit at the
(qemu) prompt will terminate the virtual machine.
emulated network devices
The qemu environment above uses virtio-based networking, which may not work if your kernel doesn't include a virtio-net driver. In this case, just replace the
-device virtio-net-pci,netdev=net0 argument with:
emulated block devices
The qemu example above doesn't define any block devices, so there's no persistent storage available. We can use either the
spapr-vscsi (sPAPR virtual SCSI, the virtualised IBM hypervisor interface) or
virtio-blk-pci (virtio interface) devices. This choice will depend on your kernel; if it includes drivers for virtio, I'd suggest using that.
For virtio, add something like:
-device virtio-blk-pci,drive=drive0 -drive id=drive0,if=none,file=/path/to/host/storage
For sPAPR virtual SCSI, use something like:
-device spapr-vscsi -device scsi-hd,drive=drive0 -drive id=drive0,if=none,file=/path/to/host/storage
Either of these will define a qemu drive with id "
drive0", and attach it to backing storage at
/path/to/host/storage - this can be a plain file or block device. If you'd like to define multiple guest block devices, you need to use new ids (
drive2, …) for both -device and -drive arguments.