HOME
-> LINUX-PMAC
-> RC
Looking at the /etc/inittab
I saw, that the whole
initialisation is based onto the two scripts rc.sysinit
and
rc
. rc.sysinit
is started just once when the
system boots. rc
is started after rc.sysinit
to establish the startup run-level, as well as each time the run level
is changed using the command telinit
.
After reducing these files, it takes only 6 seconds until I get a console login prompt. So total boot time, from BootX to login prompt is 19 seconds.
The missing link is now, how to start booting Linux right after switching on my PowerBook. It takes now 25 seconds until BootX appears.
My rc.sysinit
file.
Level | Definition |
---|---|
0 | Halt |
1 | Single user mode |
2 | Multiuser without network servers |
3 | Full multiuser mode |
4 | unused |
5 | X11 |
6 | reboot |
As I use linux on a notbeook, which is rarely attached to a network,
it makes no sense to have two different multiuser modes. Also I think I
will not used xdm login, but start X after having logged in textually.
So I will not use run-level 3 and 5. This means I can remove the line
which executes prefdm
from the inittab
file.
When this script is called, it will basically execute all scripts
contained in the directory /etc/rc.d/rc.runlevel
either with the argument stop, if the script name starts with K or with
argument start, if the script starts with letter S. The scripts are
really just links into the /etc/rc.d/init.d
directory.
Depending on whether the script shall be called with argument start or
stop, a link in the run-level directory is created with a name starting
with K or S.
Now my idea to speed up startup, is to have just the rc
script, and do everything in there. The script shall be very compact,
and contain also all of the configuration stuff. Nevertheless, it shall
be easily readable/understandable.
Having on 2 "non-shutdown" run-levels, 1 for single-user and 2 for multi-user mode, makes everything easier. I also assume, that if I ever switch from a run-level to the same one, it is ok to restart all servers.
Thus I created a script, which first stops almost everything. Then it looks, if run-level 0 or 6 were selected. In this case some further "stopping" actions are performed, and the system is powered off or rebooted. Otherwise it will first perform setups and start services needed for both run-level 1 and 2. If run-level 2 was selected additional setup-startup takes place.
My rc
file.