You are not logged in.
Hi
I would like to patch a /usr/include/linux/xxx.h kernel file as part of my PKGBUILD before starting the compilation of my custom module.
Clearly i need to be root for this.
how can this be done (in a better way)?
TIA
Offline
You want to patch a file on the host system, or in your package's source tree? The former absolutely cannot be done - and if you ever tried to do it, you should catch no end of crap for doing so.
The latter is trivial ... to the point that I'm not sure what the question really is: read `man patch`. If you need more than that, don't obscure what the file is: post your PKGBUILD and your actual goal.
EDIT: also if you are thinking of the former, this is almost certainly an X-Y question. The headers on the host system are matched to the kernel code. If there is an actual error in one of them, it should be reported upstream to be fixed. If it is not an error, then there is absolutely nothing that you could patch into a header file that would change functionality in any way that wouldn't be easier to add to your own code or your own projects local header file(s). So what are you really trying to do?
Last edited by Trilby (2021-10-29 20:31:21)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
If it's the former, you would really need to make your own kernel package for that.
Online
/usr/include/linux/* are the sanitized headers for userspace from the linux-api-headers package. You need to point your module to the source tree of the kernel you are building for, commonly using the -C option e.g.
make -C /usr/lib/modules/5.14.15-arch1-1/build/ M=$PWDSee also https://www.kernel.org/doc/html/latest/ … dules.html
Last edited by loqs (2021-10-29 20:31:34)
Offline
So what are you really trying to do?
I am trying to include this patch in my system.
Apparently the two files to be modified are part of the linux-lts-headers package on my system.
I would like to patch this file as a part of a PKBUILD file.
Offline
If you are patching files in the linux-lts-headers package, you'd do that in the linux-lts-headers PKGBUILD.
But I still don't see *why* you want to patch the linux-lts-headers files to build your module. The linux-lts-headers are shared, and you are including code in them that is only used by your module, right? So just include those structs, defines, and typedefs in your own project's code.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline