where is headers_install in KBUILD

valdis.kletnieks at vt.edu valdis.kletnieks at vt.edu
Mon Feb 25 12:54:36 EST 2019


On Mon, 25 Feb 2019 06:43:39 -0500, YU Bo said:

> But, my "question" is:  when i test some program which needs kernel headers,
> where to install those headers file?
> In Documention/kbuild/headers_install.rst, i learn it :
> 	make headers_install INSTALL_HDR_PATH=/usr
> In my case, Is it ok to do that?I do not think it will work.

You need to put the headers into a directory that will be accessible to your
"program that needs kernel headers" at build time. Hint: gcc has a "-I" option
for a reason, and CFLAGS is an actual thing for a reason....

Note that in general, most programs *won't* need the new kernel headers,
because glibc (or musl, or whatever your libc is) will be insulating you from
the actual syscall interface anyhow.

Also, dropping the headers into /usr/include is dangerous, as the next time
you apply software updates, they could overlay your version of the headers
with the distro's version, which will cause lots of debugging fun the next time
you rebuild your program and it builds against old headers.  If you're lucky,
the build will fail.  If you're unlucky, the program will build but fail in subtle
ways at runtime....



More information about the Kernelnewbies mailing list