GUF-Yocto-34.0-r5756-0
VINCELL
User Manual
4
Services and utilities
The Garz & Fricke Linux BSP includes several useful services for flexible application handling. Some of them are
just run-once services directly after the OS has been started, others are available permanently.
4.1
Services
The services on Garz & Fricke Yocto Linux systems are usually started with start scripts. This is a very common
technique on Linux systems. Yocto uses the
/etc/init.d/rc
script for this purpose. This script is run by the
init
process after parsing the
/etc/inittab
file:
[...]
# The default runlevel.
id:5:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
[...]
As the comments in the file tell, the first script to be run on boot is
/etc/init.d/rcS
, which executes all start scripts
in
/etc/rcS.d
. Afterwards, the default runlevel (5) is entered, which makes the start scripts in
/etc/rc5.d
being
executed.
All scripts starting with the character
S
are executed with the argument
start
appended, while all scripts starting
with the character
K
are executed with the argument
stop
appended. Furthermore, the naming convention states
that the
S/K
character is followed by a number which determines the (numeric) execution order.
The actual scripts live in the directory
/etc/init.d
(e.g.
/etc/init.d/myapp
) while the
/etc/rc*
folders contain links
to those scripts (e.g.
/etc/rc5.d/S95myapp
).
Those script having the following basic layout, though not all scripts in the image contain the header between
###
BEGIN
and
### END
. Further documentation for the script format can be found here:
https://wiki.debian.org/LSBInitScripts
#!/bin/sh
### BEGIN INIT INFO
# Provides:
myapp
# Required-Start:
$all
# Required-Stop:
# Default-Start:
2 3 4 5
# Default-Stop:
0 1 6
# Short-Description: Start myapp at boot time
# Description:
### END INIT INFO
12