3 ms·
I really enjoyed this article. However the following passage seemed a bit hand-wavy to me: >"How will our userland program know which kernel modules to load? L
by bogomipz 7y ago
I really enjoyed this article. However the following passage seemed a bit hand-wavy to me:
>"How will our userland program know which kernel modules to load? Linux kernel modules declare patterns for their supported hardware as an alias, e.g.:"
initrd# grep virtio_pci lib/modules/5.4.6/modules.alias
alias pci:v00001AF4d*sv*sd*bc*sc*i* virtio_pci
Devices in sysfs have a modalias file whose content can be matched against these declarations to identify the module to load:
initrd# cat /sys/devices/pci0000:00/*/modalias
pci:v00001AF4d00001005sv00001AF4sd00000004bc00scFFi00
pci:v00001AF4d00001004sv00001AF4sd00000008bc01sc00i00
>"Hence, for the initial round of module loading, it is sufficient to locate all modalias files within sysfs and load the responsible modules."
Could someone elaborate on this a bit? I'm familiar with udevd. Is /sysfs enumerated first and then a match is searched for in lib/modules/5.4.6/modules.alias? Or the other way around? Are these files parsed before normal kernel PCI bus enumeration then? Any other specifics or detail would be greatly appreciated.
- secure 7y ago> Is /sysfs enumerated first and then a match is searched for in lib/modules/5.4.6/modules.alias? Yes :)