(Buildroot) How to load modules automatically

buildrootkernel-modules

I'd like to load some additional modules at boot.

This works fine from the command line:

modprobe -a i2c-dev
modprobe -a snd-soc-pcm512x
modprobe -a snd-soc-wm8804

But I want this done at boot. I've tried creating /etc/modules, /etc/modprobe.conf and /etc/modprobe.d/i2c-dev.conf, etc. with the module name in there, but no luck.

I'm using a buildroot-2017-08, which I believes uses kmod, with a BusyBox init.

I can just create an init.d script, but I think there's a specific location that should contain the list of modules to load.

Best Answer

This depends on which init system you're using. If you have Buildroot configured to use Busybox init or SysV init, then the correct way to handle this is probably through an init script. If you have it configured to use Systemd though, you can just drop a file with a .conf extension in /etc/modules-load.d/ or /usr/lib/modules-load.d/ with each module you want loaded listed on a line by itself, and systemd will load them at boot.

Related Question