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 to get RTEMS running on QEMU and also how to make use of the RTEMS FAT filesystem (in order to get the trace file on your host filesystem). This tutorial assumes that you have successfully built RTEMS on your computer.
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.
2. 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.
3. 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
4. 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
5. 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:
6. Create a disk image of 20 MBytes and create a MS-DOS FAT16 file system on it:
dd if=/dev/zero of=hdd.img bs=1024 count=20160 mkdosfs -F 16 hdd.img
7. Open your ~/.mtoolsrc file and add the following information:
drive c: file="path_to_hdd.img"
You should now be able to access the hard disk image that you have created, using mtools. For example, typing mdir c: should list all the files on your hard disk image.
8. Now start QEMU using the following command (use the disk image created):
qemu -serial stdio -boot a -m 128 -fda 'path to floppy.img' -hda 'path to the hdd.img' --no-reboot
The list of the QEMU options used in this command it's explained here.
9. In order to get the trace file on your computer (to decode it) you must configure your application to use RTEMS DOS filesystem and also the RTEMS Shell. You can find here all the information needed on how to make your application use the RTEMS DOS file system. To make use of the RTEMS Shell TBD