wiki:Developer/VirtualMachines/VirtualBox

Version 3 (modified by Cdcs, on Jun 10, 2010 at 1:18:59 AM) (diff)

RTEMS on Virtualbox

You can run RTEMS in the VirtualBox x86 virtualizer.

The main advantage of VirtualBox over other virtualizers is that it provides several board/controller emulation options, including a SATA controller and several network adapters.= Introduction =

This page describes how to setup a “one click solution” for booting RTEMS in VirtualBox; if the RTEMS application gets updated is just a matter of rebooting the virtual machine to boot the new updated application.

A solution for debugging RTEMS remotely through VirtualBox serial port is also described. = What we will need? =

  • VirtualBox
  • Etherboot
  • Opentftp
  • Socat relay= Get Virtual Box =

The first step is to get and install VirtualBox.

You can get Virtual box from here; you can download the file suited for your Linux distribution or setup the VirtualBox repository.

The pre-requirements for this installation are:

  • Qt 4.4.0 or higher;
  • SDL 1.2.7 or higher (this graphics library is typically called libsdl or similar)
  • DKMS

They should be already installed, if not install them from your distro’s repository:

yum install qt
yum install SDL
yum install dkms

Assuming that you added the VirtualBox repository you only have to issue:

yum install VirtualBox

VirtualBox installations can become quite tricky because a kernel module needs to be installed, so please refer to the VirtualBox documentation if you have any problem.

Get opentftp

Opentftp is a tftp(Trivial File Transfer Protocol) server that will enable us to boot a file from the host computer(the RTEMS application) on the virtual machine.

You can get opentftp from here. The opentftp server comes already compiled, so you only need to run it. The README explains various options for the server, including how to run it as a linux service.

We need to change the directory that is mapped in the server to the directory where our rtems applications is( In my case /home/cdcs/testbed-build/). You can do this be opening the opentftp.ini file that stores the server options. In this file find the "[HOME]" marker and place there the path to your application. This is how my file looked:

[HOME]
#You should specify home directory(s) here
#The home directory can be specified
#in two different ways, with alias or 
#bare names without aliases. Using alias you
#can specify upto 8 directories like
#routers=c:/RouterImages/Images
#without aliases, only one directory can
#be specified, which will become root
#directory for tftp.
#mixup of bare names and aliases not allowed
#default will be home directory of user
/home/cdcs/testbed-build/

This option will map the root of the server to "/home/cdcs/testbed-build/". This means that when you access "tftp://127.0.0.1/test.exe" you are accessing "/home/cdcs/testbed-build/test.exe". You can also specify up to 8 aliases, eg: "myhome=/home/cdcs" will map "tftp://127.0.0.1/myhome/test.exe" to "/home/cdcs/test.exe".

You also need to change the "username=" option in "[TFTP-OPTIONS]" to your username. eg:"username=cdcs"

Once you have made these changes you are ready to run the server:

./opentftp -v -i opentftp.ini

For me this command produces the following output:

[root@cdcs opentftp]# ./opentftpd -v -i opentftpd.ini 
TFTP Server MultiThreaded Version 1.62 Unix Built 1621

starting TFTP...
username: cdcs
alias / is mapped to /home/cdcs/testbed-build/
permitted clients: all
server port range: all
max blksize: 65464
default blksize: 512
default timeout: 3
file read allowed: Yes
file create allowed: No
file overwrite allowed: No
thread pool size: 1
listening on: 0.0.0.0:69