I'm creating a program that interacts withkernel headers. The user can provide a path to the location of the headers, but first I would like to be able discover existing kernel headers on the users's machine based on convention. This apparently varies between distributions and tools. I know technically linux is fully customizable but I'm trying to understand what conventions apply to the mainstream distros:
- who creates /lib/modules/$version and when?
- are there guidelines for the structure of /lib/modules besides the /kernel and /extra subdirectories?
- are /build and /source expected to always exist under /lib/modules? (both of them?)
- is it acceptable that /build and /source are sometimes symlinks and sometimes not?
- does the headers and source come together? I've noticed that most distros offer a kernel headers or kernel development package. how is this related?