Real Time Systems

RTLinux Installation Notes

($Revision: 1.1 $)
 

Introduction

These notes are a replacement for the "Open RTLinux Installation Instructions" distributed by FSM Labs, Inc., tailored to fit the particular software and hardware configurations we will be using this course. Some of this work may already have been done for you on the systems in the lab, but you may need to do it over from scratch if the installed RTLinux kernel has been clobbered.

The notes are a compromise between completeness and accessibility. I've tried to keep them fairly short to allow you to get through them quickly, but that means I have to assume you are either using one of our lab machines (whicha have already been partially set up) or you know enough about general Linux installation and system administration to have previously set up your own machine with "vanilla" Linux. If you are using your own machine, to avoid surprises you should start with the same distribution we are using in the lab, i.e., Red Hat 9.0.

In short, the steps you need to follow to install RTLinux are:

  1. Get the archived source files and extract the source directory trees into a working directory of your own.
  2. Patch the Linux kernel with the patches needed for RTLinux, then configure, compile, install, and test it.
  3. Configure the RTLinux modules, then compile, install, and test them.

These steps are explained in more detail below.


1. Extract the Source Files

The source file versions you should use are

There may be copies already on the machine assigned to you in the lab, in directory /usr/src. Otherwise, If not, you can copy them from one of the CDs that will be provided in the lab. If you can't find one of the CDs, or are working from home, download the files from the course Website. For the purpose of the following explanation, we will assume the files are in the directory /usr/src.

Some of these steps, including specifically those involved in installing the kernel and kernel modules, require that you be operating with "root" privilege. However, it is generally a good idea to do the rest of the steps using an ordinary userid and then "su" to root to do just the few steps that require root privilege. This is especially important when you are working on a computer in the teaching lab, which may also be used by other members of the class, because when you are operating as root you run the risk of clobbering another person's files.

Extract the source files into a directory you have created for that purpose. Use bunzip and tar. This can be combined into one step using the "j" option with Gnu tar. For example:

cd /home/developer
tar xjf /src/rtlinux-3[1].2-pre2.tar.bz2
ln -s rtlinux-3.2-pre2 rtlinux
cd rtlinux
tar xjf /usr/src/linux-2.4.20.tar.bz2
ln -s linux-2.4.20 linux

In the above example we put a copy of the Linux kernel sources into the rtlinux directory. We make our own copy because we will be patching (changing the source code) to fit RTLinux. It does not need to be in that location, but in any case we do need to create a symbolic link named "rtlinux" to the kernel source directory because that is the RTLinux Makefile expects.


Patch the Kernel

RTLinux consists of a set of kernel modules, along with some patches to body of the Linux kernel. The patches are located in the directory rtlinux/patches. There are different patch sets for different Linux kernel versions. Apply the patch set that matches your kernel version, using the patch utility. For example:

cd linux
patch -p1 < ../patches/kernel_patch-2.4.20-rtl3.2-pre2

(That's a digit one, not a lower-case L in the option "-p1".)

There should be no warnings or error messages if you have compatible kernel and patch file versions.


Configure the Kernel

Warning: If you are sharing a machine with another person, you should edit the file Makefile in the linux directory, and change the defintion of EXTRAVERSION from "rtl3.2-pre2" to a string that is unlikely to be used by any of the other users of that machine.

The Linux kernel has many compilation parameters, which can be configured using one of three methods:

If you are reconfiguring and recompiling using an existing source directory tree (that you used before to compile a different configuration) you should do "make mrproper" to clean up the directory before configuring. On a freshly untarred source tree you should not need this step, but it will not hurt.

make mrproper
make menuconfig

The "make menuconfig" step will show you a set of menus from which you must choose the options you want in your kernel. There are far too many configuration options to explain here. In short, you should turn off any items you don't need, and turn on the items you do need, for your specific hardware configuration and expected system use.

The only advice on configuration from the RTLinux developers is:

Enabling APM support is not recommended. APM BIOS calls may have unpredictable effect on real-time performance.

Please make sure to specify the correct CPU type for the target machine.

Try to keep your kernel small, by choosing only those options you absolutely need and by using modules (menuconfig option "M", not "*") for anything you will not always be using. A large kernel will take more physical memory and so generally will have poorer performance than a small kernel.

If your machine is the slave in one of the master-slave kernel debugging pairs in the lab it is important to select the option to support a serial device as console, under the char devices menu options.

You can save a set of configurations in a named file, and then reload it. I have such a saved onfiguration file that works for the type of machine in the lab for this course. The configuration I used to produce the kernel in the tarfile rtl.tbz that I provided to the class is in the file /home/developer/tpbconfig. If you load this you can save time, and skip the next few paragraphs. Otherwise, read on.

The kernel will come in a default configuration, determined by the people who put together the Red Hat 9.0 Linux distribution. It will include support for nearly everything, since it is intended for general use. For use in this course, you want a different kernel configuration. You will use "make menuconfig" )or "make xconfig") to choose that configuration. It will present you with a series of menus, from which you will choose the options you want to include. For most options you have three choices: (blank) leave it out; (M) compile it as a module, which will only be loaded if the feature is needed; (*) compile it into monolithically into the kernel, so it will always be there from the time the kernel first loads.

There are several things you want to accomplish with your reconfiguration: