Why is Linux Loading Certain Modules Automatically?

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

kengineer
Posts: 15
Joined: Tue Oct 31, 2017 3:08 pm

Why is Linux Loading Certain Modules Automatically?

Thu May 24, 2018 9:43 pm

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.
blue_z
Location: USA
Posts: 1704
Joined: Thu Apr 19, 2007 10:15 pm

Re: Why is Linux Loading Certain Modules Automatically?

Fri May 25, 2018 11:15 pm

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
kengineer
Posts: 15
Joined: Tue Oct 31, 2017 3:08 pm

Re: Why is Linux Loading Certain Modules Automatically?

Sun May 27, 2018 12:31 am

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?
blue_z
Location: USA
Posts: 1704
Joined: Thu Apr 19, 2007 10:15 pm

Re: Why is Linux Loading Certain Modules Automatically?

Tue May 29, 2018 1:29 am

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
kengineer
Posts: 15
Joined: Tue Oct 31, 2017 3:08 pm

Re: Why is Linux Loading Certain Modules Automatically?

Wed Jun 13, 2018 4:52 pm

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.

Return to “LINUX”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests