Ubuntu16.04 real-time kernel RT Preempt installation

The previous article has introduced the installation of the real-time kernel of Ubuntu 18.04, here is the specific installation of the real-time kernel of Ubuntu 16.04.

RTOS

[1 Installation dependencies] (https://cloud.tencent.com/act/anniversary?fromSource=gwzcw.3881574.3881574.3881574&utm_medium=cpc&utm_id=gwzcw.3881574.3881574.3881574&gclid=CjwKCAjwtNf6BRAwEiwAkt6UQuN_Er47B2_X6vzdNyc2vpu-SHczMwkLyYduqFy679e2mOXU2WNRqRoCGJAQAvD_BwE&from=10680)

apt-get install build-essential bc curl ca-certificates fakeroot gnupg2 libssl-dev lsb-release libelf-dev bison flex

2 Kernel version

To find the one you are currently using, use uname -r. The real-time patch is only applicable to some kernel versions, please refer to:

https://www.kernel.org/pub/linux/kernel/projects/rt/

kernel

We recommend choosing the version closest to your current use. The following command assumes the 4.14.12 kernel version with the 4.14.12-rt10 patch. If you choose another version, just replace the number. After confirming the version, use curl to download the source file:

curl -SLO https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.12.tar.xz
curl -SLO https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.12.tar.sign
curl -SLO https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patch-4.14.12-rt10.patch.xz
curl -SLO https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patch-4.14.12-rt10.patch.sign

And unzip them with the following command:

xz -d linux-4.14.12.tar.xz

xz -d patch-4.14.12-rt10.patch.xz

3 Compile Kernel

Once you are sure that the file is downloaded correctly, you can extract the source code and apply the patch:

tar xf linux-4.14.12.tar
cd linux-4.14.12
patch -p1 <../patch-4.14.12-rt10.patch

The next step is to configure the kernel:

make oldconfig

This will open a text-based configuration menu. When asked to provide a preemptive model, select a fully preemptible kernel:

Preemption Model

1. No Forced Preemption (Server) (PREEMPT_NONE)

2. Voluntary Kernel Preemption (Desktop) (PREEMPT_VOLUNTARY)

3. Preemptible Kernel (Low-Latency Desktop) (PREEMPT__LL) (NEW)

4. Preemptible Kernel (Basic RT) (PREEMPT_RTB) (NEW)

> 5. Fully Preemptible Kernel (RT) (PREEMPT_RT_FULL) (NEW)

We recommend leaving the other options at their default values. After that, you can compile the kernel. Because this is a long process, set the multithreading option -j to the number of your CPU cores:

fakeroot make -j4 deb-pkg

Finally, you are ready to install the newly created package. The exact name depends on your environment, but you are looking for headers and images packages without the dbg suffix.
sudo dpkg -i ../linux-headers-4.14.12-rt10_*.deb ../linux-image-4.14.12-rt10_*.deb
Restart the system.

4 verification#

The Grub boot menu should now allow you to select the newly installed kernel. To see which one is currently in use, look at the output of the uname -a command. It should contain the string PREEMPT RT and the version number of your choice. In addition, /sys/kernel/realtime should exist and contain the number 1.

5 Allow users to set real-time permissions for their processes#

sudo addgroup realtime
sudo usermod -a -G realtime $(whoami)

Then, add the following restrictions to the real-time group /etc/security/limits.conf:

@ realtime soft rtprio 99

@ realtime soft priority 99

@ realtime soft memlock 102400

@ realtime hard rtprio 99

@ realtime hard priority 99

@ realtime hard memlock 102400

Recommended Posts

Ubuntu16.04 real-time kernel RT Preempt installation
UBUNTU 16.04 installation diary
ubuntu 1804 installation details
Ubuntu installation record
ubuntu 18.04 installation (UEFI+GBT)
ubuntu installation error
Manual for Ubuntu Installation
Ubuntu16.04 installation partition settings
ubuntu redis php installation
Ubuntu introduction and installation
ubuntu nice font installation
Ubuntu CEPH quick installation
foreman ubuntu16 quick installation
Ubuntu 17.10 installation toss record
Ubuntu dual system installation
Github Project-OpenPose installation on Ubuntu
ubuntu view python installation path
Ubuntu16.04 installation and simple configuration
Detailed ubuntu 20.04 LTS installation record
CSI Tools installation Intel 5300 + Ubuntu 14.04
ubuntu19.04 installation tutorial (graphic steps)
Ubuntu PostgreSQL installation and configuration
ubuntu offline installation python environment