Install Real-time patch Linux step by step

  1. Get sources
    •  wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.20.tar.gz
    •  wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/patch-3.18.44-rt48.patch.gz
  2. Decompress sources
    •  tar xvf linux-3.18.20.tar.gz
  3. Patch the kernel
    •  cd linux-3.18.20
    •  zcat ../patch-3.18.44-rt48.patch.gz | patch -p1
  4. Configure kernel
    • make xconfig
      • Install qt4 if there is an error: qt4: sudo apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools 
      • If don't want to use GUI, use text instead: make menuconfig
    • General Setup
      • Timers Subsystem
        • High Resolution Timer Support (enable this)
    • Processor type and features
      • Processor famlily
        • Core 2/newer Xeon: Check your system with cat /proc/cpuinfo | grep family  if return 6 set as Generic
      • Preemption Model
        • Fully Preemptible Kernel (RT)
    • Power management and ACPI options
      • Run-time PM core functionality : Disable
      • ACPI (Advanced Configuration and Power Interface) Support
        • Processor: Disable
      • CPU Frequency scaling: Disable
    • Check some flags with search (Ctrl+F)
      • CONFIG_PREEMPT_RT_FULL: ON
      • CONFIG_STACKPROTECTOR: Regular
  5. Build kernel
    • sudo make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers -j $(nproc)
      • if there is an error about make-kpkg: sudo apt-get install kernel-package
      • Error: curses.h: No such file or directory Problem Solution -> sudo apt-get install libncurses5-dev libncursesw5-dev
  6. Install the kernel
    • cd ..  && ls   to make sure some header and image debian (.deb) files exist.
    •  sudo dpkg -i linux-headers-3.18.20-rt48_3.18.20-rt48-10.00.Custom_i386.deb
    • dpkg -i linux-image-3.18.20-rt48_3.18.20-rt48-10.00.Custom_i386.deb
  7. Update grub
    • Change boot: /etc/default/grub
    • sudo update-grub
    • check kernel image at /boot directory
  1. Boot new kernel
    • At Boot menu: Ubuntu * Advanced options for Ubuntu (Enter on it)
    • Choose RT kernel
  2. Test RT-Kernel
    • Check kernel version: uname -a       (make sure it containts PREEMPT RT)
    • Check timer: cat /proc/timer_list | grep resolution    (make sure 1 nano second resolution)
    • Run cyclictest: cyclictest  -t 0 -p 1 -n   (sudo apt-get install rt-tests)


0 Comments