You are not logged in.

#1 2011-03-19 21:53:49

neurolysis
Member
Registered: 2011-02-23
Posts: 112
Website

Different modules for different kernels in rc.conf

Is there some way to use different module sets for different kernels? I have two different kernels which I need differing modules for. Otherwise, is the patch as simple as modifying rc.multi with conditional statements for uname?

Offline

#2 2011-03-19 23:01:04

Mast
Member
Registered: 2011-01-18
Posts: 6

Re: Different modules for different kernels in rc.conf

I'm no expert by any means, but looking at /etc/rc.sysinit, it looks like it just modprobe's the names in MODULES:

# Load modules from the MODULES array defined in rc.conf
mods=${MODULES[@]/!*/}
if [[ $load_modules != off && -f /proc/modules && $mods ]]; then
    stat_busy "Loading Modules"
    /sbin/modprobe --all $mods
    stat_done
fi
unset mods

So I'm guessing you could just modify rc.multi or rc.local like you suggested.
Alternatively, if this is a more permanent setup, you might want to compile the necessary modules into the kernel.

Offline

#3 2011-03-20 02:02:14

neurolysis
Member
Registered: 2011-02-23
Posts: 112
Website

Re: Different modules for different kernels in rc.conf

Sadly compilation in-kernel isn't an option for all of them (some, but not all). I guess I will fiddle with rc.multi. Thanks!

Offline

#4 2011-03-20 13:44:21

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 68

Re: Different modules for different kernels in rc.conf

You can use "uname -s" to get the kernel version.

Put this in your rc.conf

case $(uname -s) in
  "2.6.38-ARCH") MODULES=(something) ;;
  "2.6.38-ANOTHER") MODULES=(something_else) ;;
esac

Offline

#5 2011-03-20 13:57:01

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: Different modules for different kernels in rc.conf

I think you mean "uname -r", -s returns just Linux ...

Offline

#6 2011-03-20 14:17:01

neurolysis
Member
Registered: 2011-02-23
Posts: 112
Website

Re: Different modules for different kernels in rc.conf

eduardo.eae wrote:

You can use "uname -s" to get the kernel version.

Put this in your rc.conf

case $(uname -s) in
  "2.6.38-ARCH") MODULES=(something) ;;
  "2.6.38-ANOTHER") MODULES=(something_else) ;;
esac

Yeah, currently doing a test with uname -r. I was pretty sure this was the way, just wanted to check it wasn't already implemented and I was missing it.

Thanks!

Offline

#7 2011-03-20 14:38:51

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 68

Re: Different modules for different kernels in rc.conf

@Radioactiveman: My bad...

Offline

#8 2011-03-20 15:29:51

Mast
Member
Registered: 2011-01-18
Posts: 6

Re: Different modules for different kernels in rc.conf

Yes, I'm surprised there isn't a kernel boot option for that. That would seem like an obvious solution, but I checked and it isn't there. Would be more portable and simpler to configure (at least on a one-time setup). Just modify the bootloader conf, no messing around with shell scripts, which are easy to screw up. An automated install might a bit more complicated, though.
Anyone got an idea why there's not boot option to specify modules?

Last edited by Mast (2011-03-20 15:31:16)

Offline

Board footer

Powered by FluxBB