You are on page 1of 6

ESA UNCLASSIFIED Releasable to the Public

estec
European Space Research and Technology Centre Keplerlaan 1 2201 AZ Noordwijk The Netherlands T +31 (0)71 565 6565 F +31 (0)71 565 6040 www.esa.int

Date From To

25/11/2010 Julien Delange

Ref Visa Copy

Subject: Installation of RTEMS 4.8 serie and QEMU under Ubuntu

DESCRIPTION

This document provides information for the installation of RTEMS 4.8 with the PC386 BSP and QEMU under Ubuntu Linux. This will allow the user to execute RTEMS applications on top of QEMU.

INSTALLATION PROCEDURE DOCUMENTATION

The reference documentation can be found on the RTEMS official website. For the 4.8 release serie, the link is the following: http://rtems.com/onlinedocs/releases/rtemsdocs-4.8.0

VIRTUAL MACHINE INSTALLATION

The tools can also be used within a virtual machine provided with this document. This virtual machine is a VMWare image that can be run with VMWare Player. The user account is rtems, password is rtems.

INSTALLED COMPONENTS, VERSIONS AND CONFIGURATION

Page 1/6

ESA UNCLASSIFIED Releasable to the Public

4.1

Components and versions


Ubuntu: 10.10 (maverick) QEMU: 0.12.5 RTEMS: 4.8.2 GCC: 4.2.4 GDB: 6.8 Newlib: 1.15 Binutils: 2.18

4.2 Configuration
Target: i386-rtems RTEMS BSP: pc386

5 5.1

INSTALLATION PROCEDURE Install dependencies

Issue the following command:

apt-get install qemu cvs patch texinfo libc6-dev gcc4.3 gcc-4.1 libgmp3-dev libmpfr-dev automake autoconf

5.2
5.2.1

Download software packages


Binutils

cd build && wget http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.gz

5.2.2

GDB

cd build && wget http://ftp.gnu.org/gnu/gdb/gdb6.8.tar.gz

Page 2/6 Date 25/11/2010 Ref

ESA UNCLASSIFIED Releasable to the Public

5.2.3

GCC

cd build && wget http://ftp.gnu.org/gnu/gcc/gcc-4.2.4/gcccore-4.2.4.tar.bz2

5.2.4

NEWLIB

cd build && wget ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz

5.2.5

Mirrors

If you encounter some issues while downloading the sources, copies are available at http://rtems.com/ftp/pub/rtems/SOURCES

5.3

Download RTEMS from the CVS server

cd build && cvs -d :pserver:anoncvs@www.rtems.com:/usr1/CVS -z 9 co -rrtems-4-8-branch rtems

5.4 Download RTEMS from FTP server


5.4.1 Download RTEMS release

The RTEMS release can be found at http://rtems.com/ftp. You can download it using the following command. cd build && http://www.rtems.com/ftp/pub/rtems/4.8.2/rtems4.8.2.tar.bz2

5.4.2

Download patches

Patches can be found using a web browser at http://www.rtems.com/cvsweb They are contained in the directory rtems/contrib/crossrpms/patches directory for the 4-8-branch of RTEMS.

5.5

Unpack cross-compiler archives


cd build && tar zxvf binutils-2.18.tar.gz tar zxvf gdb-6.8.tar.gz

Page 3/6 Date 25/11/2010 Ref

ESA UNCLASSIFIED Releasable to the Public

tar jxvf gcc-core-4.2.4.tar.bz2 tar zxvf newlib-1.15.0.tar.gz

5.6

Apply patches

We assume that patches are contained in the /home/rtems/build/patches directory. They can be found on the CVS repository, in the directory rtems/contrib/crossrpms/patches for the branch 4-8-branch.

5.6.1

Binutils

cd binutils-2.18 && patch p1 < ../patches/binutils2.18-rtems4.8-20071104.diff

5.6.2

GCC

cd gcc-4.2.4 && patch p1 < ../patches/gcc-core-4.2.4rtems4.8-20080526.diff

5.6.3

Newlib

cd newlib && patch p1 < ../patches/newlib-1.15.0rtems4.8-20080903.diff

5.6.4

GDB

cd gdb-6.8 && patch p1 < ../patches/gdb-6.8-rtems4.820080429.diff

5.7
5.7.1

Configure and build the toolchain


Configure and build binutils

cd build && mkdir b-binutils && cd b-binutils && CC=gcc-4.1 ../binutils-2.18/configure target=i386rtems4.8 prefix=/home/rtems/local

5.7.2

Configure and build GCC

cd build && cd gcc-4.2.4 && ln s ../newlib1.15.0/newlib . && cd .. && mkdir b-gcc && cd b-gcc && PATH=/home/rtems/local/bin:$PATH ../gcc-4.2.4/configure target=i386-rtems4.8 prefix=/home/rtems/local withgnu-as with-gnu-ld with-newlib verbose enablethreads enable-languages=c
Page 4/6 Date 25/11/2010 Ref

ESA UNCLASSIFIED Releasable to the Public

5.7.3

Configure and build GDB

cd build && mkdir b-gdb && cd b-gdb && PATH=/home/rtems/local/bin:$PATH ../gdb-6.8/configure target=i386-rtems4.8 prefix=/home/rtems/local

5.8 Configure and build RTEMS


If you download RTEMS from the CVS repository, you may need to generate the configure script with the autotools. In that case, invoke the following command cd build && cd rtems-4.8.2 && ./bootstrap Then, invoke the configure script and the compiler chain: cd build && mkdir b-rtems && cd b-rtems && PATH=/home/rtems/local/bin:$PATH ../rtems4.8.2/configure target=i386-rtems4.8 enable-posix enable-networking prefix=/home/rtems/local/packages/rtems4.8 enabletests && PATH=/home/rtems/local/bin:$PATH make all install RTEMS_BSP=pc386

RUN RTEMS TESTS

At first, you have to set the RTEMS_MAKEFILE_PATH variable to the directory that corresponds to your RTEMS BSP. You can do that with the following command line:

set RTEMS_MAKEFILE_PATH=/home/rtems/local/packages/rtems4.8 /i386-rtems4.8/pc386/

Then, download the testsuite on http://www.rtems.com/ftp/pub/rtems/4.8.2/examples-4.8.2.tar.bz2 and unpack the archive.

cd && mkdir examples && cd examples && wget http://www.rtems.com/ftp/pub/rtems/4.8.2/examples-4.8.2.tar.bz2 && tar jxvf examples-4.8.2.tar.bz2 Then, build and run the hello_world_c example
Page 5/6 Date 25/11/2010 Ref

ESA UNCLASSIFIED Releasable to the Public

cd && cd examples/examples-4.8/hello_world_c/ && make && cd o-optimize && qemu fda /home/rtems/rtemsboot.img hda fat:. boot a Then, once in QEMU, type the following lines in grub set root=(hd0,0) multiboot (hd0,0)/hello.exe boot

When you build the example, it creates the binary in the o-optimize directory. Then, to run it with QEMU, you need a bootloader. This is provided by the rtemsboot.img image file (available at http://www.rtems.com/ftp/pub/rtems/qemu/i386-pc/ ). Then, when you start GRUB, you need to tell it to use this file as a boot image. This is done with the fda option (which indicates the image for a floppy disk) and the boot a option (that indicates you boot on the floppy disk). Then, the had fat:. option is used to specify that the current directory is used as an harddrive. Once you are in grub, you have to tell grub that the root device is the harddrive. This is done with the set root=(hd0,0) command. Finally, you need to load the binary, indicating its location on the system. Here, the binary is on the harddrive considered by GRUB, so, (hd0,0). You load RTEMS application with the multiboot command, so, you use the following command to launch the hello.exe binary: multiboot (hd0,0)/hello.exe . Finally, you start the system using the command boot.

Page 6/6 Date 25/11/2010 Ref

You might also like