Open RTLinux V3.1 Installation notes from Gerhard Schlager The following manual describes the procedure to set up Open RTLinux V3.1 with Kernel 2.4.18 on a pc with SuSe Linux 8.0. First download the clean 2.4.18 kernel from ftp.kernel.org (don't use a kernel from any distribution) lin: # cd /usr/src lin:/usr/src # ftp ftp.kernel.org user: ftp password: root@ ftp>> cd pub/linux/kernel/v2.4/ ftp>> get linux-2.4.18.tar.bz2 ftp>> quit The Open RTLinux can be downloaded by lin:/usr/src # ftp ftp.fsmlabs.at user: ftp password: root@ To get the RTLinux package use the following commands ftp>> cd pub/rtlinux ftp>> get rtlinux-3.1.tar.bz2 and for the documentation ftp>> cd pub/rtlinux ftp>> get rtldoc-3.1.tar.bz2 then you can download the patch for the 2.4.18 kernel to run RTLinux 3.1 ftp>> cd contrib ftp>> get rt-patch-2.4.18.tar.bz2 ftp>> quit Now extract the packages in the following manner lin:/usr/src # bunzip2 linux-2.4.18.tar.bz2 then look for the root directory of the linux-2.4.18.tar (for security reasons) lin:/usr/src # tar -tf linux-2.4.18.tar if the root directory is ok extract it with lin:/usr/src # tar -xf linux-2.4.18.tar After this do the same procedure with rtllinux-3.1.tar.bz2 rt-patch-2.4.18.tar.bz2 rtldoc-3.1.tar.bz2 (if you need the documentation) Change into the rt-patch-2.4.18 directory and gunzip the patch files lin:/usr/src # gunzip rt-patch-2.4.18/patch_rtl-2.4.18.gz lin:/usr/src # gunzip rt-patch-2.4.18/patch_rtlinux-3.1.gz After extracting all files, the directory which was created by unpacking the Linux kernel, the linux directory must be moved to another directory, for example linux-2.4.18_rtl and a symbolic link has to be created. lin:/usr/src # mv linux linux-2.4.18_rtl lin:/usr/src # ln -s linux-2.4.18 linux Remove the directory or link asm in /usr/include with lin:/usr/src # rm -rf /usr/include/asm and make a softlink to /usr/src/linux/include/asm-i386 lin:/usr/src # ln -s /usr/src/linux/include/asm-i386 /usr/include/asm Now you have to patch the standard kernel for the use with RTLinux, therefore change into the /usr/src/linux directory lin:/usr/src # cd linux and patch the kernel with lin:/usr/src/linux #patch -p1 --dry-run < ../rt-patch-2.4.18/patch_rtl-2.4.18 > mylogfile after checking the log file mylogfile and everthing looks good patch the kernel with lin:/usr/src/linux #patch -p1 < ../rt-patch-2.4.18/patch_rtl-2.4.18 Now the kernel is a patched and we can start to configure and build the kernel but first we have a look at the /proc/cupinfo to see which cpu type are used form Linux. lin:/usr/src/linux # cat /proc/cpuinfo The modules which are used by default can be shown by the command lin:/usr/src/linux # lsmod Make a note about your hardware to include it in the new kernel, which will configure now. lin:/usr/src/linux # make menuconfig The following options must be enabled/disabled: Code maturity level options -> Prompt for development and/or incomplete code/drivers ENABLE Processor type and features -> your CPU type MTRR (Memory type range register) ENABLE Symmetric mulit-processing support DISABLE General setup -> Power Management support -> DISABLE Select Network and SCSI drivers according to your machine. The file system must also be adapted to your requirements. Save the configuration and exit. Copy the .config file: lin:/usr/src/linux # cp .config my_config and make the system clean with lin:/usr/src/linux # make mrproper after this make the .config file available with lin:/usr/src/linux # cp my_conf .config and check the syntax and parameters of the .config file with lin:/usr/src/linux # make oldconfig after this build the kernel lin:/usr/src/linux # make dep lin:/usr/src/linux # make lin:/usr/src/linux # make modules lin:/usr/src/linux # make modules_install for benchmark reasons put a time in front of the make, for a AMD 1400 MHz the following time-table results: real 2m23.754s user 2m09.630s sys 0m10.540s If an error results due to the make commands try the following command to receive a file called kernel.out with the error messages. Example for the make modules command lin:/usr/src/linux # make modules 2>&1 | tee kernel.out Now the /etc/lilo.conf should be modified by entering an additional boot option image = /vmlinuz label = RTlLnux root = /dev/hde7 After then the lilo can be installed with lin:/usr/src/linux # make bzlilo To complete the installation of the new Kernel the modules path for net drivers has to be modified; therefore use lin:/usr/src/linux # cd /lib/modules/2.4.18-rtl31 lin:/lib/modules/2.4.18-rtl31 # ln -s kernel/drivers/net net if something goes wrong during the kernel installation use lin:/usr/src/linux # make mrproper This command will clean the kernel tree and you can restart with the procedure from the beginning with lin:/usr/src/linux # make menuconfig command. If everything is ok and the new linux kernel boots make sure that the patched kernel is running with lin:/usr/src # uname -a you will get the kernel specifier. The output of the kernel symbol table can be reached by lin:/usr/src # ksyms -a to read the symbols for the rtl patch type lin:/usr/src # ksyms -a | grep rtl The output of the command should look like rtl_cached rtl_syscall_intercept rtl_do_exit_handler Now the RTLinux3.1 must be patched for the 2.4.18 kernel therefore change into the /usr/src/rtlinux-3.1 directory and make a dry run patch with lin:/usr/src/rtlinux-3.1 # patch -p1 --dry-run < ../rt-patch-2.4.18/patch_rtlinux-3.1 > file_list.out if the output, saved in the file file_list.out is ok, make the patch true. lin:/usr/src/rtlinux-3.1 # patch -p1 < ../rt-patch-2.4.18/patch_rtlinux-3.1 For the configuration of the RTlinux make a symbolic link to ../linux lin:/usr/src/rtlinux-3.1 # ln -s ../linux linux and then type lin:/usr/src/rtlinux-3.1 # make menuconfig In the support option menu ENABLE RTLinux tracer support RTLinux Debugger In the driver section as a minimum the Shared Memory Driver has to be enabled. Then compile the RTLinux subsystem with lin:/usr/src/rtlinux-3.1 # make dep lin:/usr/src/rtlinux-3.1 # make If the installation failed during some errors use the following commands lin:/usr/src/rtlinux-3.1 # make distclean lin:/usr/src/rtlinux-3.1 # make config or make menuconfig lin:/usr/src/rtlinux-3.1 # make dep lin:/usr/src/rtlinux-3.1 # make If you will save the error-outputs in the file error.log use lin:/usr/src/rtlinux-3.1 # make 2 > error.log After the make command was successful, take a look to the FIFO's with lin:/usr/src/rtlinux-3.1 # ls -l /dev/rt* The output should show rtf devices numbered from 1 up to 63: /dev/rtf1 up to /dev/rtf63 if this is not the case use lin:/usr/src/rtlinux-3.1 # make devices and the FIFO's should be created. Now the system is ready to use the RTLinux extension. You can load the extensions as kernel modules by running the shell script: lin:/usr/src/rtlinux-3.1 # sh scripts/insrtl After reading the kernel modules due to lin:/usr/src/rtlinux-3.1 # lsmod you should get the following output rtl_sched 28448 0 (unused) rtl_fifo 10112 0 (unused) rtl_posixio 7104 0 [rtl_fifo] rtl_time 5128 0 [rtl_sched rtl_posixio] rtl 18848 0 [rtl_sched rtl_fifo rtl_posixio rtl_time] now the system is ready to start a real time task. (The command dmesg documents also that the RTLlinux extension was loaded) Some notes for the debugger and the tracer The communication interchange between the RTLinux-debugger and the dbg runs trough the FIFO /dev/rtl10. To use the debugger the following modules has to be loaded: lin:/usr/src/rtlinux-3.1 # insmod modules/mbuff.o lin:/usr/src/rtlinux-3.1 # insmod debugger/rtl_debug.o For the tracer the following modules are necessary: lin:/usr/src/rtlinux-3.1 # insmod modules/mbuff.o lin:/usr/src/rtlinux-3.1 # insmod tracer/rtl_tracer.o an example for the debugger or for the tracer can be find in the appropriate directory of the RTLlinux-root directory.