Setting up RTEMS on Mac OS X [updated]

For a potential Google Summer of Code project, I’ll be working on porting the Parrot VM to RTEMS. Though the steps are well documented on the RTEMS wiki, I’ll follow up with my own step-by-step instructions.

I’m running Mac OS X 10.6.3 on a Mac Book Pro with a 2.4 GHz Intel Core 2 Duo processor and 2 GB of RAM.  While doing development work with Ruby on Rails, I’ll have an instance of postgres, nginx, debug consoles, MacVIM, Open Office, Google Chrome, and Safari all open at once. I really need to upgrade to 4GB soon, which, according to crucial.com will only set me back about $100.  The whole point of this rant is to ensure that you have a beefy machine because virtualization and compiling can really tax a system.

Most of this information will come directly from the page “Virtual Machines for RTEMS Development” with only a few modifications or clarifications.

1. Grab a copy of virtual box.

Virtual Box is Sun’s GPL’d virtualization software which allows you to “boot” another operating system (like Windows or Ubuntu) as an application within your OS.  Running another OS simultaneously on your computer is useful for testing and developing software that needs to target multiple platforms. Parallels and VMWare are also excellent choices for virutalization.

The download is a standard DMG file which you must double-click to mount.  Follow the instructions on the installer; total time for me was less than 5 minutes.

2. Grab a copy of the RTEMS development image.

What we could do is use Virtual Box to setup a new guest OS from scratch and then download the components that we need, setup the paths, and then build all the tools.  Instead, the RTEMS people have provided a development image – a snapshot of a system already configured.  At the time of this writing, the latest image was a Fedora Core 12 system updated March 12th, 2010.

Note that the image is distributed over BitTorrent, and if you don’t have a BitTorrent client I recommend you pick up Transmission.  The image is a hefty 2.5 GB and when I downloaded it there was only one person seeding the file, capped at around 70-80 kbps and the download took several hours.  If you require to download this file anytime soon, please comment on this post and I’ll begin seeding the file as well.

At some point in the future when I have free time, I’ll install from scratch on CentOS and document it (either with screenshots or perhaps with a screencast).

Total time: 5+ hours of downloading

3. Create the OS in Virtual Box

Once you have downloaded file, you’ll need to unzip it and move it to some decent location on your computer.  Next, open up Virtual Box and select File -> Import Appliance.  On the first page of the wizard click “Choose” and then navigate to your unzipped directory and select the .ovf file.  Accept the default settings of the wizard and wait while the file is imported.  Note that the progress bar is a bit skittish and for me, started with an estimate of finishing in 18 hours and then suddenly jumping to 30 minutes.

Total time: 20 minutes or so

4. Boot the OS

Once the OS has been imported to your system, boot the OS up.  This part was a bit unnerving for me because I was presented with a black screen for 5 – 10 minutes.  Eventually a three-part progress bar at the bottom of the screen showed up and the GUI began to load.

Total time: ~10 minutes

5. Log in

Sounds simple enough.  Logging in as root is disabled through the window manager so log in as the “rtems” user.  Password is “rtems”.

Total time: <1 minute

6. Bring the system up to date

Open up a new terminal and test if you have an internet connection:

ping www.google.com

Clearly there are better / more scientific ways to test if you have a working internet connection, but this is quick and easy.  You should be receiving pings back from google; if not, there is something wrong with your Virtual Box setup.  If this is working, go ahead and drop down to root:

su

And then update all the packages.  The “yum” command is the package manager that comes with Red Hat flavors.  The “-y” option assumes yes to every prompt.

yum -y update

This command brings all the installed RPMs up to date.  It will ask you for the root password which is “Virtual0” (zero, not a letter).  When I ran it it had to pull down 10+ MB of index files, sat there for a long time without a response (again, making me think my system had died), and then pulled another 100+ MB of updated packages.

Total time: ~20 minutes

7. Update RTEMS repository

Many convient variables are already setup, listed on the wiki page here. Typing

cd $r

will bring you to the root of the RTEMS source tree.

Next, run the command to update the source files

cvs up -Pd 2>&1 | grep -v cvs

I myself have never used CVS – I started with Subversion and moved onto git with this current job – so I couldn’t say off the top of my head what that command is doing.  Looking the man page for cvs (by typing “man cvs”) I find that the -P option prune empty directories – that is it will not download empty folders – and the -d option searches all subdirectories for updates.  While I would have called that “recursive” (and hence would have expected a “-r”), I guess I’m just spoiled with SVN and git.  The 2>&1 redirects standard error to standard output.  The pipe passes all this output onto grep, and the -v option removes any line that contains “cvs”.  All you will see on the terminal is a list of files that are updated.

Total time: 5-15 minutes (I wasn’t really paying attention)

8. Bootstrap

Finally, run the bootstrap command:

./bootstrap

This is a script that will compile all of the source code.  The wiki page warns us that “[t]he bootstrap will probably take 10-15 minutes to execute depending on the speed of your computer.” Having wised up through the process, I ran:

time ./bootstrap

The time command will return the amount of time another command takes to run.  I got this output:

real    19m50.354s
usr     4m27.944s
sys     6m9.864s

I use to know at some point the distinction of user time and system time but now I have forgotten and don’t feel like googling for it at 2:20 a.m. All you need to know is that it took me 19 minutes and about 50 seconds of real time to bootstrap the entire system.

In the next post, I’ll walk through getting a “Hello World” example started.

Posted in Google Summer of Code | Comments Off on Setting up RTEMS on Mac OS X [updated]

Comments are closed.