ataraxis
ataraxis

Reputation: 1582

Are builtin driver always prioritized over loadable modules?

According to this note:

When multiple built-in modules (especially drivers) provide the same capability, they're prioritized by link order specified by the order listed in Makefile.

Furthermore:

However, the order in this file is indeterministic (depends on filesystem listing order of installed modules). This causes confusion.

The solution is two-parted. This patch updates kbuild such that it generates and installs modules.order which contains the name of modules ordered according to Makefile.

What happens if a system has multiple drivers providing the same capabilities from which some are built-ins and others are loadable modules?

Which one is prioritized in this case? Is it always the built-in? And how can I change the priority (if this is possible)?

I thought about reordering them in modules.alias or modules.order but this wouldn't work I guess since built-ins are not listed there - right?

Upvotes: 5

Views: 741

Answers (2)

ataraxis
ataraxis

Reputation: 1582

I found the answer in the meanwhile.

To make a long story short: Yes, builtin drivers are in general prioritized over loadable drivers. Just because they are registered first and "first comes first serves" principle while binding.

Upvotes: 3

user2526111
user2526111

Reputation: 474

I don't think there is priority. If you have same drivers instances (one is from builtin and the other from kernel module), eventually you will be ended up with compilation error or module loading error since duplicate definition or something.

If you have "DIFFERENT" drivers on the same hardware, not sure why you are doing that??

Also, if somebody already probed and created devices, the later one cannot do the same thing since there will be conflict.

If you are simply asking "precedence" between builtin module and LKM, definitely, builtin module will be first. Kernel module are sitting on different memory location than kernel. So, LKM is loaded later than kernel.

So, if you are loading the same driver with two different ways at the same time, LKM will have problem because of conflict.

Upvotes: 0

Related Questions