Go Premium for a chance to win a PS4. Enter to Win


How to find out if a patch is already applied into the kernel? And how to apply a patch to the kernel?

Posted on 2004-06-25
Medium Priority
Last Modified: 2013-12-16

I've updated the source code of kernel 2.4.xxx -- actually I updated the file param.h to enhance the resolution of the timer by changing the HZ (from 100 to 1000) to make the resolution of 1ms granualarity of 1 ms.

I searched the web and found that I must apply a patch if I did this. Here is the info:


about this patch. I don't know if this patch has been applied to my kernel or not (Red Hat Enterprise AS 3.0). If not, I've to apply it.

If you know how to check if a patch has been applied to the kernel or not, please help. Any suggestion would be appreciated.
And then, in the case I've to apply the patch, how can I do it?


Question by:rfr1tz
  • 2
LVL 40

Expert Comment

ID: 11402310
I think you'd have to examine the kernel source for what the patch changes. I know that RedHat includes a number of patches in their kernels, so you probably can't use that patch "as is" and would have to manually apply the changes that the patch introduces.

Author Comment

ID: 11402695
Hi jlevie,

Thanks for the reply. May you give more info about these?

(1) In case that I'd to get the patch, do you know where I can get it? Can we get it as we get an rpm or something else?

(2) For this patch, you mentioned that I should apply it manually. Can you give me an example of this?


LVL 40

Accepted Solution

jlevie earned 800 total points
ID: 11403399
The actual patch is towards the bottom of the URL above. It's the part that begins with:

diff -urN linux-2.4.20-pre10-ac2/arch/i386/config.in linux/arch/i386/config.in
--- linux-2.4.20-pre10-ac2/arch/i386/config.in      2002-10-14 01:43:05.000000000 -0400
+++ linux/arch/i386/config.in      2002-10-14 18:24:48.000000000 -0400

One would save that to a file, change dirs to /usr/src/linux-2.4, and then do 'patch -p1 <patch-file. But, that would assume that you were using the kernel.org kernel sources for 2.4.20. The patch is "indexed" against the sources by line numbers. Those almost certainly won't be the same in the kernel.org sources and what RedHat uses on RHEL 3.0 AS. Furthermore, switching to kernel.org sources will loose all of the optimizations and bug fixes that RedHat has applied, and would be a really bad idea.

The process of manually applying a patch is one of looking at the contex diff in the patch, figuring out what those changes do, and then looking at your sources to determine if the same code changes will work or if minor changes will be needed to the patch. This isn't usually something that one un-familiar with kernel code should attempt. It really, really easy to break the kernel so that it won't boot,  or even worse brreak in such a way as to cause the kernel to fail occasionally when otherwise running normally.

If you really, really, must have 1khz jiffies in RHEL 3.0 AS I'd suggest that you consider talking to RedHat about getting it done under a consulting contract.

Assisted Solution

pYrania earned 200 total points
ID: 11600162
cd /usr/src/linux
patch -N -p1 <patchfile>

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month7 days, 6 hours left to enroll

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question