June 19, 2009

How to create an STAND ALONE RTAI system.

Posted in Embedded Linux, Embedded System, Linux, Open Source, Real Time Linux, RTAI, RTLinux tagged , , , , , , , at 4:19 am by asprakash

Preparing a stand alone RTAI system is an nightmare for RTLinux beginners and little bit difficult job for intermediate people. Objective of this Howto is to reduce your time to prepare stand alone RTAI system successfully. The steps was taken from the documentation RTAI-TARGET-HOWTO.txt prepared by Giampiero Campa.

About RTAI

RTAI – the RealTime Application Interface for Linux – which lets you write applications with strict timing constraints for your favorite operating system. The Real-Time Application Interface is a hard real-time extension to the Linux kernel, contributed in accordance with the Free Software guidelines. It provides the features of an industrial-grade RTOS, seamlessly accessible from the powerful and sophisticated GNU/Linux environment.

To know more about RTAI, please visit www.rtai.org

Install RTAI

Its very easy to install RTAI in your host Linux. I used Ubuntu 8.04 Linux to install RTAI 3.7 version. Refer the document RTAI-TARGET-HOWTO.pdf to install RTAI in Ubuntu.

STEP 1 – Configure and compile a reduced version of your Kernel

This step assumed that, you already downloaded the kernel; Downloaded the RTAI; Unzip the files; And apply the RTAI patch to Linux kernel. Please be ensure that, you have already done the steps from STEP:1 to STEP:4 in the file RTAI-TARGET-HOWTO.TXT.

Now we are again compile the kernel. Coz we need to customize more specific for our target board. The first thing to do is to compile the kernel that fits the target system, as far as processor type, bus and peripherals are concerned.

As root:

$ cd /usr/src/linux

$ make xconfig (or menuconfig or config)

If you want a reduced version of the kernel, e.g. size less than 600K, you have to disable virtually everything except the loadable module support, the IPIPE option, the ISA bus, and the IDE, floppy, ext2, and /proc support. Also, at this point, if you are really working with a floppy disk, and you need an unattended reboot, you should manually edit the file /usr/src/linux/init/do_mounts.c, search for the “press ENTER” string and, a few lines below, change the instruction sys_read(fd, &c, 1); with the instruction sys_read(fd, &c, 0);

Once you have done the above, you have to compile the kernel:

$ make clean

$ make

copy the configuration file for future reference :

$ cp -f .config config-linux.txt

STEP 2 – Recompile RTAI for the new kernel

RTAI needs to be recompiled to take into account both the newer

kernel and possible different settings of the target machine,

so, as root:

$ cd /usr/src/rtai

$ make xconfig (or menuconfig or config)

$ make clean

$ make

$ make install

and copy the configuration file for future reference :

$ cp -f .rtai_config config-rtai.txt

It is a good idea at this point to recompile the code

from the simulink schemes that need to run on the target machine.

STEP 3 – Download, unpack and install Busybox

Go to http://busybox.net/downloads/ and get version 1.01,

version 1.1.13 is ok but is slightly different

however later version do not compile statically with gcc,

so it’s better to avoid them and just get the 1.01 version.

As root, download the busybox-x.xx.tar.bz2 file into /usr/src

ans unpack it using the following commands :

$ cd /usr/src

$ tar -xjvf busybox-x.xx.tar.bz2

Set a symbolic link for later use:

$ rm -f busybox

$ ln -fs busybox-x.xx busybox

then, configure and install busybox:

$ cd /usr/src/busybox

$ make config (or make menuconfig)

In the Build Options, select “Build Busybox as a static binary”.

Be sure to include at least the init, insmod, rmmod, and mount,

in general, select to only what you need, if unsure,

use the default option.

In version 1.1.13 be sure to set the PREFIX option equal to /mnt/f.

After the configuration, as root:

$ make dep

$ make busybox

finally, save the config file for future reference:

