Startup script

m
(wikify slightly)
 
Line 1: Line 1:
Startup script is a script which is executed at every startup (boot) of the device. It is important to have all custom startup commands under control, you can simply have them in one file as it is described here.
Startup script is a script which is executed at every startup (boot) of the device. It is important to have all custom startup commands under control, you can simply have them in one file as it is described here.
-
 
+
==Usage examples==
-
=Usage examples=
+
You can use startup script to:
You can use startup script to:
-
 
* set frequencies in kernel (overclocking with titan's kernel)
* set frequencies in kernel (overclocking with titan's kernel)
* set voltages in kernel (undervolting with titan's kernel)
* set voltages in kernel (undervolting with titan's kernel)
-
* set ondemand scheduler parameters (ignore_nice_load, up_threshold, sampling_rate)
+
* set ondemand scheduler parameters (<code>ignore_nice_load</code>, <code>up_threshold</code>, <code>sampling_rate</code>)
* start daemons like [[fcron]]
* start daemons like [[fcron]]
* load kernel modules
* load kernel modules
Line 19: Line 17:
-
It is better to use startup script for setting kernel parameters rather that editing system files (for example /etc/pmconfig), because you can delay the execution of the script or prevent the execution if the reboot loop is detected. The delaying option is described here, but the script to detect the reboot loop has yet to be tested and added.
+
It is better to use startup script for setting kernel parameters rather that editing system files (for example <code>/etc/pmconfig</code>), because you can delay the execution of the script or prevent the execution if the reboot loop is detected. The delaying option is described here, but the script to detect the reboot loop has yet to be tested and added.
-
 
+
-
=Script=
+
==Script==
-
The preferred method used is a script in /etc/event.d directory. All scripts in that directory are executed at every boot, but they need to be in proper format in order to work. First of all create a file in /etc/event.d/ directory named as you like, "startup-script" is a good pick for example.
+
The preferred method used is a script in <code>/etc/event.d</code> directory. All scripts in that directory are executed at every boot, but they need to be in proper format in order to work. First of all create a file in /etc/event.d/ directory named as you like, "startup-script" is a good pick for example.
This is an example script that you can modify and put into your startup script:
This is an example script that you can modify and put into your startup script:
Line 45: Line 42:
  end script
  end script
-
Customize the script to your needs and save the file. The part that you need to modify is between "script" and "end script" lines and is like any other shell script except that it doesn't need shebang at the start (#!/bin/sh). The <code>sleep 60</code> command is optional and produces delay in seconds, in the example case one minute. After you have tested your commands, you can remove this command to speed up the process.
+
Customize the script to your needs and save the file. The part that you need to modify is between "script" and "end script" lines and is like any other shell script except that it doesn't need shebang at the start (<code>#!/bin/sh</code>). The <code>sleep 60</code> command is optional and produces delay in seconds, in the example case one minute. After you have tested your commands, you can remove this command to speed up the process.
-
After next reboot, all commands you put in that script will be executed. So make sure that you know what are you doing, it would be unwise to put "reboot" into that script.
+
After next reboot, all commands you put in that script will be executed. So make sure that you know what are you doing, it would be unwise to put "<code>reboot</code>" into that script.
[[Category:Power users]]
[[Category:Power users]]

Latest revision as of 13:34, 5 October 2010

Startup script is a script which is executed at every startup (boot) of the device. It is important to have all custom startup commands under control, you can simply have them in one file as it is described here.

[edit] Usage examples

You can use startup script to:

  • set frequencies in kernel (overclocking with titan's kernel)
  • set voltages in kernel (undervolting with titan's kernel)
  • set ondemand scheduler parameters (ignore_nice_load, up_threshold, sampling_rate)
  • start daemons like fcron
  • load kernel modules
  • turn on additional swapping partitions (microSD)
  • set swappiness
  • mount additional partitions (for example ext3-formatted microSD card)
  • set SmartReflex values
  • run any command at startup


It is better to use startup script for setting kernel parameters rather that editing system files (for example /etc/pmconfig), because you can delay the execution of the script or prevent the execution if the reboot loop is detected. The delaying option is described here, but the script to detect the reboot loop has yet to be tested and added.

[edit] Script

The preferred method used is a script in /etc/event.d directory. All scripts in that directory are executed at every boot, but they need to be in proper format in order to work. First of all create a file in /etc/event.d/ directory named as you like, "startup-script" is a good pick for example.

This is an example script that you can modify and put into your startup script:

start on started hildon-desktop
stop on starting shutdown
console none
service

script

sleep 60
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load
echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 200000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
modprobe bq27x00_battery
/etc/init.d/fcron start
swapon /dev/mmcblk1p2

end script

Customize the script to your needs and save the file. The part that you need to modify is between "script" and "end script" lines and is like any other shell script except that it doesn't need shebang at the start (#!/bin/sh). The sleep 60 command is optional and produces delay in seconds, in the example case one minute. After you have tested your commands, you can remove this command to speed up the process.

After next reboot, all commands you put in that script will be executed. So make sure that you know what are you doing, it would be unwise to put "reboot" into that script.