Startup script
(New page: 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 ...)
Newer edit →
Revision as of 22:07, 14 April 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.
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)
- 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.
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.