Power-on thru Init
Power on thru software initiation is not always well documented. This is an attempt to fill that gap.

There are 4 major activities that happen before the general loading of the software program known as init - /sbin/init being registered in the Linux/UNIX process table as PID 1 on most (but not all) systems (including openwrt).

  1. Power on
  2. bootloader
  3. kernel execute
  4. /etc/preint

Power on is simple enough. When the "on" switch is turned to the "on" position power, the electricity initiates the semiconductor chips to start their process. In our case, we are using a SOC (System On a Chip) and it has preset the next step - bootload.

bootloader is the first process the off the SOC. It initiates an electronic signal which loads the firmware from an adjoining memory module - in our case flash memory and eeprom. It then loads some critical variables, the kernel, and executes the kernel. At which point it's job is done.

kernel execute is the process of the kernel loading itself, checking itself, loading some more variables.

/etc/preinit is a shell script (44 lines). It does some of what the kernel usually does - loads more variables, then mounts some persistant storage (read only).

NOTE: Openwrt.org says preinit sources a script called /etc/diag.sh; it does not.

power on
boot loader
kernel
/etc/preinit

Reference: