Running PCBSD and MeeGo under qemu-kvm

Motivation

The qemu emulator and kvm virtual machine are two of the hottest,
slickest technologies on the Linux platform. The qemu-kvm
combination provides the user with significant support for hardware
virtualization. An OS running under qemu-kvm can interact with
and even control devices installed in the host computer.

Why would an ordinary desktop user who doesn't run a datacenter
care about virtualization? A few reasons are apparent to me:

Virtualization is potentially an even more convenient route to test-driving
a new piece of software than a LiveCD. For example, changes to the
virtual hard disk during a qemu-kvm session will be saved, meaning
that configurations and preferences need only be entered once.
Also, according to Chris Wright of RedHat, qemu-kvm should run at
80% of native speed, much faster than any LiveCD application.

Unlike a LiveCD session, a qemu instance can run applications
meant for different hardware. Cross-platform emulation, after
all, was the original purpose of qemu.

A qemu-kvm session is contained in a regular desktop window, which
can be iconified, paused, sent signals, etc. Thus a user can chat
using his/her regular IRC client in one window while running a
non-native OS in another. As Greg Marsden pointed out in
a recent
presentation, profiling and testing an OS running under qemu is
easier than when it's running on bare metal.

Begin by installing qemu, qemu-img, qemu-kvm and libvirt. When
libvirtd is running, the virbr0 device is created. (See above.) In
order to have access to the network,
modify /etc/sysctl.conf
to allow NAT or bridged networking for your guest system.

Running MeeGo Netbook Image under qemu-gl using pre-built image

Installation of the prebuilt MeeGo qemu image is almost too easy
following
the detailed
instructions. Note the use of a special installation method for
qemu-gl:

sudo yum localinstall qemu-gl-0.12.4-5.1.i386-fc12.rpm --nogpgcheck

Also, on Fedora 13 I had to install libvirt in addition to the
packages specified on the MeeGo site. libvirt is what provides
access to the network. Some configuration of
libvirt is necessary using virtsh.

The pre-built MeeGo image starts up remarkably quickly. The fact
that the image is running the 2.6.35 kernel (as of October 2010) is
impressive, but instead of the much vaunted btrfs filesystem, the
prebuilt image has the creaky old ext3. The chromium browser
segfaults, perhaps because without forwarding port 80 there's no HTTP connection.

CORRECTION after 11/2010 MeeGoCon: qflasher is in fact publicly
available without an IMEI, if challenging to find. (Thanks, Leinir!) See these helpful
instructions. As far as I can make out, there's no way to
boot even the "open"
handset images without owning an N900 and having access to a valid
IMEI. (The situation with the IVI images appears to be similar.) The
.ubiimg flash image is available but without the bootloader. Without
the bootloader or the qflasher utility, there's no way to create a
bootable image. Presumably access to these files is restricted
because they contain propietary firmware for the Bluetooth, video and
wireless. Following the instructions leads
to the error message

qemu: fatal: Trying to execute code outside RAM or ROM at 0x00018020

NOTE: see CORRECTION above. There is a qflasher source
rpm available but it doesn't create a qflasher executable. As
far as I can make out, users who want to test-drive the handset
preview must build from source and use their own flash filesystem
creator and bootloader to create a bootable image. Even this option
may not be
available to all users:

Usage Requirements
To be able to use MIC2, your host machine to run mic2 must have Intel(r) Atom(tm)
or Intel(r) Core(tm) 2 CPU (support for SSSE3), this is a hard requirement (ARM image is exceptional)

Running MeeGo Netbook Image under qemu-gl using installer

I also tried installing MeeGo using a method similar to PCBSD
(below). First create a "hard disk":

Now create a virtual disk drive image for your new OS to use.
The PCBSD bootloader doesn't appear to recognize qemu's native
qcow2 format, so use raw. Unfortunately, while a qcow2 image is
growable, the raw image is 10 GB in size immediately. The PCBSD
installer demands a disk at least this large.

Here we're provisioning the VM with 4 GB of memory, electing to
boot from the CDROM, choosing the standard VGA graphics driver and
telling the installer to write to the "disk" image pcbsd.raw.
Unless I specified the standard vga, the system defaulted to
"cirrus," which did not work.

The PCBSD installer starting up.

Just wait and let the bootloader timeout so that the default
installer will run. A series of choices will be presented as with
most Linux installers. I elected to install all the options (jails,
krb, etc.) that were unfamiliar from Fedora 13 with Gnome.
Installation took about four hours on a dual-core AMD x86_64 system.
The interface in qemu has some oddities, notably that it's necessary
to move the cursor away from installer soft buttons to release them.
Apparently a button-up event doesn't occur when the mouse button is
released, only cursor is moved away. Also, the qemu window will
grab the cursor and prevent it from being moved outside the VM
window. To release the cursor, the user must press and
release the Ctrl-Alt keys.

When the installation is finished, open a terminal window using the
launcher in the lower left-hand corner and halt the machine using
the new root account.

For subsequent boots, forget about the "cdrom" and boot
directly from the new disk image: