JES Boot Flow

The booting flow of the kernel of JES system follows that defined by the application processor SoC vendor. After the booting of kernel, the ‘init’ process used is ‘BusyBox init’. Different from ‘SysV init’, ‘Busybox init’ doesn’t support ‘runlevels’. So the field ‘runlevels’ is ignored. After ‘init’ starts, the following actions are executed:

  • Read ‘/etc/inittab’, and execute the behavior defined by ‘inittab’. If there is no ‘/etc/inittab’, ‘BusyBox init’ will execute the default behavior:
    • ::sysinit:/etc/init.d/rcS
    • ::askfirst:/bin/sh
    • ::ctrlaltdel:/sbin/reboot
    • ::shutdown:/sbin/swapoff -a
    • ::shutdown:/bin/umount -a -r
    • ::restart:/sbin/init
  • Execute the script ‘/etc/init.d/rcS’. An example ‘rcS’ script is as following:
#!/bin/sh
 
 
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do
 
     # Ignore dangling symlinks (if any).
     [ ! -f "$i" ] && continue
 
     case "$i" in
 *.sh)
     # Source shell script for speed.
     (
  trap - INT QUIT TSTP
  set start
  . $i
     )
     ;;
 *)
     # No sh extension, so fork subprocess.
     $i start
     ;;
    esac
done
  • Execute in order the scripts /etc/init.d/S[0-9][0-9]*
    • The execute order number of JESBase is ‘S40jesbase’, the execution order number of the applications of application layer is between S50 and S80. The script needs to at least implement ‘start’ and ‘stop’, for example,
#!/bin/sh
 
NAME=xxx
DAEMON=/usr/bin/$NAME
PID_FILE="/var/run/$NAME.pid"
CONF_FILE="/etc/$NAME/$NAME.conf"
 
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
start() {
 echo -e "Starting $NAME: "
 start-stop-daemon -S -q -p $PID_FILE --exec $DAEMON -- -f $CONF_FILE
 echo "OK"
}
stop() {
 echo -e "Stopping $NAME: "
 start-stop-daemon -K -q -p $PID_FILE
 echo "OK"
}
restart() {
 stop
 start
}
 
case "$1" in
  start)
 start
 ;;
  stop)
 stop
 ;;
  restart|reload)
 restart
 ;;
  *)
 echo "Usage: $0 {start|stop|restart}"
 exit 1
esac
 
exit $?