How to enable CONFIG_RT_GROUP_SCHED in Ubuntu to make it RT

主宰稳场 提交于 2019-12-11 08:33:08

问题


I need to run real time applications on Ubuntu RT Linux and was reading about ways to make linux act as RT system and I learned two ways to do it

  1. preemptive_rt kernel patching
  2. enabling CONFIG_RT_GROUP_SCHED flag in the kernel.

I've already tried my hands on 1st method Install RT Linux patch for Ubuntu

However, apart from uname -r showing #1 SMP PREEMPT RT I've no other proof that it is actually a RT system and hence want to try the 2nd method. Enable CONFIG_RT_GROUP_SCHED flag in the kernel and see its performance.

I read we can confirm if the kernel already has the flag by following command:

# zcat /proc/config.gz | grep RT_GROUP

CONFIG_RT_GROUP_SCHED=y

However, my system doesn't even have the config.gz file in proc, so I believe my kernel does not have this enabled. I'm relatively new to linux kernels so this might be naive but how can I enable this in the kernel?


回答1:


Step 1
Download linux kernel from https://www.kernel.org/pub/linux/kernel/. For the purpose of this PoC we downloaded linux-4.16.18.tar.gz kernel from above link.

Step 2 Unzip the kernel

$ tar -xzvf linux-4.16.18.tar.gz

Step 3

Move to kernel source directory

$ cd linux-4.16.18

Step 4

Install kernel build dependencies

$ sudo apt install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache bison flex

Step 5

Run kernel configuration

$make menuconfig

Step 6

Go to General setup ─> Control Group Support ─> CPU controller ─> Group scheduling for SCHED_RR/FIFO configuration as shown below:

Go to General setup ─> Kernel .config support and enable access to .config through /proc/config.gz

Step 7

Compile the kernel

$ make -j20

Make modules & install

$ sudo make modules_install -j20
$ sudo make install -j20

Step 8

Open the grub.cfg file to verify if kernel is installed

$ vim /boot/grub/grub.cfg

Look for the menuentry with menuentry 'Ubuntu, with Linux linux-4.16.18'

If it's not your default kernel then change the GRUB_DEFAULT=0 value to your kernel

Step 9

Reboot your system

sudo reboot

Step 10

Verify the system by the following command:

# zcat /proc/config.gz | grep RT_GROUP

CONFIG_RT_GROUP_SCHED=y


来源:https://stackoverflow.com/questions/56189710/how-to-enable-config-rt-group-sched-in-ubuntu-to-make-it-rt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!