Installing RT Linux... RTAI RTLinux This guide is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. (C) Phil Wilshire 1999 The steps are... ============================================================================ 1 ... unpack the kit ============================================================================ The steps I use are : 1.1 get a clean kernel from ftp.us.kernel.org wget ftp.kernel.org/pub/linux/kernel/v2.2/linux-2.2.13.tar.gz or wget ftp.us.kernel.org/pub/linux/kernel/v2.2/linux-2.2.13.tar.gz 1.2 get the patch file FOR THAT KERNEL. 1.3 move your current copy of /usr/src/linux ( if it is not a link ) to /usr/src/oldlinux check with ls -l /usr/src links look like this ls -l /usr/src/linux lrwxrwxrwx 1 root root 17 Aug 17 1998 /usr/src/linux -> linux-2.2.10 ( in this case just delete the link and do the untar ) If you have to move a tree do cd /usr/src mv linux oldlinux 1.4 Create a working directory .. I use /opt/rtl mkdir /opt/rtl You may need to do this as root . loosen up restrictions on the new directory chmod a+rw /opt/rtl This will allow you as a user to access this. NOTE: do most of your work as a regular user .. it's safer. 1.5 Untar the RTAI tarball into /opt/rtl ie if the tarball is in /home/wilshire/download/rtl/rtai-0.8.tgz cd /opt/rtl tar xvzf /home/wilshire/download/rtl/rtai-0.8.tgz This will create /opt/rtl/rtai-0.8 1.6 Get a fresh copy of linux. This means take the linux-2.2.13.tar.gz tarball and put it somewhere I suggest in the current RTAI tree. ie if the tarball is in /home/wilshire/download/linux/linux-2.2.13.tar.gz cd /opt/rtl/rtai-0.8 tar xvzf /home/wilshire/download/linux/linux-2.2.13.tar.gz ============================================================================ 2.0 Modify the Kernel ============================================================================ 2.1 Apply the mods for RTAI make a link from /opt/rtl/rtai-0.8 to /usr/src/linux-2.2.13 ln -s /opt/rtl/rtai-0.8/linux /usr/src/linux-2.2.13 move to the patching directory cd /opt/rtl/rtai-0.8/linux-2.2.13 apply the cautious patch for now sh cautious_copyto ============================================================================ 3.0 Configure and compile the Kernel ============================================================================ 3.1 look at what's running Now we need to configure and compile the patched kernel. First we need to look at what's running. [wilshire@pasrack3 linux]$ /sbin/lsmod Module Size Used by 3c59x 18952 1 Then we need to configure our new kernel. We see the modules used and make sure that we configure the new kernel for the same ones. now type 3.2 Configure the kernel cd /opt/rtl/rtai-0.8/linux make menuconfig and check options as required Code maturity level options ---> yes Processor type and features ---> (PPro/6x86MX) Processor family [*] Symmetric multi-processing support [*] Hard realtime support Loadable module support ---> [*] Enable loadable module support [ ] Set version information on all symbols for modules [ ] Kernel module loader General setup ---> accept defaults Plug and Play support ---> accept defaults Plug and Play support ---> accept defaults Networking options ---> accept defaults SCSI support ---> accept defaults Network device support ---> Ethernet (10 or 100Mbit) ---> [*] 3COM cards <M> 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support ( in this case ) and finally Kernel hacking ---> [*] Magic SysRq key ( this may come in handy ) Right having done all this ... save the configuration ********************************************************************** Note it is a very good idea to mark the kernel version... ********************************************************************** Edit Makefile and modify this bit at the top as below VERSION = 2 PATCHLEVEL = 2 SUBLEVEL = 13 EXTRAVERSION =-RTAI08 3.4 Compile the kernel Now build the kernel [wilshire@pasrack3 linux]$ make dep; make clean; make bzImage go for a cup of tea , read your mail, write a manual ....10 minutes or so. You will end up with a new Kernel a new Symbol.map etc. BEFORE you do anything else... set your system up to use this new kernel go to root su 3.5 Make/ Install the modules make the modules make modules; make modules_install watch the result here [root@pasrack3 linux]# make modules_install Installing modules under /lib/modules/2.2.13-RTAI08/net Installing modules under /lib/modules/2.2.13-RTAI08/misc the /lib/modules/2.2.13-RTAI08 shows you that just about every thing is well. ============================================================================ 4.0 Set up boot / Lilo ============================================================================ copy the boot image to the right place cp arch/i386/boot/bzImage /boot/bzImageRTAI08 copy the Symbol.map to the right place cp System.map /boot/System.mapRTAI08 make the new System.map " active" rm /boot/System.map ln -s /boot/System.mapRTAI08 /boot/System.map edit /etc/lilo.conf It should look like ... ======================================================= boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 image=/boot/bzImageRTAI08 label=linuxRTAI08 root=/dev/hda1 append="mem=126M" read-only image=/boot/bzImage label=linux root=/dev/hda1 append="mem=126M" read-only ====================================================== #<keep another around just in case > Run Lilo [root@pasrack3 linux]# /sbin/lilo Added linuxRTAI08 * Added linux ============================================================================ 5.0 Boot ============================================================================ Now is the time to reboot Having rebooted we need to move the linux source link to our new source tree. rm /usr/src/linux ln -s /opt/rtl/rtai-0.8/linux /usr/src/linux ============================================================================ 6.0 Setup and make the rtai module ============================================================================ 6. 1 Now we can make the rtl modules Check and adjust the date [root@pasrack3 rtl]# date Wed Nov 10 23:14:18 PST 1999 [root@pasrack3 rtl]# date 11111452 Thu Nov 11 14:52:00 PST 1999 We need to set up the rtai header files cd /opt/rtl/rtai-0.8 I cheat here to set up the headers... make calibrate If you do not have a SMP system then he BUS FREQ will not be detected at this stage. Then make all .... 6.2 Set up your path =======================set up your path============================ try lsmod if you get [root@pasrack3 fp]# lsmod bash: lsmod: command not found do this export PATH=/sbin:$PATH then try again [root@pasrack3 fp]# lsmod Module Size Used by 3c59x 19176 1 ===================================================================== 6.3 Install what you need This is a bit vague for me for all the different options. I'll try pick out a working path for a UP system and a SMP system For a UniProcessor system cp /opt/rtl/rtai-0.8/upscheduler/rtai_sched /opt/rtl/rtai-0.8/modules For a SMPsystem cp /opt/rtl/rtai-0.8/smpscheduler/rtai_sched_8254 /opt/rtl/rtai-0.8/modules/rtai_sched or cp /opt/rtl/rtai-0.8/smpscheduler/rtai_sched_apic /opt/rtl/rtai-0.8/modules/rtai_sched Look at the /opt/rtl/rtai-0.8/smpscheduler/README to make your choice. now cd /opt/rtl/rtai-0.8 and ./ldmod should produce soemthing close to the following op [root@pasrack3 rtai-0.8]# ./ldmod Module Size Used by 3c59x 19176 1 Module Size Used by rtai_sched 14452 0 (unused) rtai_fifos 23156 0 (unused) rtai 23232 1 [rtai_sched rtai_fifos] 3c59x 19176 1 6.4 try something A simple test can be dug out of the latency_calibration system. This is also a very useful check that your basic system is working. cd /opt/rtl/rtai-0.8/latency_calibration [root@pasrack3 latency_calibration]# ls Makefile README check check.c rt_process rt_process.c [root@pasrack3 latency_calibration]# insmod rt_process [root@pasrack3 latency_calibration]# ./check *** min: -4964, max: 5469 average: -3677 *** *** min: -4964, max: -1727 average: -3684 *** *** min: -4964, max: 5229 average: -3671 *** *** min: -4994, max: 6564 average: -3668 *** *** min: -4964, max: 8171 average: -3678 *** *** min: -4994, max: 2865 average: -3676 *** *** min: -4934, max: 6166 average: -3654 *** ... ^c That's it for the main install.. ============================================================================ 7.0 Run some examples ============================================================================ Now for some of the examples RTAI come with a ton of em I'll pick just a few =========================fp===================================== cd /opt/rtl/rtai-0.8/examples/fp insmod rt_process ./check ***** CHECK FLOATING POINT SUPPORT (TO STOP CTRL-C) ***** ***** PRESS f TO TOGGLE FLOATING POINT SUPPORT AND SEE WHAT HAPPENS ***** ***** PRESS ANY OTHER KEY TO KEEP VERIFYING THE CURRENT STATUS ***** ***** THE RIGHT MOST VALUE SHOULD BE 1.2345728950E+09 ***** 4.7436068635915034E-02 4.7422657799313435E-02 1.2345728950E+09 f 9.3079944866798936E-01 9.3079862074810471E-01 2.2110000000E+03 4.3794158235833830E-01 4.3793087876745251E-01 1.0878000000E+04 f 9.6302305497101659E-01 9.6302109177871875E-01 1.2345728950E+09 -8.6197664916726202E-01 -8.6198223915891703E-01 1.2345728950E+09 f -4.6451587393225269E-01 -4.6451114977778762E-01 5.7970000000E+04 -3.8617040183534634E-01 -3.8618075197697144E-01 2.3770500000E+05 this is a cool test..... ===================================================================== [root@pasrack3 examples]# cd ../jepplin [root@pasrack3 jepplin]# insmod rt_process [root@pasrack3 jepplin]# sleep 25 [root@pasrack3 jepplin]# rmmod rt_process Joey Johnny Dee Dee Marky Joey Johnny Dee Dee Marky Joey Johnny Dee Dee Marky Joey Johnny Dee Dee Marky Joey Johnny Dee Dee Marky sync Marky Dee Dee Johnny Joey sem timeout, task 0, Joey sem timeout, task 1, Johnny sem timeout, task 2, Dee Dee sem timeout, task 3, Marky sync testing message queues received by task 0 Joey received by task 3 Johnny received by task 2 Dee Dee received by task 1 Marky received from mbx_out: Joey received from mbx_out: Marky received from mbx_out: Dee Dee received from mbx_out: Johnny init task complete mbx timeout, task 0, Joey mbx timeout, task 1, Johnny mbx timeout, task 2, Dee Dee mbx timeout, task 3, Marky Read the README and the source to work out what is happening. =============================stress========================================= note that if you try this you need the old fifis. rmmod rtai_fifos insmod ../../oldfifos/rtai_fifos insmod rt_process ./checkp > F r 201 7362274 > F r 201 7362275 > F r 201 7362276 > F r 201 7362277 > F r 201 7362279 > F r 201 7362279 > F r 201 7362281 > F r 201 7362282 > F r 201 7362284 ./checkl *** min: -5794, max: 6102 average: -3623 flags: 201*** *** min: -4840, max: 5114 average: -3609 flags: 201*** *** min: -4772, max: 5670 average: -3606 flags: 201*** *** min: -4840, max: 6414 average: -3613 flags: 201*** *** min: -4840, max: 8034 average: -3616 flags: 201*** *** min: -4780, max: 3784 average: -3614 flags: 201*** *** min: -4780, max: 6641 average: -3601 flags: 201*** *** min: -4742, max: 5401 average: -3605 flags: 201*** Read the README and the source to work out what is happening. ============================================================================= for the mbx test [root@pasrack3 mbx]# insmod ../../portable_shm/rtai_shm [root@pasrack3 mbx]# insmod rt_process [root@pasrack3 mbx]# sleep 10 [root@pasrack3 mbx]# rmmod rt_process Again read the README and the source to work out what is happening. ============================================================================= I strongly you try out the lxrt stuff and try to work out what is happening.. That's it you're on your own now. ===================================================================== Example Reboot Problem. I'm running RedHat and my ehternet card doesn't work now... Solution #1 something to do with cat /proc/version >/lib/modules/2.2.13-RTL2.0/.rhkmvtag but this still does not work. I am working on it. So Solution #2 add # load up eth0 /sbin/modprobe eth0 to /etc/rc.d/rc.sysinit near the end Hope this helps Phil Wilshire --- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] ---- For more information on Real-Time Linux see: http://www.rtlinux.org/~rtlinux/