wiki:TBR/UserManual/QemuTutorial

Version 9 (modified by Cocanlucian, on Aug 14, 2009 at 5:17:22 PM) (diff)

QemuTutorial

In order to be able to run RTEMS you need an execution environment. The easieast way is to use QEMU and mtools to emulate a PC. This is a tutorial showing how I got RTEMS running on QEMU. This tutorial assumes that you have successfully built RTEMS on your computer. TODO Add a tutorial on how to start with RTEMS too. It would be great to have all this information in one place.

  1. Clearly, QEMU needs to be installed on your computer.

sudo yum install qemu - for Fedora users sudo apt-get install qemu - for Ubuntu users

You can always install QEMU using the latest sources.

  1. Also, you will need mtools, which is a collection of utilities to access MS-DOS disks from Unix without mounting them.

sudo yum install mtools - for Fedora users sudo apt-get install mtools- for Ubuntu users

You can always install mtools using the latest sources.

  1. Now we need a floppy disk image that has GRUB on it.

cd ~/where_you_want wget http://www.thoughtwave.com/floppy.img.bz2 bunzip2 floppy.img.bz2

  1. Before you can access this image file you must create a mtools configuration file. Create and then open ~/.mtoolsrc with your favourite editor and add the following information:

drive a: file=path_to_the_floppy_image_file fat_bits=12 cylinders=80 heads=2 sectors=18 mformat_only

Now you should be able to see the following information if you type mdir a:

Volume in drive A has no label Directory for A:/ kernel gz 670491 2009-08-14 13:59 kernel.gz stage2 30816 1998-05-13 11:56 stage2 grubmenu 45 2006-05-31 8:19 grubmenu

3 files 701 352 bytes

755 200 bytes free

  1. This GRUB disk image is designed to boot any compressed kernel in the root directory called kernel.gz, meaning that to install hello.exe, you simply compress it and copy it into your virtual disk image.

cd ~/where_you_want cat hello.exe | gzip -9 > kernel.gz mcopy kernel.gz a:

  1. Create a disk image (20 MBytes):

dd if=/dev/zero of=hdd.img bs=512 count=20160

  1. Now start QEMU using the following command:

Use a disk image as an HDD:

qemu -serial stdio -boot a -m 128 -fda 'path to floppy.img' -hda 'path to the hdd.img' --no-reboot

Use a d