RS232 book cover

Centrum Outlook Express Centrum Outlook Express

OE PowerTool 4.5.5

Twój adres IP to:
Przeglądarka: CCBot/2.0 (

Custom Linux from scratch on an example of OBDH

Following article describes creating simple Linux "distribution" designed for on-board computer (OBDH) for ESEO student satellite.

   Software part of OBDH was intended to be as small and simple as possible but reliable so we decided to create own Linux microdistribution. Because developed software takes advantage of RTAI realtime libraries it was necessary to use kernel with Adeos patch. We chose following pair: kernel 2.6.9 and Adeos r9c3. RTAI version is 3.1. In order to create our distribution we made following steps:
1. Creating and formatting Linux partition. We chose ext2 filesystem. One can use arbitrary partitioning tool, eg. fdisk or some graphical one.
2. Creating directories structure (/sbin, /boot, /etc, /bin, /usr) and special directory /dev using package from Slackware distribution.
3. Downloading and extracting kernel 2.6.9.
4. Applying Adeos r9c3 patch for kernel sources.
5. Configuring kernel which means removing unnecessary parts such as support for networking, sound or USB.
6. Compilation of kernel and placing it on target disk in /boot directory. We named this file simply kernel.
7. Installing and compiling RTAI libraries and modules. To achieve better reliability we wanted our programs to be compilled statically and this needs static libraries. To get them one has to configure RTAI by running ./configure with parameter --enable-static=yes (and then make and make install as usually). After installation RTAI modules should be copied to target disk into the same directory (/usr/realtime/modules/)
8. Installing bootloader. In /etc (target disk) we placed lilo.conf and lilo's fiels in /boot. By giving -r parameter for lilo and mounting point of target partition we caused lilo to chroot into this partition and install lilo. In our case it was:

lilo -r /mount/second/

Sample lilo.conf file:

boot = /dev/hdc
timeout = 50
vga = normal
install = /boot/boot.1640
map = /boot/map
root = /dev/hda1
default = Linux
image = /boot/kernel
	label = Linux

In first two lines we can see /dev/hdc because target disk was connected to second IDE controller as master. During booting of Linux disk will be connected to the first controller so /dev/hda1 is given as root. Moreover bios=0x80 line was necessary.
8. Now we can run our Linux. Booting should end up with Kernel because of lack of init.
10. Writing own init. Init used in OBDH is very simple. First of all using fork() and execlp() functions insmod is run which loads RTAI modules to kernel. Then init opens /etc/init.conf file and read list of programs to be run and runs them. A the end it falls into infinite loop because ending init process would case Kernel panic. init must be compiled statically and be placed in /sbin.
11. During static compilation one has to remember to put compiled file before linked libraries, eg.:

gcc -o test test.c -I/usr/realtime/include -L/usr/realtime/lib -static -lpthread -llxrt