wiki:Developer/Simulators/QEMU
Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

Version 4 (modified by ChrisJohns, on 09/25/06 at 03:28:34) (diff)

Update the floppy script and add the rtems-grub.cfg example.

QEMU

You can run RTEMS in the open source processor emulator QEMU. The QEMU emulator runs on a number of hosts including Linux and Windows. It also supports a number of processors.

QEMU PC Emulator

The RTEMS PC BSP runs in the QEMU emulator.

Making a Boot Floppy Disk

We RTEMS in QEMU by first booting from a floppy disk image. You can use the image we have made by downloading it from the RTEMS ftp server. The following instructions built the image and were run on a Fedora Core 5 Linux host.

Download the latest release of version 2 the Grub boot loader from ftp://alpha.gnu.org/gnu/grub/. Build the package with the following configure command:

$ ../grub-1.94/configure --prefix=/tmp/g2/build $ make all install

where the prefix can be anything suitable for your machine. If configure fails with a missing LZO library check you have the lzo-devel package installed.

To make the floppy image follow the instructions in the Grub Wiki at http://grub.enbug.org/TestingOnX86. This script is adapted from the instructions:

#! /bin/sh -x grub=/tmp/g2/build workspace=/tmp/g2 mnt=$workspace/mnt/loop file=$workspace/rtems-boot.img export PATH=$grub/bin:$grub/sbin:$PATH mkdir -p $workspace cd $workspace grub-mkimage -o core.img _chain ls pc multiboot gpt fat boot reboot configfile cat help dd if=/dev/zero of=$file bs=512 count=2880 /sbin/mkdosfs $file mkdir -p $mnt mount -o loop -t vfat $file $mnt mkdir -p $mnt/boot/grub cp $grub/lib/grub/i386-pc/boot.img core.img $grub/lib/grub/i386-pc/*.mod $mnt/boot/grub cat "configfile (hd0,0)/rtems-grub.cfg" > $mnt/boot/grub/grub.cfg echo '(fd0)' $file > tmp_device.map grub-setup -d $mnt/boot/grub -r '(fd0)' -m tmp_device.map '(fd0)' rm -f tmp_device.map umount $mnt

The default grub.cfg file will attempt to read a GRUB configuration file called rtems-grub.cfg from the root directory of the harddisk. This lets you create a specific GRUB configuration for you testing without needing to rebuild the floppy image. An example configuration that lets you run the RTEMS Samples is:

# RTEMS Grub configuration for the Samples

set default=0

menuentry "RTEMS - Hello" {

set root=(hd0,0) multiboot (hd0,0)/hello/hello.exe

}

menuentry "RTEMS - Ticker" {

set root=(hd0,0) multiboot (hd0,0)/ticker/ticker.exe

}

menuentry "RTEMS - Minimum" {

set root=(hd0,0) multiboot (hd0,0)/minimum/minimum.exe

}

menuentry "RTEMS - Paranoia" {

set root=(hd0,0) multiboot (hd0,0)/paranoia/paranoia.exe

}

menuentry "RTEMS - File IO" {

set root=(hd0,0) multiboot (hd0,0)/fileio/fileio.exe

}

menuentry "RTEMS - Unlimited" {

set root=(hd0,0) multiboot (hd0,0)/unlimited/unlimited.exe

}

menuentry "RTEMS - Loopback" {

set root=(hd0,0) multiboot (hd0,0)/loopback/loopback.exe

}

menuentry "RTEMS - PPPD" {

set root=(hd0,0) multiboot (hd0,0)/pppd/pppd.exe

}

menuentry "RTEMS - Base Mulitprocessor" {

set root=(hd0,0) multiboot (hd0,0)/base_mp/base_mp.exe

}

menuentry "RTEMS - Base Single Processor" {

set root=(hd0,0) multiboot (hd0,0)/base_sp/base_sp.exe

}

menuentry "RTEMS - C++ Static Constructors" {

set root=(hd0,0) multiboot (hd0,0)/cdtest/cdtest.exe

}

menuentry "RTEMS - C++ IO Streams" {

set root=(hd0,0) multiboot (hd0,0)/iostream/iostream.exe

}