Clone
1
OpenAirKernelSetups
Cedric Roux edited this page 2016-01-17 19:13:39 +01:00

---+ Setting up Open-Air-Interface Kernels

---++ HOW-TO create a 2.6.20 SMP kernel with RTAI3.5-cv from scratch

Based on :

  • Ubuntu 6.06 (Dapper Drake) Operating System
  • Default GCC version (4.0.3) Informations :
  • In this paper, each line starting by "-" is a command to be executed inside a terminal

---++++ Introduction

#Some tools are required in order to set up the kernel (You need to be connected to Internet)
- apt-get install build-essential qt3-apps-dev qt3-dev-tools

#All following commands have to be executed as Root user

---++++ I - Source downloads

  • cd /opt
    #Get the 2.6.20 kernel source
    - wget ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
    #Get the RTAI 3.5-cv source
    - wget https://www.rtai.org/RTAI/rtai-3.5-cv.tar.bz2
    #Get the BIGPHYSAREA 2.6.20 patch (You can find it attached at the bottom of the page)
    - cp /usr/sradio/SOFTWARE/KERNEL/bigphysarea-for-2.6.18-and-2.6.20-kernels/bigphysarea-2.6.20.1.patch . https://www.rtai.org/RTAI/rtai-3.5-cv.tar.bz2%3Cbr%20/%3E#Get][#Get the Patch for 2620 OpenAirInterface ARP code (You can find it attached at the bottom of the page) ---++++ II - Kernel Preparation

We place sources in /usr/src
- cd /opt
- cp linux-2.6.20.tar.bz2 rtai-3.5-cv.tar.bz2 bigphysarea-2.6.20.1.patch /usr/src
- cd /usr/src/

Source preparation
- tar xjvf linux-2.6.20.tar.bz2
- tar xjvf rtai3.5-cv.tar.bz2
- rm linux
- ln -s linux-2.6.20 linux
- cd linux
# RTAI patch
# If you want first to simulate the patch application, use "--dry-run" between "-p1" and "-b"
- patch -p1 -b <../rtai-3.5-cv/base/arch/i386/patches/hal-linux-2.6.20-i386-1.8-04.patch
# No Hunks should appear

#BigPhysarea Patch
- patch -p1 -b <../bigphysarea-2.6.20.1.patch
# No Hunks should appear

#OpenAirInterface 2620 ARP code patch
- patch -p1 -b <../driveropenair2620.patch
# No Hunks should appear

We configure the kernel
- make oldconfig
- make xconfig

  • General Setup
    • Kernel .config Support -> ENABLE
      • Enable access to .config through /proc/config.gz -> ENABLE
    • Loadable Module Support
      • Module Versioning Support -> DISABLE
  • Processor type and features
    • Processor family -> SELECT YOURS
    • Symmetric multi-processing support -> ENABLE
    • Interrupt Pipeline -> ENABLE
    • Maximum number of CPUs -> MATCH YOUR CONFIG
    • SMT Scheduler Support -> DISABLE
    • Multi-Core Scheduler Support -> DISABLE
    • User Register Arguments -> DISABLE
    • Support for Bigphysarea -> ENABLE
    • Support for Hot-pluggable CPUs -> DISABLE
  • Power Management options (ACPI, APM)
    • Power Management Support -> ENABLE
    • All features underneath -> DISABLE
    • ACPI Support
      • ACPI Support -> ENABLE
      • All features underneath -> DISABLE
    • APM NIOS Support -> DISABLE ALL
    • CPU Frequency scalling -> Let by default
  • Bus Options (PCI, PCMCIA, EISA, MCA, ISA)
    • PCCARD (PCMCIA/CardBus) Support -> All "bridge support" in MODULE
  • Device Drivers
    • Graphics Support
      • VESA VGA Grapphics Support -> ENABLE
  • Networking
    • Networking Support
      • Networking options
        • Ipsec User Configuration Interface -> ENABLE
        • PF_KEY socket -> ENABLE

Save and Quit

#Edit the "Makefile" and update the "EXTRAVERSION" field
- vi Makefile
#Update the following field -> "EXTRAVERSION = .openairinterface"

#Set kernel maintainer informations (optional)
- vi /etc/kernel-pkg.conf
# Update fields : "maintainer" and "email"

---++++ III - Kernel Compilation

  • make && make modules_install && make_install (~1 hour)
    - mkinitramfs -o /boot/initrd.img-2.6.20.openairinterface 2.6.20.openairinterface
    - update-grub

#We place all kernel modules at the same place so we can use modprobe command

  • cp -r /usr/src/linux/modules/* /lib/modules/2.6.20.openairinterface/
  • depmod -a

If you want to be sure that your new kernel will be the default one
- vi /boot/grub/menu.lst
#Look for "default" 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=2048"
# OPTIONAL - Just after "bigphysarea=2048" on the same line you can add "vga=792" in order to have informations about the boot and shutting down sessions

#save and quit
- reboot

---++++ IV - RTAI installation

#Make sure you booted on your new kernel
- uname -a

#We start to configure RTAI
- cd /usr/src/rtai-3.5-cv
- make xconfig

  • Machine (x86) -> UPDATE the CPUs number according to your configuration #Save and quit. If any error occurs here, solve it and repeat this "make xconfig" step until it's OK
    - make && make install && make dev

#Avoid loss of "dev" at each reboot
cp makeRTF.sh /etc/init.d/ ## File available at the bottom of the page
chmod 755 /etc/init.d/makeRTF.sh
ln -s /etc/init.d/makeRTF.sh /etc/rc2.d/S99makeRTF

#We will test the RTAI system via 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 40 000us
#If not go to paragraph V, otherwise the kernel setup has been successfully achieved

---++++ V - RTAI: High latencies with SMI not disabled

#If you had bad results before, you need to disable SMI (System Maintenance Interrupt) which is a real-time killer largely spread on motherboard with Intel chipsets.
#For that, you should edit /usr/src/rtai-3.5-cv/base/arch/i386/calibration/smi-module.c
- vi /usr/src/rtai-3.5-cv/base/arch/i386/calibration/smi-module.c

  • "int smiReset" should be equals to 1
  • "#define CONFIG_RTAI_HW_SMI_ALL" should be set to 1
    #Save and quit
    - cd /usr/src/rtai-3.5-cv
    - 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 40 000us

#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/include/linux/pci_ids.h | grep 0x$i | cut -d ' ' -f 2 | cut -f1; done
#Copy the result

#Then, we update RTAI sources
- vim /usr/src/rtai-3.5-cv/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.5-cv
- 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 module loaded

#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 40 000us

-- User.RaymondKnopp][User.PhilippeFoubert - 10 Dec 2007