This page describes how to build the MeeGo SDK QEMU tools from source, including QEMU binary, patched kernel module, and stub libGL.
Contents |
Verified on Linux (Fedora 13) on 2010-10-11 by Elliot Smith
An alternative to building from source is to install a qemugl package from one of the repositories at http://download.meego.com/live/Tools:/SDK:/Host/
Check out http://wiki.meego.com/MeeGo_SDK_with_QEMU#Installing_qemugl_on_64-bit_ubuntu_10.04 for more details.
If you still prefer to build QEMUGL from sources, proceed with these steps:
Checkout the QEMU GL source code (this is basically QEMU with some patches to enable GL acceleration):
git clone git://gitorious.org/meego-developer-tools/meego-emulator-qemugl-x86.git
Checkout the qemu-gl branch:
cd meego-emulator-qemugl-x86 git checkout -b qemu-gl --track origin/qemu-gl
Make sure that there is KVM enabled and that the following libraries (development package) are installed on the host machine:
Configure qemugl:
./configure --target-list=i386-softmmu --enable-gl
Check the output from configure contains the strings below:
SDL support yes ...... KVM support yes
Build qemugl:
make sudo make install
This installs various QEMU binaries (default prefix is /usr/local), including qemugl and qemu-img used in this tutorial.
Verified on Linux (Fedora 13) on 2010-10-13 by Elliot Smith using this netbook image:
http://repo.meego.com/MeeGo/builds/trunk/1.1.80.1.20101012.1/netbook/images/meego-netbook-ia32/meego-netbook-ia32-1.1.80.1.20101012.1.img
with manually-built QEMU-GL (see above)
This section explains how to make a standard MeeGo netbook image run in QEMU with GL acceleration.
Create raw image file for MeeGo to install on. The qemu-img command is part of the QEMU build:
qemu-img create -f raw meego-netbook.raw 3.5G
Install MeeGo to the raw hard disk, using the downloaded .img file as the installation CDROM:
qemugl -m 1024 -vga std -boot d -hda meego-netbook.raw \ -cdrom meego-netbook-ia32-1.1.80.1.20101012.1.img
Boot into the image:
qemugl -m 1024 -vga std -boot c -hda meego-netbook.raw
Go through the installation steps to set up a meego user. The password you set here is also used as the root password, which we'll use below.
Note: occasionally I've halted the system before the meego user is setup. When I then try to boot into the UX, it fails because the user is missing. In this case, you can manually create the user from a root prompt (inside the QEMU image) with:
useradd -d /home/meego -M -s /bin/bash meego
Halt the system.
Now boot it again (this time with networking enabled; type the command below, press return, then press tab like crazy so you can get to the boot menu):
qemugl -m 1024 -vga std -net user,hostfwd=tcp:127.0.0.1:6666-:22 -net nic,model=e1000 \ -boot c -hda meego-netbook.raw
Next, edit the kernel command line on the boot menu screen so it looks like this:
vmlinuz-2.6.35.3-8.5-netbook ro root=/dev/sda2 vga=current s
This will get you a root prompt.
Then install ssh server (this makes the following steps easier, as you can cut and paste into the ssh prompt):
zypper install openssh-server chkconfig --add sshd /etc/init.d/sshd start
Use can now use ssh to login to the image with:
ssh -p 6666 root@127.0.0.1
(password is the same as you entered for your normal user when configuring the system)
Once logged in over ssh, set suid on the Xorg binary (so a normal user can start X):
chmod u+s /usr/bin/Xorg
Then install the SDK addons. First, add the MeeGo SDK repo:
zypper addrepo http://repo.meego.com/MeeGo/sdk/target/repos/meego/1.1/ meego-sdk
(you may need to use a different repo, depending on the netbook image you have)
Another alternative is to manually build the addons, kernel and virtiogl module in a chroot, then install them into the image.
Install the qemugl addon package into the image:
zypper install meego-sdk-qemugl-addon-netbook
Install virtiogl module for kernel:
zypper install kmod-virtiogl
Right now above package only supports kernel version of 2.6.35. If you need to build the SDK addons or a kernel and its modules, instructions are given below.
The image should now be ready. It can be started in QEMU with this command:
qemugl -m 1024 -net user,hostfwd=tcp:127.0.0.1:6666-:22 -net nic,model=e1000 -enable-kvm \ -vga std -enable-gl -device virtio-gl-pci -boot c -hda meego-netbook.raw
Note that you should still be able to ssh to this image as above.
If you have a handset image downloaded, follow these instructions to enable it to run in QEMU with GL acceleration.
Download a handset tarball (e.g. from http://meego.com/downloads/releases/1.0.80.8/meego-handset-day1-developer-preview), and untar the file:
tar xjvf meego-handset-ia32-aava-mtf-1.0.80.8.20100629.1-mrstnand.tar.bz2
(Note that this procedure should work for other images from http://repo.meego.com/MeeGo/builds/trunk/ too.)
Build kernel and modules version 2.6.35 from below section #Build packages for image running under QEMU GL, to get a kernel file and module directory. Supppose the kernel file is "bzImage".
qemugl -m 1024 -boot c -hda meego-handset-ia32-aava-mtf-1.0.80.8.20100629.1-sda.bin -vga std -kernel bzImage \
--append "root=/dev/sda1 init s"
Inside the emulated image, install these packages:
zypper install xorg-x11-drv-vesa zypper install mesa-dri-swrast-driver zypper install openssh-server zypper install gdb-gdbserver
Copy the kernel modules into the image. Suppose that there have been modules.tgz in host machine built from kernel build step above:
scp host@ipaddress:modules.tgz . tar xzvf modules.tgz mv module_directory /lib/modules/
Add a new repo file to "/etc/zypp/repos.d/". File name could be "meego-sdk.repo", and content is as below:
[meego-sdk] name=meego-sdk failovermethod=priority baseurl=http://download.meego.com/live/Tools:/SDK/Trunk/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego gpgcheck=1 enabled=1
Run "zypper" to install qemugl addon package to the image:
zypper install meego-sdk-qemugl-addon-handset
We are done now. The new image could be started in QEMU with below command:
qemugl -m 1024 -boot c -hda meego-handset-ia32-aava-mtf-1.0.80.8.20100629.1-sda.bin -net user,hostfwd=tcp:127.0.0.1:6666-:22 -net \
nic,model=e1000 -vga std -enable-gl -enable-kvm -device virtio-gl-pci -kernel bzImage --append "root=/dev/sda1"
Verified on Linux (Fedora 13) on 2010-10-14 by Elliot Smith using this netbook image:
http://repo.meego.com/MeeGo/builds/trunk/1.1.80.1.20101012.1/netbook/images/meego-netbook-ia32/meego-netbook-ia32-1.1.80.1.20101012.1.img
You can manually build the software required to run an image (netbook or handset) under QEMU with GL acceleration. But this is only recommended if a pre-built package for the software you want doesn't already exist (up-to-date packages should be available for both handset and netbook soon).
The steps below should be followed from inside a MeeGo image intended to run under QEMU. You could try this inside an emulated image, or by building a chroot from the raw disk image and working inside that (the latter is the only reasonable approach for building the kernel).
For building both the qemugl addon and the kernel+modules, you will need to install a toolchain first (either into the QEMU image, the toolchain, or both):
zypper install make gcc git patch diffutils
Alternatively, this command will get you all the MeeGo developer tools:
zypper install -t pattern development-tools
The addon package installed in above section can also be built from source. These steps are fairly easy to do inside the QEMU image itself.
You don't need to do this if you already installed a meego-sdk-qemugl-addon-* package (see above).
Install required packaged first:
zypper install libXfixes-devel libX11-devel
Checkout stub libGL source code:
git clone git://gitorious.org/meego-developer-tools/meego-emulator-libgl-x86.git
Build:
cd meego-emulator-libgl-x86 make make install
The approach we take for this is to use a chroot to build an RPM package for the new kernel and modules. This can then be easily transferred to the QEMU image and installed. Building the new kernel directly inside the QEMU image is too slow to be practical.
The first thing you'll need is a MeeGo chroot, built from the same image you're using under QEMU. See this page for instructions.
Enter the chroot.
Install rpmbuild (used to build the RPM from the kernel source):
zypper install rpm-build
Get the MeeGo kernel-source (this contains configuration files for building MeeGo kernels):
git clone git://gitorious.org/meego-os-base/kernel-source.git
Get the virtio patches for the kernel:
git clone git://gitorious.org/meego-developer-tools/meego-emulator-virtiogl-x86.git
Copy the virtio patch into the patches dir of kernel-source:
cp meego-emulator-virtiogl-x86/linux-2.6.35-virtio-for-qemu-gl-acceleration.patch kernel-source/patches
Download the kernel source tarball (NB you want the plain series version, not one with a patch number); in this case, I used a 2.6.35 kernel:
cd kernel-source curl -o linux-2.6.35.tar.bz2 http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.tar.bz2
Remain in the kernel-source directory.
Edit the series file to add the virtiogl patch to the list of patches to apply:
# Add Virtio-mem module for QEMU GL acceleration linux-2.6.35-virtio-for-qemu-gl-acceleration.patch
Edit the config-netbook file (used for both handset and netbook) to enable VIRTIOGL as a module:
CONFIG_VIRTIO_PCI=m CONFIG_VIRTIOGL=m # CONFIG_VIRTIO_BLK is not set # CONFIG_VIRTIO_NET is not set # CONFIG_VIRTIO_CONSOLE is not set # CONFIG_HW_RANDOM_VIRTIO is not set
Delete this line from the same file (we want to set a value and it could be confusing otherwise):
# CONFIG_VIRTIO_PCI is not set
Generate spec files and config files:
make make -f Makefile.config
This generates config files with names in the format kernel-xxx.config.
Patch the kernel:
./scripts/install-git-hooks ./scripts/sequence-patch.sh --quilt
Copy kernel config file into the source tree:
cp kernel-netbook.config tmp/linux-2.6.35-master/.config
Build a kernel RPM package (takes a long time):
cd tmp/linux-2.6.35-master make oldconfig (at each prompt, accept the default) make rpm-pkg
The resulting package is in /root/rpmbuild/RPMS/i386/kernel-2.6.35.3+-1.i386.rpm.
Copy this to the QEMU image over ssh or equivalent, for example:
scp -P 6666 /root/rpmbuild/RPMS/i386/kernel-2.6.35.3+-1.i386.rpm root@127.0.0.1:/root/
Get a root prompt in the QEMU image (either by booting into single user mode or logging in via ssh) and install the RPM:
rpm -ivh /root/kernel-2.6.35.3+-1.i386.rpm
Build and install the new initrd (a RAM disk image) for the kernel and modify the boot loader:
new-kernel-pkg --mkinitrd --install --make-default --depmod 2.6.35.3+
(replace 2.6.35.3+ with the version for your new kernel)
Next time you boot the image, it should default to using the new kernel with the virtiogl module.