简体   繁体   中英

How to enable CONFIG_PREEMPT option in Linux kernel?

I am new bee in Linux kernel programming, trying to work with an old kernel Linux 2.6.32 on x86_64. I want to enable the CONFIG_PREEMPT option in it but can not find information about how can I do it. I can compile a new kernel with my preferred options, but do not know what I need to do in this case. So can anyone please tell me

How can I enable CONFIG_PREEMPT option? Do I need to recompile the kernel again with new menuconfig? In that case which option is responsible for CONFIG_PREEMPT?

I think it's trivial for anyone who worked with this before, so please give me your valuable help!

You can use make menuconfig to enable CONFIG_PREEMPT for the kernel; just select it from the menu options. To verify that it's enabled, check the .config file generated by make menuconfig for the following line:

CONFIG_PREEMPT=y

You can also make the modification by hand if you prefer ( make menuconfig is simply a GUI to create the .config file).

Once everything is configured, recompile the kernel with the usual:

make && make modules_install && make install

If you want to add fully optimized kernel, you need to add a patch, which can be downloaded from the main website here
If you don't know how to add a patch, just go through this thread.

One can often install a corresponding package, such as the linux-image-4.19.0-12-rt-amd64-unsigned on Debian

apt install linux-image-4.19.0-12-rt-amd64-unsigned
grep PREEMPT /boot/config-4.19.0-12-rt-amd64
sync && reboot

grep PREEMPT /proc/version
Linux version 4.19.0-12-rt-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP PREEMPT RT Debian 4.19.152-1 (2020-10-18)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM