Table of Contents
- sudo passwd root
- wget https://www.rtai.org/RTAI/rtai-3.9.tar.bz2</verbatim>
- tar xjvf linux-source-2.6.32.tar.bz2
- tar xjvf rtai-3.9.tar.bz2
- ln -s linux-source-2.6.32 linux
- cd linux </verbatim>
- make && make modules_install && make install (~1 hour)
- mkinitramfs -o /boot/initrd.img-.59+drm33.24.rtai.bigphys .59+drm33.24.rtai.bigphys
- update-grub </verbatim>
- make xconfig
- ./run </verbatim>
- cd /usr/realtime/testsuite/kern/latency
- ./run </verbatim>
- make clean && make && make install
- insmod /usr/realtime/modules/rtai-smi.ko </verbatim>
- ./run </verbatim>
- for i in cat my_hw; do cat /usr/src/linux/include/linux/pci_ids.h | grep 0x$i | cut -d ' ' -f 2 | cut -f1; done </verbatim>
- make install
- insmod /usr/realtime/modules/rtai-smi.ko </verbatim>
- ./run </verbatim>
---++ HOW-TO create the 2.6.32-generic-OpenAirInterface kernel on a Ubuntu 10.04 LTSBased on :
- Ubuntu 10.04 (The Lucid Lynx) Operating System, x86 version
- Default GCC version (4.4.3)
- All lines starting by a "#" are command lines to be executed in a terminal ---++++ Introduction
If the ROOT user is not created yet, log as your usual user, open a terminal and type -> # sudo su -
sudo passwd root
Enter the password for the ROOT user. Log out and log in as Root.
Open a terminal and update your package repository source file : # apt-get update
Some tools are required in order to set up the kernel (You need to be connected to Internet) # apt-get -y install qt3-apps-dev build-essential kernel-package vim
---++++ I - Kernel source and RTAI download # cd /usr/src/
Get the kernel source from Ubuntu repository # apt-get install linux-source-2.6.32=2.6.32-42.96
Get the RTAI 3.8 and save it in /usr/src path : # cd /usr/src
wget https://www.rtai.org/RTAI/rtai-3.9.tar.bz2
Get the patch available for download at the bottom of the page and save it under your "/usr/src/" path : (this patch includes RTAI 3.9 and BIGPHYSAREA) ---++++ II - Kernel Preparation # cd /usr/src
tar xjvf linux-source-2.6.32.tar.bz2
tar xjvf rtai-3.9.tar.bz2
ln -s linux-source-2.6.32 linux
cd linux
---++++ Applying patch
If you want first simulate the patch application, use "--dry-run" after "-p1". It won't touch any files on your computer, but you can see if you get Hunks or not. # patch -p1 <../EURECOM.patch
---++++ Kernel Configuration # cd /usr/src/linux
In order to retrieve your current kernel configuration : (If at this step, questions are asked give the answer by default) # make oldconfig
Now we modify the kernel settings the way we need it : # make xconfig
Check that your kernel configuration is as follows (for each of the following features, be sure that they are buit-in the kernel(ticked) and not just as a kernel module (point)):
- General Setup
- Kernel .config Support -> ENABLE
- Enable access to .config through /proc/config.gz -> ENABLE
- Kernel .config Support -> ENABLE
- Processor type and features
- Processor family -> SELECT YOURS
- Interrupt Pipeline -> ENABLE
- Support for Bigphysarea -> ENABLE
- Networking Support
- Networking options
- Transformation user conf interface -> ENABLE
- PF_KEY socket -> ENABLE
- TCP/IP Networking
- The IPv6 Protocol -> ENABLE recursively all features here
- Network Packet Filtering Framework (Netfilter)
- Tick everything here and everything recursively Save and Quit
- Networking options
Edit the "Makefile" and update the "EXTRAVERSION" field
# vi Makefile
Update the following field in a way to have this -> "EXTRAVERSION = .59+drm33.24.rtai.bigphys" ---++++ III - Kernel Compilation # cd /usr/src/linux
make && make modules_install && make install (~1 hour)
NOTE: The compilation time might be decreased by passing the flags -jX (with X=number of CPUs you have on your machine). This has for effect to parallelise the kernel compilation between the CPUs.
mkinitramfs -o /boot/initrd.img-.59+drm33.24.rtai.bigphys .59+drm33.24.rtai.bigphys
update-grub
If you want to be sure that your new kernel will be the default one
# vi /boot/grub/grub.cfg
Look for set default="X' number at the beginning of this file and memorize it
Check at the end of the file that your kernel entry matches this "default" number
For your kernel entry paragraph, at the end of the "kernel" line, do not forget to replace "quiet splash" by "bigphysarea=19200".
The kernel entry should look almost like this:
No initrd line will cause a Kernel panic during the system boot
menuentry 'Ubuntu, with Linux 2.6.32.59+drm33.24.rtai.bigphys' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 2517a352-319f-4238-ad1a-7f7cf1dc699b
linux /boot/vmlinuz-2.6.32.59+drm33.24.rtai.bigphys root=UUID=2517a352-319f-4238-ad1a-7f7cf1dc699b ro quiet splash
initrd /boot/initrd.img-2.6.32.59+drm33.24.rtai.bigphys
}
Save and quit # reboot
---++++ IV - RTAI installation
Now that the system has restarted, make sure you booted on your new OpenAir kernel # uname -r
Should give you "2.6.32.11+drm33.2.openairinterface" as result # cd /usr/src/rtai-3.8
make xconfig
- Machine (x86) -> UPDATE the CPUs number according to your configuration
- Base System
- Other features
- Mathfuns support in kernel -> ENABLE
- C99 Standard Support -> ENABLE Save and quit. If any error occurs here, solve it and repeat this "make xconfig" step until it's OK # make && make install
- Mathfuns support in kernel -> ENABLE
- Other features
We place RTAI modules in a way thay can be controled by modprobe command
# mkdir /lib/modules/2.6.32.59+drm33.24.rtai.bigphys/rtai
# cp -r /usr/realtime/modules/* /lib/modules/2.6.32.59+drm33.24.rtai.bigphys/rtai/
# depmod -a
# export PATH=/usr/realtime/bin:$PATH
Add the following lines at the end of /etc/modules (this loads the rtai modules needed by openair) :
rtai_smi
rtai_fifos
rtai_sem
rtai_math
rtai_sched
rtai_hal
In order to execute it at each terminal launch :
# vim /root/.bashrc
Add what follows, to the end of the file
# export PATH=/usr/realtime/bin:$PATH
We will test the RTAI system via the latency test # cd /usr/realtime/testsuite/kern/latency
./run
If the test fails to start, it could be related to a bad RTAI configuration. Check error messages with "dmesg".
You should have absolutely no overrun and the "lat-max" column values should not exceed 45 000ns
If it is the case, try this :
# modprobe rtai_smi
cd /usr/realtime/testsuite/kern/latency
./run
If you still don't have the value "0" in overrun column or/and the "lat-max" column values exceed 45 000ns, then go to paragraph V.
If everything is Ok, then you're done with the Real-time kernel installation and you can directly jump to the "part VI" of this page.
---++++ V - RTAI: High latencies with SMI not disabled
You have to achieve thi section ONLY if you had bad results during the part IV - RTAI installation.
The bad results you get before are certainly due to the SMI (System Maintenance Interrupt), that you have to disable for your system. SMI is a real-time killer largely spread on motherboard with Intel chipsets.
To achieve this, you should edit /usr/src/rtai-3.8/base/arch/i386/calibration/smi-module.c
# vi /usr/src/rtai-3.8/base/arch/i386/calibration/smi-module.c
- "int smiReset" should be equals to 0
- "#define CONFIG_RTAI_HW_SMI_ALL" should be set to 1 Save and quit # cd /usr/src/rtai-3.8
make clean && make && make install
insmod /usr/realtime/modules/rtai-smi.ko
We repeat the latency test # cd /usr/realtime/testsuite/kern/latency
./run
You should have absolutely no overrun and the "lat-max" column values should not exceed 45 000ns
If you still face problem with this test, it means that the module rtai-smi.ko doesn't know how to disable SMI for your Hardware
You have to identify the Intel chipset you're using (We are not really sure about that yet, but we found out that it is working for us). Execute in a terminal what follows
# lspci -nv | grep 00:1f.0 | cut -d ' ' -f 3 | cut -d ':' -f 2 > my_hw
for i in cat my_hw; do cat /usr/src/linux/include/linux/pci_ids.h | grep 0x$i | cut -d ' ' -f 2 | cut -f1; done
Copy the result somewhere
Then, we update RTAI sources # vim /usr/src/rtai-3.8/base/arch/i386/calibration/smi-module.c
Look for this line -> "{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1) },"
And just after, add "{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, XXXXXXXXX) }," with XXXXXXXXX = what you copied above
Save and quit
# cd /usr/src/rtai-3.8
make install
insmod /usr/realtime/modules/rtai-smi.ko
If you type the command 'dmesg' in a new terminal, you should see now:
RTAI: Intel chipset found, enabling SMI workaround.
SMI configuration has been set, mask used = 1
We repeat the latency test # cd /usr/realtime/testsuite/kern/latency
./run
You should have absolutely no overrun and the "lat-max" column values should not exceed 45 000ns
RTAI_SMI modules will be loaded automatically at each boot # vi /etc/modules
Add "rtai_smi" at the end of the list
-- User.PhilippeFoubert - 16 Mar 2012
- %ATTACHURL%/EURECOM.patch][EURECOM.patch: V2