Specifying the kernel booting modules loading order

Tags:

After upgrading to madwifi svn (now released 0.9.3), I found I encountered maybe a seldom problem: the linux kernel module loading order.

In the latest madwifi, it provides three different rate control algorithms, ONOE, AMRR and SAMPLE, instead of only SAMPLE in the previous version. Though SAMPLE is the most advanced one and is used by default, the other two must have ability to take over it’s job. So modules dependency relationship can’t be hardcode into source. But when you insert these modules to /etc/modules for kernel loading when booting, the kernel will take ath_pci first, which depends on ath_rate_sample or other rate control modules. So, the ath_pci can’t be loaded completely success but was still loaded, and reports:

Unable to load needed module: ath_rate_sample; no support for automatic module loading<3>Error loading module “ath_rate_sample”

Then, if you still want to use it, you must reload ath_pci manually, for ath_rate_sample is loaded after ath_pci, but the former didn’t know it, and it can’t specify ath_rate_sample as its depend modules for this can be specify when it was loading.

UPDATE: Thank Matt tell me the real reason: The “automatic module loading” wasn’t open when we compiling the kernel (and in fact error message tell me of that clearly…).
So, please recompile your kernel with “automatic modules loading”(CONFIG_KMOD=y), and recompile your madwifi modules with your new kernel. Then try to load it normally. It’s more useful…
It seems silly to try to load these modules manually… I’m sorry…

SO PLEASE FORGET THE THING BELOW EXCEPT YOU REALLY ENCOUNTER SOME UGLY MODULES…

The only method to solve this is to specify the kernel modules loading order, but the loading order seems can’t be specify simply by /etc/modules (I checked module-init-tools, but don’t understand why it don’t load the modules by order — it meant to do it…). So I add a script in /etc/init.d/ to do this, and link it to /etc/rcS.d/S21load-madwifi.sh(just after module-init-tools)

1 #!/bin/bash
2 #load-madwifi.sh
3
4 modprobe -r ath_pci
5 modprobe -r wlan_tkip
6 modprobe -r wlan_scan_sta
7 modprobe -r ath_rate_sample
8
9 modprobe ath_rate_sample
10 modprobe wlan_scan_sta
11 modprobe wlan_tkip
12 modprobe ath_pci

If you are a debian user, you can simply use:

sudo modconf –load-before ath_rate_sample –load-before \
wlan_scan_sta –load-before wlan_tkip –load-only ath_pci

That’s it.

4 Responses to “Specifying the kernel booting modules loading order”

  1. Matt Says:

    I’ve found that if you recompile the kernel with automatic module loading, then recompile the madwifi modules against that kernel you will solve the issue of “no support for automatic module loading”. Just recompiling the kernel with this option and not the madwifi modules causes the same issue, you’ll need to recompile both. Hope this helps.

  2. yasker Says:

    Thank you very much! I did found that I miss the automatic module loading when compiling my kernel. It seems so silly for me to try load the modules manually….

    But I am a little puzzle… The automatic module loading is off, but why the other modules can be load automatically…

  3. Jascha Says:

    I think there is a diffrence between “automatic module loading” and the loading by dependencies while loading.

    so if mod a depends on mod b, mod b gets loaded before mod a is loaded.

    but these modules here require an other module (or a function from it) after it is loaded, you need this option.

    could that be? ;)

  4. yasker Says:

    en…

    I am thinking of why modconf can load some dependent modules… I checked the help of this option in kernel building, and it seems like modprobe dependent on this option. But the modconf? I don’t know why…

    Anyway, not make this option enable is curious… I may check the detail later…

    Thanks for idea. ;-)

Leave a Reply