New boot.d early init sequence.

There is a new init sequence that is executed prior to all concurrent
init.d services.

Placing ordered services in /etc/boot.d allows you to interpose upgrade,
verification, and special handling prior to execution of the normal SYSV init.

This system can be accessed by placing ordered scripts directly in
/etc/boot.d from your package.

This infra is used to perform early loader and partition upgrade checks, onie upgrades,
cpld upgrades, and the like.

Normal filesystem mounts are performed at priority 50.
Platform initialization is performated at priority 51.

TODO: Integrate upgrade sequence.
This commit is contained in:
Jeffrey Townsend
2016-03-29 14:58:35 +00:00
parent 82585132c4
commit 0be3bf3708
11 changed files with 189 additions and 15 deletions

View File

@@ -0,0 +1,67 @@
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si0::sysinit:/etc/boot.d/boot
si1::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
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@@ -55,8 +55,6 @@ Configure:
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/common/overlay
update-rc.d:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'

View File

@@ -0,0 +1,67 @@
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si0::sysinit:/etc/boot.d/boot
si1::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
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@@ -55,8 +55,6 @@ Configure:
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/common/overlay
update-rc.d:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,16 @@
common:
arch: all
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-bootd
version: 1.0.0
summary: Open Network Linux Boot Stage
files:
- src : /etc/boot.d
changelog: Change changes changes.,

View File

@@ -1,14 +1,5 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: initdev
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Set up block and net devices
### END INIT INFO
. /lib/lsb/init-functions
log_action_begin_msg "Setting up block and net devices"

View File

@@ -0,0 +1,19 @@
#!/bin/sh
############################################################
#
# Initial boot setup. Required before running
# any concurrent service initialization in rcS
#
# This is designed to support early setup, platform,
# and upgrade operations.
#
############################################################
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
for script in `ls /etc/boot.d/[0-9]* | sort`; do
echo "boot.d: Running $script..."
$script
done

View File

@@ -1,6 +1,6 @@
packages:
- name: onl-vendor-config-onl
depends: python-yaml
depends: [ python-yaml, onl-bootd ]
version: 1.0.0
arch: all
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
@@ -9,7 +9,7 @@ packages:
files:
src/python/onl : $PY_INSTALL/onl
src/init.d : /etc/init.d
src/boot.d : /etc/boot.d
src/bin : /usr/bin
changelog: Changes

View File

@@ -0,0 +1,17 @@
#!/usr/bin/python
### BEGIN INIT INFO
# Provides: onl-platform-baseconf
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Set up ONL Platform
### END INIT INFO
from onl.platform.baseconfig import baseconfig
baseconfig()