I want to apply a patch file to my current Ubuntu install (patch file example). What is the process to properly apply a patch file to my Linux kernel?
Do I need to go through the whole process of applying the patch to a disk image file, flashing that to a USB and installing a new copy of Linux? Can I just patch the current install? Or can I patch a disk image and then use that to upgrade my current install?
What I've tried:
Figure out which kernel version I'm running:
$ uname -srm Linux 5.11.0-25-generic x86_64
Go to my kernel directory (I think):
cd /lib/modules/5.11.0-25-generic/kernel
Apply the patch file
patch -p1 < ~/my-patch-file.patch
But no patch is applied. The output is:
can't find file to patch at input line 23
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
...
File to patch:
What is the right way to do this?
Note: this question is different than how to patch any random file. I know how to do that. The question is specifically about how to patch the currently installed kernel.