Setting up QEMU

From KolibriOS wiki
Revision as of 17:35, 29 May 2018 by Nisargshah95 (talk | contribs) (add a workaround for qemu "usbdevice" option warning)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The purpose of this tutorial is to setup KolibriOS in QEMU (virtual machine emulator).

Using command line

If you already familiar with QEMU but have toubles with net, simply add following options to the qemu start command:

-net nic,model=rtl8139 -net user

It should work fine. So the whole run command looks like this:

qemu-system-i386 -L . -m 128 -fda /path/to/kolibri.img -boot a -hda /path/to/c100.img -hdb /path/to/c100_2.img -localtime -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -usb -usbdevice tablet


-L .

BIOS, VGA BIOS and keymaps in current directory. [1]

-m 128

Virtual RAM size to megs megabytes. [2]

-fda /path/to/kolibri.img

Floppy disk image. [3]

-boot a

Boot floppy first. [4]

-hda /path/to/c100.img -hdb /path/to/c100_2.img

Hard disk image. [5]


Set virtual machine time to host machine time

-vga vmware

Emulating vga card. [6]

-net nic,model=rtl8139 -net user

Net settings. ne2k_pci, RTL8139, i8255x, i8254x and Pcnet are all supported. [7]

-soundhw ac97

Emulating sound hardware. [8]

-usb -usbdevice tablet

The usb tablet HID device may be used to ease switching from one window to another on the host machine. (Mouse does not stay captured.) [9]

USB device warning

If you get a warning "qemu-system-i386: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead", use "-device usb-tablet" instead of "-usbdevice tablet"

KVM issues

If qemu complains about KVM errors (e.g. "Could not access KVM kernel module: No such file or directory"), try adding the -no-kvm flag to the command above.

Copying files to HDD images in Linux

Let's say you have a hi.txt file with "Hello world!" in it, and you'd like to make it available to KolibriOS easily.

First, we'll need to create an empty HDD image named hda.img and format it:

touch hda.img

dd if=/dev/zero of=hda.img count=<size in KB> bs=1k

Replace <size in KB> with the size of the image in KiloBytes, e.g. 102400 for a 100MB image.

mkfs.msdos hda.img

Now list files on the image:

mdir -i hda.img

You should see something like this:

 Volume in drive : has no label
 Volume Serial Number is FD16-6B35
Directory for ::/

No files
                        104 634 368 bytes free

Copying files is done via the mcopy command. Remember, the file we want to copy is hi.txt, replace it's name for different files:

mcopy -i hda.img hi.txt ::/

Listing files should reveal that we succeeded:

mdir -i hda.img

Example output:

 Volume in drive : has no label
 Volume Serial Number is FD16-6B35
Directory for ::/

hi       txt         8 2014-03-15  21:04  hi.txt
        1 file                    8 bytes
                        104 632 320 bytes free

Now we'll need to boot qemu using our new disk image, add this to the qemu command above:

-hdc /path/to/hda.img

Note: normally you should boot with option B set to OFF. If after boot you can not see the disk we added 1) open a bug report and 2) try booting with option B set to ON.

Accessing the file inside KolibriOS:

The new disk should be visible now, it is one of /hdX/* (if you booted with option B set to ON, it may be one of /bdX/*). Accessing it is easy, e.g. in KFM hd0/1 will already be open on the right panel.


Sometimes, you may not be able to freely edit the .img virtual disk that you create and KolibriOS may show garbage values as files. Some developers prefer to use something like this :

qemu-system-i386 -L . -m 128 -fda /path/to/kolibri.img -boot a -localtime -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -usb -usbdevice disk:format=raw:fat:/some/directory -usbdevice tablet

This will make KolibriOS mount /some/directory from your Linux machine to a USB drive on KolibriOS. You can access your files from KolibriOS using any file manager.

Using Qemu Manager

Step by step tutorial follows! We’re going to need these programs/files:

The first thing we’re going to do is to setup KolibriOS virtual machine on Qemu Manager, so it’s assumed that you have installed it already.

Launch Qemu Manager and you will see the following window.


Click on the Img00002.gif toolbar button to add a new machine. Then it will ask you to write the new virtual machine name:


Then click Next and in that window fill the Virtual Machine RAM textbox with a RAM needed, remember that KolibriOS support 8MB of RAM as a minimum, I suggest using 64Mb


Click Next and in this window check “This Virtual Machine Does Not Require A Virtual Drive”


In the next window don’t modify anything:


Click Next and in the following window click on “Save Virtual Machine” button


It will show you the following window:


Select the “Disk Configuration” tab and click on the shown button, which is for choosing our KolibriOS floppy image:


Then select the appropiate floppy image


It will warn you but just click YES to continue:


Next select “Boot from floppy disk”


Now just click Play, and let it fly!