$ cp -f .config config-busybox.txt

STEP 4 – Download, unpack and install LILO

Its time to insert your DOM in your HOST PC. Switch-off your PC. I assume that you are running your host Linux from SATA hard disk. So atleast you should have one IDE port is free now. Now Insert the DOM in your free IDE port.


Its upto your wish to use. I am not comfortable with LILO. So I used GRUB. But here I have given the steps for both LILO & GRUB. So please install either GRUB or LILO boot loader.

GRUB installation

You can use grub-install command to install GRUB on your DOM from your Ubuntu Linux.

# mke2fs /dev/sda

# mount -t ext2 /dev/sda /mnt

# grub-install –root-directory=/mnt sda

# umount /mnt

If you installed GRUB, then skip the next step, LILO installation. If you dont like GRUB and wish to install install LILO, then continue.

LILO installation

Go to http://freshmeat.net/projects/bin86/ and look for the latest version of the bin86 assembler and loader, (i used 0.16.17).

As root, download the bin86-x.xx.xx.tar.gz file into /usr/src ans unpack it using the following commands

$ cd /usr/src $ tar -zxvf bin86-x.xx.xx.tar.gz

Then compile the bin86 assembler:

$ cd /usr/src/bin86-x.xx.xx $ mkdir /usr/local/man/man1 $ make && make install

If everything goes fine, then it’s time to download LILO: go to http://www.t2-project.org/packages/6.0/lilo.html and look for the newest stable version of the lilo, (i use version 22.7.1).

As root, download the lilo-xx.x.x.src.tar.gz file into /usr/src ans unpack it using the following commands :

$ cd /usr/src $ tar -zxvf lilo-xx.x.x.src.tar.gz

Set a symbolic link for later use:

$ rm -f lilo $ ln -fs lilo-xx.x.x lilo

then, build lilo (you don’t have to install it on the system as a boot loader, you just need to have the /usr/src/lilo/lilo binary)

$ make install

STEP 5 – Prepare DOM

In what follows, it is assumed that you want to create a stand alone RTAI system on a DOM. This is rarely useful, since you can’t normally include anything else other than the bare essential, however, if you learn how to squeeze Linux on a DOM then you can later put it wherever you want, using exactly the same procedure with just a few changes. For example if the destination is a floppy mounted as /dev/fd0 you can replace the /dev/sda string with /dev/fd0 in the following instructions. unmount the DOM :

$ umount /dev/sda

$ sync

zero out the content of the DOM block by block:

$ dd if=/dev/zero of=/dev/sda bs=1MB count=128

create an ext2 file system on the DOM:

$ /sbin/mke2fs -F -m 0 /dev/sda

create a temporary folder if it does not exist, and remove everything if it exists

$ mkdir -p /mnt/f

