# Changing order of module loading in kernel



## j4ck (Nov 6, 2013)

I have two type of ports, em and igb. Is it possible to change the order of loading of these two modules? By default em is loaded first an then igb.
Here's the related part of GENERIC kernel:


```
# PCI Ethernet NICs.
device          de              # DEC/Intel DC21x4x (``Tulip'')
device          em              # Intel PRO/1000 Gigabit Ethernet Family
device          igb             # Intel PRO/1000 PCIE Server Gigabit Family
```


----------



## Beeblebrox (Nov 6, 2013)

No eloquently simple way AFAIK.

There's rcorder(8)(). Maybe you can leave igb in /boot/loader.conf, then write a start-up script for em, which would include loading the if_em module. Finally, specify if_igb as REQUIRE in your custom service start-up file.

Not pretty; maybe someone else will have a better idea.


----------



## ShelLuser (Nov 6, 2013)

I can't think of another way to do this, but I do wonder why you'd want to set something like this up?


----------



## phoenix (Nov 6, 2013)

May I ask why? em and igb support different NIC chipsets, so it's not like they're going to stomp on each other when detecting the NICs. And, if you don't like the order that they number the NICs, you can always rename the interfaces.

So, why does it matter which order the drivers are loaded?


----------



## wblock@ (Nov 6, 2013)

Write a shell script that runs `ifconfig` and shows the interfaces in any order you like.  Modifying a device driver for cosmetic issues is misguided.


----------



## fluca1978 (Nov 18, 2013)

j4ck said:
			
		

> I have two type of ports, em and igb. Is it possible to change the order of loading of these two modules? By default em is loaded first an then igb.



How do you know which one is loaded first?
If my memory works, there is a way to specify each driver in which _arena_ (SI_SUB_DRIVERS) has to be loaded, but there is no particular order within the same arena. This means that pretty much all drivers are loaded in the same arena and without any specific order. Therefore, there is no common way of changing the loading order of the drivers, I guess.

And I don't see any reason to do that, too.


----------

