Hardware detection and load linux kernel modules


I’m new here and with golang.
I tested some simple scripts before and now try to convert some linux shell commands to golang.

At the moment I try to initialize hardware by detect and load kernel modules needed.

Here is a bash example how to load kernel modules needed by the hardware.

grep -h MODALIAS /sys/bus/*/devices/*/uevent | cut -d= -f2 | xargs /sbin/modprobe -abq 2> /dev/null

I now try to do it with GO or just detect the correct nic and hdd drivers.
It’s needed to use network connection and mount a hdd partition.

1 Like

Have found u-root. It includes modprobe. Tested and works fine.

But how detect the needed kernel modules to initialize hardware / load modules?

I haven’t been using these stuff but you may try this:

Thanks! I know ghw. At the moment it only can discover gpu drivers, but not all / nic / hdd.

I haven’t found examples how to to that job with golang and tools I found not support the needed options to do it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.