$ rm -drf /mnt/f/*

mount the DOM on /mnt/f :

$ mount -t ext2 /dev/sda /mnt/f

$ sync

STEP 6 – Populate the root

Again as root, create the classic unix directories :

$ cd /mnt/f

$ mkdir boot

$ mkdir initrd

$ mkdir dev

$ mkdir proc

$ mkdir etc

$ mkdir sbin

$ mkdir bin

$ mkdir lib

$ mkdir mnt

$ mkdir usr

$ mkdir tmp

$ mkdir lib/modules

$ mkdir -p var/{log,run}

$ touch var/run/utmp

$ sync

STEP 7 – Populate /dev

$ cp -dpR /dev/hda dev

$ cp -dpR /dev/hda[0-3] dev

$ cp -dpR /dev/hdb dev

$ cp -dpR /dev/hdb[0-3] dev

$ cp -dpR /dev/sda dev

$ cp -dpR /dev/sda[0-3] dev

$ cp -dpR /dev/sdb dev

$ cp -dpR /dev/sdb[0-3] dev

$ cp -dpR /dev/tty[0-6] dev

$ cp -dpR /dev/ttyS[0-6] dev

$ cp -dpR /dev/ram[0-6] dev

$ cp -dpR /dev/console dev

$ cp -dpR /dev/zero dev

$ cp -dpR /dev/null dev

$ cp -dpR /dev/kmem dev

$ cp -dpR /dev/mem dev

$ mkdir dev/rtf

$ cp -dpR /dev/rtf/[0-9] dev/rtf

$ cp -dpR /dev/rtf[0-9] dev

$ cp -dpR /dev/rtai_shm dev

$ sync

If you are creating a bootable flashcard that is seen as, say, /dev/sdc on the development system and it will be seen as, say, /dev/hda on the target system, make sure that both /dev/sdc and /dev/hda are copied to the /mnt/f/dev folder. If necessary you need to copy these device files from other system, but they have to be there otherwise step 10 will fail.

STEP 8 – Create the configuration files and populate /etc

I suggest that you create the folder /usr/etc/f to store the configuration files for your system.

There are 2 very important configuration files that the system needs to find during the boot process, that is /etc/fstab and /etc/init.d/rcS :


This is the file that tells the filesystems to mount and where they are located, usually just a few lines are required:

/dev/sda / ext2 defaults 1 1 none /proc proc defaults 0 0

If the kernel does not support the /proc filesystem then just the first line is necessary.


This file (rcS stands for Run Commands Shell) contains command to be executed by the shell as soon as it starts. here is an example:


/bin/mount -av


insmod /lib/modules/rtai_hal.ko

insmod /lib/modules/rtai_lxrt.ko

insmod /lib/modules/rtai_fifos.ko

insmod /lib/modules/rtai_sem.ko

insmod /lib/modules/rtai_mbx.ko

insmod /lib/modules/rtai_msg.ko sync

# insert your calls here, e.g: # /tmp/test -v -f 10

# shut down the system



This part is only needed for those who are using LILO. If you are using GRUB, please skip this lilo.conf section.

The lilo configuration file it is not needed during the boot process but it is needed later to properly write the DOM boot sector:

Here is an example of lilo.conf file for a stand alone system with both kernel and file system on the same DOM :

boot =/dev/sda

map =/boot/map

timeout =00


backup =/dev/null

compact image =/boot/bzImage

label =RTFLASH

root =/dev/sda

initrd =/boot/initrd.img-2.6.24

It is a good idea to also store the configuration files:

$ cp -f /usr/src/linux/.config /usr/etc/f/config-linux.txt

$ cp -f /usr/src/linux/.config /usr/etc/f/config-rtai.txt

$ cp -f /usr/src/busybox/.config /usr/etc/f/config-busybox.txt

At this point we can move the files into the mnt/f/etc folder:

$ cd /mnt/f $ cp /usr/etc/f/* etc

It is always better to make sure that rc is executable:

$ chmod -R 777 etc/* $ sync

Finally, if you modified the code of either the linux kernel or busybox, it is a good idea to include it here in this folder.

STEP 9 – Populate /bin /sbin and /usr using busybox

As root, do the following :

$ cd /usr/src/busybox

$ make PREFIX=/mnt/f install

$ sync

STEP 10 – Create RAM DISK, Copy the kernel and make the disk bootable

On Ubuntu, you have to create the initial ram disk with the command:

$ update-initramfs -ck x.x.xx

where x.x.xx is the directory under /lib/modules that contains the modules for the new kernel.

$ cp /usr/src/linux/arch/x86/boot/bzImage /mnt/f/boot/bzImage

$ cp /boot/initrd.img-2.6.24 /mnt/f/boot/

$ cp -dpR /boot/System.map-x.x.xx /mnt/f/boot/

$ sync

If you are using GRUB, then follow GRUB user’s and skip LILO user’s section.

GRUB user’s

Now you have to edit the /mnt/f/boot/grub/menu.lst, comment the “hiddenmenu” option, set the timeout to something like 10 seconds, and physically insert the lines relative to the new kernel, resulting in something like this:


root (hd0,0)

kernel /boot/bzImage ro root=/dev/sda initrd /boot/initrd.img-2.6.24

LILO user’s

$ /usr/src/lilo/lilo -v -C /etc/lilo.conf -r /mnt/f

$ sync

STEP 11 – Copy rtai related stuff

I hope you have more space left in your DOM. Its better to copy the RTAI and Linux related stuffs from your host to DOM. It is good, if you will copy the necessary file, libraries, modules from /lib folder from your host Linux.

I copied all the files available in the folder /lib from my host to /mnt/f/. So the size was ~100MB. After I confirmed that my DOM booted successfully, then I removed the unwanted libraries, modules from the folder /mnt/f/lib/.

Or If you are really working with a standard floppy disk then at this point there will probably be only about 100K left on your floppy disk so, there will be no space left to copy any modules or executables, except maybe for a few ones, so, in that case you can skip this step.

All the rtai modules and the executables that need to run on the target system, have to be compiled for the target system, therefore make sure that rtai has been compiled and installed using the same linux .config file that was used to compile the kernel for the target processor in step 1.


$ cd /mnt/f $ cp /usr/realtime/modules/rtai_hal.ko lib/modules

$ cp /usr/realtime/modules/rtai_lxrt.ko lib/modules

$ cp /usr/realtime/modules/rtai_fifos.ko lib/modules

$ cp /usr/realtime/modules/rtai_sem.ko lib/modules

$ cp /usr/realtime/modules/rtai_mbx.ko lib/modules

$ cp /usr/realtime/modules/rtai_msg.ko lib/modules

$ sync

Also, allow the tmp directory to be accessible, if you want to copy some file over there.

chmod -R 777 /mnt/flash/tmp

At this point, you should recompile the executables that need to run on the target system, and copy them on the tmp directory along with any other needed file.

STEP 12 – Check size, unmount and reboot

$ df -h /dev/sda

$ sync

$ sync

$ umount /dev/sda

If you want to test your DOM from your host, then set your bios that, you are booting from DOM first instead of your SATA hard disk.

Or You can directly test the DOM from target board. now take your device, insert it into the target system, reboot and cross your fingers really hard 🙂

If you have any issues, you can reach me by asprakash83 at gmail dot com More steps are taken from the document “RTAI-TARGET-HOWTO.txt” prepared by Giampiero Campa. You can reach him by campa at cemr dot wvu dot edu Download the pdf version of this file from here.

I will upload my stand alone RTAI & update the link soon. Check this page frequently.


May 14, 2008

New born BioPuppy Linux beta version released!

Posted in bioinormatics, General, Linux, Open Source tagged , , , , , at 3:36 pm by asprakash

I gladly inform you that, our first version of BioPuppy Linux is out, now. You can download it from http://biopuppy.org

What is BioPuppy Linux

BioPuppy is an electronic workbench for bio-informatics and computational biology. It has been designed to meet the needs of beginners. BioPuppy is available as a live CD cum installation CD [and in USB Pen drive] and containing all the required software to boot the computer with ready to use bio-informatics tools. BioPuppy is based of the Puppy Linux. The another objective of this BioPuppy is small in size. Our estimated size of BioPuppy is ~150MB.

More about BioPuppy

BioPuppy contains all the tools available in the basic puppy linux and bioinformatics tools. It provides both standard and cutting edge bioinformatics software tools on a Linux base. It is powerful, configurable and easy to maintain. It has been customized for ease of use and provides an ideal system for scientists handling and analyzing biological data. The Biopuppy is a light weight version of bio OS. Bioinformatics-related customizations include a large number of bioinformatics programs and programming libraries, the addition of graphical menus for much of the bioinformatics software, and links from the desktop to key documentation and applications. The system also includes a comprehensive, categorized and searchable documentation system for bioinformatics software.

Features of BioPuppy

* More user friendly and easy to use for those new to Linux.

* Contains all the necessary Bioinformatics tools. Check the Biology tools already included in BioPuppy.

* BioPuppy will boot from a minimum PC/Laptop with 586Mhz CPU and 32Mb RAM

* Easy to install in Hard disk, USB Pen drive and Compact Flash (CF) cards. No fear on installation for those new to Linux.

* Very small in size (~180MB). But it has everything.

* BioPuppy can run your operating system, programs and store your data on the same CD-RW/Pen drive/Hard disk

* BioPuppy contains extensive help files for ALL its programs and Bioinformatcis tools with screen shot.

* Can easily update new version.

* Bring all your programs, tools, moves, songs with light weight BioPuppy Linux in a single USB Pen drive.

Biology softwares included

Sequence Analysis Tools :: Sim-4, Tigr-Glimmer 2, Genewise, Muscle, Sigma, HMMER, Clustal-W and mafft

Structure Prediction Tools :: mfold, gibbs

Protein Structure Analysis Tools :: Garlic,Rasmol

Phylogenetic Analysis tools :: Fast DNA, Phylip, Phylodraw

Protein Modeling :: Modeller

Docking :: MGL Tools (Autodock tools, Python Molecular Viewer (PMV), Vision)

System Biology :: Copasi

On-line tools :: BLAST,EMBOSS

For more please visit http://biopuppy.org

Your contributions are almost welcome!…

Some screen shots

May 8, 2008

How developers/companies are earning money from Open Source environment?

Posted in Entrepreneurship, General, Open Source tagged , , at 4:05 am by asprakash

A Free and Open Source Software (FOSS) need not a free of cost. We can earn money in some ways from Open Source softwares by directly and indirectly.

* Hope you know, we dont have any official supports for Open Source softwares. Take a OS s/w; Sale it with free of cost for your customer. When they want support, you just charge some money.
* One important drawback in OS is, no ready made development environment and taking more time duration for setting up a environment. if you will do every thing in a single package, then you can earn more money from OS. For example, still we dont have any ready made working environment for embedded linux. We have to install more tools and need to configure lot of things. Its an nightmare for developers. If you possible to collect all the tools, configure it and ready for sale, you can earn more money, I m sure.
* You can also earn money by teaching OS tools and softwares, like provide training.
* You can also earn money by providing installation setup/supports for an company/organizations. CDAC is d example in this case. They are doing this business for all the government org from BOSS linux.
* My-sql is an open source DB. Recently, Mr.Brain [Owner of mq-sql]sale his OS project MY-AQL to another company for some millions. But it took around 6 years for earn this money from his open source project.
* Sale a OS operating system CD/DVD is an good business and more…

Why the companies are starting a OS software

You may ask this question, definitely. Now we can see why a company/developer start an OS project.
* You will get more contributions from community. So that your product will be stable soon.
* Get more contribution from community. You no need to recruit more people for this project.
* Google encourage more OS activities like Google SOC and this is the best example company for earning more money from OS by directly and indirectly.
* Intel have a big OS community. So that they are getting contributions for writing drivers for their processors. They have lots of other OS projects too, http://oss.intel.com/en-us/
* NOKIA, have a OS community. Initially they started with couple of OS projects. Now they have more than 25 projects in a short period. Through this OS activity, they are getting more contributions for their application development and others. visit http://opensource.nokia.com/
* {After NOVELL earned more bad issues from communities, once tied with Microsoft} Now AMD supports OpenSUSE project, http://www.opensuse.org/
* nVidia have a OS community and they are getting more contributions for writing drivers for their devices.
* There are lots of companies are having OS activities. Coz, they are getting credits indirectly, compare with what they are earning money by directly.

* For more details about Open Source business plan refer this link, http://www.opensource.org/advocacy/case_for_business.php