Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
471 views
in Technique[技术] by (71.8m points)

kernel - Install RT Linux patch for Ubuntu

Trying to make my generic Ubuntu to real time Ubuntu by modifying the kernel by patching / installing RT Linux but couldn't find a straight setup. Can someone help with the steps?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Step 0 - Make a working directory

Make a working directory

#Move to working directory
mkdir ~/kernel && cd ~/kernel

Step 1 - Download kernel and patch

Go to https://www.kernel.org/pub/linux/kernel/ and download a desired version of kernel to ~/kernel. Similarly, go to https://www.kernel.org/pub/linux/kernel/projects/rt/ and download the RT patch with same version as the downloaded kernel version. The kernel and patch I used were linux-4.9.115.tar.gz and patch-4.9.155-rt93.patch.gz.

Step 2 - Unzip the kernel

tar -xzvf linux-4.9.115.tar.gz

Step 3 - Patch the kernel

#Move to kernel source directory
cd linux-4.9.115
gzip -cd ../patch-4.9.115-rt93.patch.gz | patch -p1 --verbose

Step 4 - Enable realtime processing This step requires libncurses-dev

sudo apt-get install libncurses-dev libssl-dev

The next command launches a graphical menu in the terminal to generate the config file.

make menuconfig

Go to the location and make the changes accordingly

##Graphical Menu##

Processor type and features ---> [Enter]
Preemption Model (Voluntary Kernel Preemption (Desktop)) [Enter]
Fully Preemptible Kernel (RT) [Enter] #Select

[Esc][Esc]

Kernel hacking --> [Enter]
Memory Debugging [Enter]
Check for stack overflows #Already deselected - do not select


[Esc][Esc]


[Right Arrow][Right Arrow]

<Save> [Enter]

.config

<Okay> [Enter]

<Exit> [Enter]


[Esc][Esc]


[Right Arrow]
<Exit> [Enter]

Step 5 - Compile the kernel

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

Step 6 - Verify and update Verify that initrd.img-4.9.115-rt93, vmlinuz-4.9.115-rt93, and config-4.9.115-rt93 are generated in /boot directory and update the grub.

cd /boot
ls
sudo update-grub

Verify that there is a menuentry containing the text "menuentry 'Ubuntu, with Linux 4.9.115-rt93'" in /boot/grub/grub.cfg file

To change default kernel in grub, edit the GRUB_DEFAULT value in /etc/default/grub to your desired kernel.

NOTE: 0 is the 1st menuentry

7 - Reboot and verify

sudo reboot

Once the system reboots, open the terminal and use uname -a to check the kernel version, it should look like the following

Linux abhay-home 4.9.115-rt93 #1 SMP PREEMPT RT Mon May 13 03:32:57 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Note: "SMP PREEMPT RT" validates that your system is running real time kernel.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...