Page 1 of 1

Why is Linux Loading Certain Modules Automatically?

Posted: Thu May 24, 2018 9:43 pm
by kengineer
I have a couple of custom modules in my modified linux-at91 kernel. I am using the Yocto system based on the Microchip build to generate a rootfs image. When running off this image, I am finding that my custom modules specifically are automatically loaded at boot time. To clarify, these are configured in the kernel to build as LKMs, not as builtin modules.

I have not specified this anywhere (such as through the KERNEL_MODULE_AUTOLOAD variable in the layers). Also, these specific modules do not have specific entries in "/etc/modules-load.d" - in fact, I cannot even find a reference to how/why they are being loaded by the kernel. I can manually modprobe them, but I do not want them being automatically loaded the way they are currently.

Re: Why is Linux Loading Certain Modules Automatically?

Posted: Fri May 25, 2018 11:15 pm
by blue_z
kengineer wrote:I have a couple of custom modules in my modified linux-at91 kernel.
Care to provide more details, i.e. what kind of functionality do these modules provide?

kengineer wrote:I am finding that my custom modules specifically are automatically loaded at boot time. To clarify, these are configured in the kernel to build as LKMs, not as builtin modules.
A module that is a device driver (and that driver is specified in the Device Tree blob) can be autoloaded (although there seems to be exceptions).

Regards

Re: Why is Linux Loading Certain Modules Automatically?

Posted: Sun May 27, 2018 12:31 am
by kengineer
These are both i2c drivers for separate input based devices. The first is a stand alone i2c input driver that handles everything including input device binding. The second module acts as an i2c driver that works with another module which actually provides the input device binding (and that input interface is not being autoloaded).

Yes I was wondering if device tree was the reason behind this. Both have device tree bindings under the respective i2c bindings in the tree. If this is the reason, is there a simple way to prevent them from autoloading?

Re: Why is Linux Loading Certain Modules Automatically?

Posted: Tue May 29, 2018 1:29 am
by blue_z
kengineer wrote:If this is the reason, is there a simple way to prevent them from autoloading?
Did you try blacklisting the module(s)?

Regards

Re: Why is Linux Loading Certain Modules Automatically?

Posted: Wed Jun 13, 2018 4:52 pm
by kengineer
This article says that the autoloading mechanism is caused by the driver adding its id as a device table through the MODULE_DEVICE_TABLE() macro and then being found in the device tree:


https://lwn.net/Articles/448502/


However I tried removing that from my drivers and found they are still being autoloaded. Blacklisting is a good idea and that will work for me thanks.