Setting up QEMU: Difference between revisions

From KolibriOS wiki
Jump to navigation Jump to search
m (add a workaround for qemu "usbdevice" option warning)
 
(20 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The purpose of this tutorial is to connect KolibriOS to internet using a virtual machine which is emulated with QEMU (virtual machine emulator), so we’re going to need this programs/files:
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:
 
<code>-net nic,model=rtl8139 -net user</code>
 
It should work fine. So the whole run command looks like this:
 
<code>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</code>
 
Where
 
-L .
: BIOS, VGA BIOS and keymaps in current directory. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dL-93</ref>
-m 128
: Virtual RAM size to megs megabytes. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dm-21</ref>
-fda /path/to/kolibri.img
: Floppy disk image. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dfda-31</ref>
-boot a
: Boot floppy first. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dboot-20</ref>
-hda /path/to/c100.img
-hdb /path/to/c100_2.img
: Hard disk image. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dhda-33</ref>
-localtime
: Set virtual machine time to host machine time
-vga vmware
: Emulating vga card. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dvga-60</ref>
-net nic,model=rtl8139 -net user
: Net settings. ne2k_pci, RTL8139, i8255x, i8254x and Pcnet are all supported. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dnet-70</ref>
-soundhw ac97
: Emulating sound hardware. <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#index-g_t_002dsoundhw-26</ref>
-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.) <ref>QEMU man page http://qemu.weilnetz.de/qemu-doc.html#usb_005fdevices</ref>
 
'''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:
 
<code>touch hda.img
 
dd if=/dev/zero of=hda.img count=<size in KB> bs=1k</code>
 
Replace <size in KB> with the size of the image in KiloBytes, e.g. 102400 for a 100MB image.
 
<code>mkfs.msdos hda.img</code>
 
Now list files on the image:
 
<code>mdir -i hda.img</code>
 
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:
 
<code>mcopy -i hda.img hi.txt ::/</code>
 
 
Listing files should reveal that we succeeded:
 
<code>mdir -i hda.img</code>
 
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:
 
<code>-hdc /path/to/hda.img</code>
 
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.
 
 
TROUBLESHOOTING:
 
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:
 
* Qemu Manager – download it from [http://www.davereyn.co.uk www.davereyn.co.uk] or [http://qemu-manager.software.informer.com/download/ http://qemu-manager.software.informer.com/download/]


* Qemu Manager – download it from [http://www.davereyn.co.uk www.davereyn.co.uk]
* KolibriOS floppy disk image – [http://www.kolibrios.org www.kolibrios.org]
* KolibriOS floppy disk image – [http://www.kolibrios.org www.kolibrios.org]


Line 50: Line 166:
[[Image:Img00013.gif|Img00013.gif]]
[[Image:Img00013.gif|Img00013.gif]]


And Save it – next click on to Launch the Emulated Virtual Machine – Next configure the boot options to whatever you want, just test it, because not all of the combinations work, so I’m using here a 640x480 standard mode
Now just click Play, and let it fly!
 
[[Image:Img00014.gif|Img00014.gif]]
 
Hit enter, it will ask you to save settings (it is saved in the floppy image)
and now we’re running Kolibri
 
[[Image:Img00015.gif|Img00015.gif]]
 
Part II: Setup Network for Internet Connection
 
Now that we’re on KolibriOS we’re going to setup for Internet:
 
– Click on Menu->Network->Configuration
 
[[Image:Img00016.gif|Img00016.gif]]
 
Next Configure using the following info:
 
– Check “Packet Driver”
 
– Check “Fixed” and the IP details are:
 
Fixed: 10.0..2.15 (our machine IP)
Gateway: 10.0.2.2 (qemu’s gateway)
Subnet: 255.255.255.0
DNS IP: 10.0.2.3
 
[[Image:Img00017.gif|Img00017.gif]]
 
Apply it and we’re connected, the only thing left is to test it on a Web Client
 
Click on MENU -> Network -> Clients -> Simply Browser
 
[[Image:Img00018.gif|Img00018.gif]]
 
Finally click on the button that points the pink arrow, then put any URL you want to surf and hit enter
 
I put www.kolibrios.org
 
[[Image:Img00019.gif|Img00019.gif]]
 
Now we see an Apache Installation website…
 
 
THX 4 UR Time, C U Smile


Howto written by Vhanla, converted to the wiki by Hidnplayr
==References==
<references/>


[[Category:Manuals]]
[[Category:Manuals]]

Latest revision as of 17:35, 29 May 2018

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

Where

-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]

-localtime

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.


TROUBLESHOOTING:

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.

Img00001.gif

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

Img00003.gif

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

Img00004.gif

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

Img00005.gif

In the next window don’t modify anything:

Img00006.gif

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

Img00007.gif

It will show you the following window:

Img00008.gif

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

Img00010.gif

Then select the appropiate floppy image

Img00011.gif

It will warn you but just click YES to continue:

Img00012.gif

Next select “Boot from floppy disk”

Img00013.gif

Now just click Play, and let it fly!

References