The Linux Kernel contains a make target that installs “sanitized” kernel headers.
For this step you will need the kernel tarball.
Install the kernel header files:
make mrproper make headers_check make INSTALL_HDR_PATH=/usr headers_install find /usr/include -name .install -or -name ..install.cmd | xargs rm -fv
The meaning of the make commands:
Ensures that the kernel source dir is clean.
Sanitizes the raw kernel headers so that they can be used by userspace programs.
make INSTALL_HDR_PATH=/usr headers_install
This will install the kernel headers into
find /usr/include -name .install -or -name ..install.cmd | xargs rm -fv
Removes a number of unneeded debugging files that were installed.