CONTENTS -quick start -how to get started -virtual monitor mode -virtual hard drive
qemu-img create newimagename.img 512M
qemu -L . -fda tomsrtbt-2.0.103.ElTorito.288.img -hda tomsrtbt.img -boot a qemu -L . -cdrom linuximage.iso -hda newimagename.img -boot d -kernel-kqemu -m 512 -usb -localtime
Ctrl-Alt-2 //qemu monitor mode stop Ctrl-Alt-1 //qemu virtual image type stuff - nothing shows up Ctrl-Alt-2 c //continue command in qemu monitor mode Ctrl-Alt-1 All the text shows up at once (session resumed) Ctrl-Alt-2 commit all help system_reset quit
HOW TO GET STARTED WITH QEMU
QEMU is possibly the easiest way to start using virtual images and linux.
(It was created with the very profound intentions of testing distributions, debugging linux kernels' or embedded programs, and all sorts of really complex stuff. Fortunately, it's also lots of fun to play with.)
QEMU uses a large file rather than a real partition to run the guest perating system. Thus it's very easy to create multiple guest systems on the same machine.
QEMU is another amazing piece of work of Fabrice Bellard. (See tiny c compiler, tcc) http://bellard.org
The basic files you will need are: qemu-0.9.0-windows an image (.iso) file that is for a linux distro (e.g. Damn Small Linux)
download qemu, kqemu, windows binary ports http://www.h7.dion.ne.jp/~qemu-win/ They are quite easy to install... (kqemu.msi & just unzip qemu into a folder)
You will most likely want to also download kqemu (the windows install), the accelerator that speeds up the virtual image (it runs incredibly fast with it).
To install QEMU on linux use apt-get or any one of the other package managers.
apt-get -u install qemu
There is quite a bit of documentation on the qemu page (including a wiki) but it sometimes gets to be too technical, too many command line options, and not enough step by step instructions... so...
After unzipping the files in a folder (anywhere, but perhaps easiest is c:\qemu) put the .iso linux image in the folder. (NOTE: install kqemu before running qemu)
Open up a command prompt (Start->run->cmd)
Browse to the qemu folder (e.g. cd c:\qem* ) - windows xp will actually fill in the rest (you don't have to type qemu-0.9.0-windows, (typing tab in cmd prompt will autocomplete)
To get your first taste of qemu use the default linux image that comes with QEMU by typing: qemu -L . -hda linux.img
This is basically saying, qemu.exe load the bios.bin from the current directory and run the virtual file linux.img on the virtual device /hda (the first hard drive in our virtual world, there is actually a default parameter of -m 128 which means that this virtual image believes it is running with 128 megabytes of RAM)
(If you don't use the "-L . " it will try looking the c:\program files folder for the bios.bin, but this way is more portable... remember, this windows version was kindly compiled for us from source code, so I guess if you want you can download the source and recompile it.)
You will get to watch the virtual linux load in a nice virtual window and end in the very unfriendly linux prompt: sh-2.05b#
if you type "ls" and hit enter (return key) you will see a listing of files in this virtual image (not much to look at).
(Outside of QEMU running you might notice in your "real" windows operating system that a QEMU window has appeared on the bottom of your taskbar with your other favorite programs: windows explorer, firefox, winamp, etc. QEMU runs just like a normal windows program, and can be closed/killed with a right click or task manager, although this may have messy consequences for your virtual world)
More important and more interesting, when inside of the virtual image program (where you can see the sh-2.05b# prompt), try pressing Ctrl-Alt-2 (yes, hold all the keys all at once) Note that pressing Ctrl-Alt together (without the two) will allow you to connect your mouse to the virtual mouse - or to disconnect and go back to your normal windows session.
You should see: QEMU 0.9.0 monitor - type 'help' for more information (qemu)
This is the virtual monitor, not to be confused with virtual managers, football managers, or hall monitors. Basically this allows you to control your virtual images (stop and freeze them, save a snapshot of their current state, and most importantly, quit nicely).
If you type 'help' (I dare you) you will be overloaded with text commands.
Instead, type 'stop' (and press enter) Then press Ctrl-Alt-1 and you will return back to your very interesting sh-2.05b# prompt. Type in anything you want, nothing will show up because your virtual session is paused. By returning to the monitor mode (Ctrl-Alt-2) you can then type, 'c' to continue your session, and use (Ctrl-Alt-1) and you will see all the random text has appeared.
In Monitor mode (Ctrl-Alt-2) type 'commit all' which will save your changes to your qemu image (otherwise it will probably discard them).
Then type 'quit' Your virtual window (qemu program) will close (this is like pulling the power on your virtual world, make sure that you haven't left it in a stable state (at a blank prompt)).
For more interesting things, first we must prepare a blank virtual image (don't worry about the size too much, they can grow).
qemu-img create newimagename.img 512M
makes a new qemu image file with size 512 Megabytes (without the M it will default to 512 KB)
Now use somebody else's nice linux iso image (usually for burning cd's) and our new virtual HD.
(I highly recommend DamnSmallLinux as it is based on knoppix (great hardware detection)).
qemu -L . -cdrom linuximage.iso -hda newimagename.img -boot d
run the qemu.exe program with the bios.bin file from the current directory with a virtual cd rom drive with the virtual cd containing the content of the .iso file (/dev/cdrom), a virtual hard drive hda from the newimagename.img, and we will have the "virtual computer" boot from our virtual cdrom, (a = floppy, c = hda, d = cdrom, n = network).
You will then (hopefully) see the boot screen of your linux cd (.iso) Choose a smaller screen size (fb800x600) than what you're currently using in windows because it will fill up the screen (can be difficult to multi task).
An alternative method is to use the toms root boot floppy image...
qemu -L . -fda tomsrtbt-2.0.103.ElTorito.288.img -hda tomsrtbt.img -boot a
note that here we are using new parameters -fda = floppy drive, -boot a = boot from a:
To try improved performance make sure you've install kqemu from the windows installer.
qemu -kernel-kqemu -L . -cdrom dsl-4.4.6.iso -boot d -m 512 -usb
-kernel-kqemu (use the most integrated kqemu accelerations - slightly unstable) -usb (access to the real usb drives) -m 512 (the virtual image believes it has 512 megabytes of ram)
Now you can create a virtual image & use a live cd iso to install Linux, all while running Windows! =)
See further tutorials for QEMU with network access or installing linux from a livecd.
NOTES: if you are doing a large file copy or other RAM intensive program you find qemu doesn't respond... :(
you may have to rename a linux.iso image to remove some of the excess .'s, e.g. linux.0.2.3.iso could be changed to linux-0-2-3.iso
you may have to boot your linux image in a smaller video mode: e.g. fb800x600
you may have to research the boot options for your given live cd installation (e.g. dsl 2 vga=789)