Automatic Kernel Module Selection

Self identifying busses, like PCI and USB, have device identification that the kernel uses to bind drivers to hardware. Since each bus uses different terminology, I'll be calling this data PNP data here, even though it isn't exactly the old-school ISA PNP thing. The big problem, however, is that nothing looks at that data to allow us to selectively load .ko files at boot (or later when the device arrives).

This project aims to fix that. The basic sketch is that linker.hints already contains information about the kernel modules in the system. It has been enhanced to record PNP tables in linker.hints to allow easy access by the kernel, the boot loader and the running system. This requires that the drivers "decorate" their PNP data in a certain way so that kldxref can find it and record it in linker hints. ISA, PC Card and USB are done. PCI, ACPI and FDT/OFW are in progress.

There's a new program called 'devmatch' which looks at all unattached devices on the system and compares their plug and play data to that which has been recorded by kldxref and suggests modules to load. The system isn't perfect, nor is it designed to be perfect. There are a few rare cases where a couple of different drivers might bind to the same device (old rl and re cards, for example, have the same PCI device ID, but have different device specific version registers that these drivers use to select who will win).

Watch this space for more coming soon. We still need the devd glue for nomatch devices, as well as a bootup script to load all the modules in one go for efficiency.


AutoLoad (last edited 2018-07-21T03:44:03+0000 by MarkLinimon)