Saturday, January 10, 2009

Installing QEMU, KQEMU

QEMU is an emulator, which can be setup on both windows and linux, installing it on linux is simple and straight forward, but little complex and tricky on windows and most of the times. So I prefer to use it on linux. QEMU can emulate an x86 machine, (i.e your PC), so it can be treated as a vitual pc, with an hard disc image you are ready to install any OS on that virtual machine. KQEMU is an accelerator which increases the speed of emulation to close to native speed when host and guest OS are running on the same machine, i.e Target machine is same as host machine, This is achived by emulating only the kernel, and running the user code directly on the machine, Recent machines also support Virtulization at the hardware level, but that is out of scope of this document, in that case you can get native speeds on guest OS also.

Download QEMU source code from this link (http://bellard.org/qemu/qemu-0.9.1.tar.gz) and save it in some directory(qemu), unzip the same, and configure and install it. For installing you need root permissions, you can use sudo instead of that. I assume that you have setup gcc 3.4 and some basic C libraries needed for development work. If not please do that first, use following commands to do that,

$ sudo apt-get install gcc-3.4
$ sudo apt-get install build-essential

$ cd qemu
$ tar zxvf qemu.x.y.z.tar.gz
$ cd qemu.x.y.z
$ ./configure
$ make
$ sudo make install

You are done, it is possible that you may not have LibSDL setup, and zlib, if not please install libSDB with the following command and try again.

$ sudo apt-get install libsdl1.2-dev
$ sudo apt-get install zlib1g-dev

Download KQEMU souce code from the this link (http://bellard.org/qemu/kqemu-1.3.0pre11.tar.gz), and save in in the same directory as above, unzip and configure and install it, for installing you need to have root permision or else use sudo. Since all libs are setup already for QEMU, you wont get any missing library or missing .h file errors here.

$ cd qemu
$ tar zxvf kqemu-1.3.0pre11.tar.gz
$ cd kqemu-1.3.0pre11
$ ./configure
$ make
$ sudo make install

You are done with kqemu installation. And ready to emulate any of the machines supported by QEMU, if you know qemu, you can develope your own machines or embedded targets also. I am developing an emulator for Our Target phone.

2 comments:

  1. Hi I am new to ARM and QEMU will you please explane how compile kernal for mini2440 and running on QEMU

    ReplyDelete
  2. Hi Avtop,

    First download the kernel from the kernel.org, and then apply the patch for the hardware u r running it for.

    Then do make menuconfig and configure the kernel as required.

    Then do make dep, and make all to build the kernel.

    ReplyDelete