0

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:

  1. who creates /lib/modules/$version and when?
  2. are there guidelines for the structure of /lib/modules besides the /kernel and /extra subdirectories?
  3. are /build and /source expected to always exist under /lib/modules? (both of them?)
  4. is it acceptable that /build and /source are sometimes symlinks and sometimes not?
  5. 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?

1 Answer 1

1
  1. Normally make modules_install but of course distros just package all these modules.
  2. This looks like a Debian/Ubuntu thing. depmod just traverses all the subdirectories under /lib/modules/$version
  3. For Fedora/RHEL/CentOS or the Linux kernel installed from source - the answer is yes.
  4. Normally they are always symlinks
  5. Almost never. There are kernel development headers which are required to build modules, and most distros don't even offer the option of installing the kernel source - it doesn't make a lot of sense for the end user.

Instead of reinventing the wheel, I'd recommend that you take a look at kernel modules build systems offered by VirtualBox, NVIDIA or VMWare. They are well tested and support dozens of distros.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .