Search code examples
debian

How to incorporate RT patches into Linux source code and compile them?


I want to incorporate the RT patch into the Linux source code and compile it, but encountered some difficulties.

Frist,I encountered many failures when importing RT patches.

Second, Ignore these failures, executing make menuconfig did not find Preemption Mode: Fully Preemptible Kernel (RT).

The same issue applies to using Linux kernels in versions 6.0.5 and 6.4.6.

debian12@Debian12:~/kernel/6.0.5/linux-6.0.5$ ls ..
linux-6.0.5  linux-6.0.5.tar.gz  patch-6.0.5-rt14.patch
debian12@Debian12:~/kernel/6.0.5/linux-6.0.5$ ls
arch   COPYING  Documentation  include   ipc      kernel    MAINTAINERS  net       –p1.rej  scripts   tools
block  CREDITS  drivers        init      Kbuild   lib       Makefile     –p1       README   security  usr
certs  crypto   fs             io_uring  Kconfig  LICENSES  mm           –p1.orig  samples  sound     virt
debian12@Debian12:~/kernel/6.0.5/linux-6.0.5$ patch –p1 <../patch-6.0.5-rt14.patch
....
patching file –p1
Hunk #1 FAILED at 135.
Hunk #2 FAILED at 162.
Hunk #3 FAILED at 187.
Hunk #4 FAILED at 201.
4 out of 4 hunks FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 6555.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 934.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 1684.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 1508.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 2316.
Hunk #2 FAILED at 2384.
2 out of 2 hunks FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 1079.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 2296.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 1534.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 715.
1 out of 1 hunk FAILED -- saving rejects to file –p1.rej
patching file –p1
Hunk #1 FAILED at 205.
Hunk #2 FAILED at 1136.
2 out of 2 hunks FAILED -- saving rejects to file –p1.rej

I would like to know:

  1. Is it normal to have so many failures when importing patches?
  2. Why can't I find the Preemption Mode: Fully Preemptible Kernel (RT) option?

Solution

  • I have solved my problems:

    #1 I use linux-5.14.2.tar.gz and patch-5.14.2-rt21.patch, No errors were reported when inserting the patch.

    #2 First executemake menuconfig, then I enabled EXPERT (General Setup -> Embedded System) mode and see the option "Fully Preemptible Kernel (Real-Time)" under General Setup -> Preemption Model.