main/openrc: `hwdrivers` fails for devices lacking `modalias`
The implementation of /etc/init.d/hwdrivers
is pretty straightforward: it searches /sys
for all devices with a modalias
and ensures that modprobe
is told to load the modules with those aliases. This is meant to complement mdev
, by ensuring that drivers are loaded for the devices that were not hotplugged (i.e. present before userspace came up).
Unfortunately, I have found that there are a few bus types whose devices don't have dedicated modalias
files, despite having MODALIAS
in their uevents (this is not an exhaustive list):
- CPUs (under
/sys/bus/cpu
) - Ethernet PHYs (under
/sys/bus/mdio_bus
) - MMC devices (under
/sys/bus/mmc
) - AMBA devices (under
/sys/bus/amba
)
That last one is crucial: I am running Alpine on a SoC with a PL330 DMA controller, which is a dependency for some other peripherals to work properly (but is not required for boot). Since hwdrivers
cannot automatically load its driver, the other peripherals are broken on a default installation of Alpine. (echo add > /sys/.../uevent
is a viable workaround; it provokes mdev
to load the necessary module.)
To fix this, I believe that we could:
- Work with the Linux folks to ensure that
.../modalias
is consistently present across all bus types. And/or: - Rework
hwdrivers
to:- Look only under
/sys/devices
(not/sys
) - Parse
.../uevent
for^MODALIAS=.*
when.../modalias
is missing
- Look only under
I'm willing to do either of these (or perhaps a third option I hadn't thought of) myself; I just wanted to discuss the direction before I got cracking.
Thoughts?