I’ve attempted to building custom kernel following Building a Custom Kernel :: Fedora Docs with zen-kernel patch. It sucessfully built without kernel-headers package because they are being split out into a separate package called kernel-headers. However, CentOS and EL were not.
Is there any reason why split it into a separate package? Does it provide any advantages?
The kernel-headers contains include files for compiling regular programs, and it is installed as a dependency if you install the C compiler. The headers files in kernel-headers doesn’t change in a significant way between minor kernel versions, and therefore there is no reason to update it for every kernel update.
For compiling kernel modules, you need to install kernel-devel which must match the current kernel version. The kernel-devel provides all the header files needed for building kernel modules.
FWIW, I a few years ago wrote a blog post about the topic that might help explaining things:
“”“TLDR: The kernel-headers packages in Fedora, RHEL, or CentOS do not carry the files you get by installing linux-headers-$(uname -r) on Debian based distros. If you want to build add-on modules for the kernels in Fedora, RHEL, or CentOS, you need to install kernel-devel instead. Fun fact: I consider both approaches to package naming flawed.”“”