Koozali.org: home of the SME Server

Which boot script to use for modprobe etc.?

Offline levien

  • *
  • 26
  • +0/-0
Which boot script to use for modprobe etc.?
« on: April 18, 2007, 01:36:40 PM »
Hello everyone,

I posted this question to the contribs forum, but didn't get any reply, so I'll try here instead. :)
What would be the best way to load kernel modules and do other custom boot-time stuff in SME 7.x? In the past (SME 5.6) I manually added things to the /etc/rc.d/rc.local script. Is it wise to keep doing this, or would it be better to put such things into a template fragment for one of the other init scripts (and if so, which one)?

I basically need to start a small non-standard script which sets up our DSL connection, and I also need to insert a few kernel modules that are not loaded automagically (the padlock and via_rng modules for hardware encryption support on VIA C7 processors).

Thanks!
Levien

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Which boot script to use for modprobe etc.?
« Reply #1 on: April 18, 2007, 04:02:49 PM »
Quote from: "levien"

What would be the best way to load kernel modules and do other custom boot-time stuff in SME 7.x? In the past (SME 5.6) I manually added things to the /etc/rc.d/rc.local script.


You would have lost your customisations any time that /etc/rc.d/rc.local was updated.

What you should do is add one or more scripts named Snnxxxx into the /etc/e-smith/events/local directory.

What is special about your DSL modem that it needs different initialisation?

Offline levien

  • *
  • 26
  • +0/-0
Re: Which boot script to use for modprobe etc.?
« Reply #2 on: April 18, 2007, 04:48:02 PM »
Quote from: "CharlieBrady"

You would have lost your customisations any time that /etc/rc.d/rc.local was updated.


Apparently I have been lucky so far, as that has never happened. But I thought as much...

Quote from: "CharlieBrady"

What you should do is add one or more scripts named Snnxxxx into the /etc/e-smith/events/local directory.


OK, I will try that. Thanks for the advice!

Quote from: "CharlieBrady"

What is special about your DSL modem that it needs different initialisation?


It's old. :-) I have to set up a PPTP connection to the modem, which is then used as the external interface. I use the ancient adsl4linux package for that. I know I should probably get another modem one of these days, buf for now this works just fine...

Thanks!
Levien

Offline levien

  • *
  • 26
  • +0/-0
Re: Which boot script to use for modprobe etc.?
« Reply #3 on: April 26, 2007, 09:48:39 PM »
Quote from: "CharlieBrady"

What you should do is add one or more scripts named Snnxxxx into the /etc/e-smith/events/local directory.


Hmm, I tried that, but it doesn't seem to work.
I mimicked the other scripts in this dir, so my script is called /etc/e-smith/events/actions/custom-setup-via and looks like this:

Code: [Select]

#!/bin/sh

# Custom initialisation stuff for the VIA C7

exec /sbin/modprobe via_rng
exec /sbin/modprobe padlock
exec echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor


I then created a symlink to the above at /etc/e-smith/events/local/S60custom-setup-via. I tried both a reboot and signalling a "local" event, but the script never seems to be executed. What am I doing wrong?

Best regards,
Levien

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Which boot script to use for modprobe etc.?
« Reply #4 on: April 26, 2007, 10:25:20 PM »
Quote from: "levien"
Quote from: "CharlieBrady"

What you should do is add one or more scripts named Snnxxxx into the /etc/e-smith/events/local directory.


Hmm, I tried that, but it doesn't seem to work.
I mimicked the other scripts in this dir, so my script is called /etc/e-smith/events/actions/custom-setup-via and looks like this:

Code: [Select]

#!/bin/sh

# Custom initialisation stuff for the VIA C7

exec /sbin/modprobe via_rng
exec /sbin/modprobe padlock
exec echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor


I then created a symlink to the above at /etc/e-smith/events/local/S60custom-setup-via. I tried both a reboot and signalling a "local" event, but the script never seems to be executed. What am I doing wrong?


'exec' never returns. So you ran modprobe via_rng, but not the rest of your script.

Offline levien

  • *
  • 26
  • +0/-0
Re: Which boot script to use for modprobe etc.?
« Reply #5 on: April 26, 2007, 11:41:50 PM »
Quote from: "CharlieBrady"

'exec' never returns. So you ran modprobe via_rng, but not the rest of your script.


Oops, you can tell I'm not a very experience shell script programmer... :)
It now works as expected, thanks!

-L.