initramfs-kernel
kernel runs /init.
/init is a script which sets INITRAMFS=1 and then execs /sbin/init.
/sbin/init is ELF comes from procd package. What it does (as pid=1):
- early (different from procd early):- mount /proc, /sysfs, and create /dev nodes, create /tmp subdirs etc
- set PATH
 
- kmodloader in subprocess (waits until done)
- preinit- plugd in subprocess (seem to deal with firmware)
- /etc/preinit in subprocess
 
- when /etc/preinit is done then it execvp the "real" /sbin/procd
procd states:
- early (first state):- coldplug (remount /dev, etc)- start udevtrigger in subproc
- when udevtrigger completes, hotplug
- when hotplug completes, next state (ubus)
 
 
- coldplug (remount /dev, etc)
- ubus:- start attempts to connect to ubs
- start ubus as service
- once connection's done then next state (init)
 
- init - read /etc/inittab and run:- respawn - things that need to keep rerunning once quitted
- askconsole
- askfirst - the "Press Enter to activate this console" message
- sysinit - (usually /etc/init.d/rcS with S) and then next state (running)
 
- running - waits for shutdown signal (usr1/usr2) or reboot (int/term)
- shutdown- runs shutdown command per inittab (also /etc/init.d/rcS but with K)
- when done next state (halt)
 
- halt - kill everything and either enter sleep loop or reboots
Debian
Needs devtmpfs in kernel. This seem to be first thing that /sbin/init does. (Maybe systemd specific.)
mkdir -pv /mnt/debian && mknod /dev/sda b 8 0 && cryptsetup open /dev/sda usb && vgchange -ay vol_grp1 && mount /dev/vol_grp1/logical_vol1 /mnt/debian
chroot /mnt/debian /bin/bash
mount proc /proc -t proc
exec switch_root /mnt/debian /sbin/init
ip addr add dev eth0 IP/NM
ip link set eth0 up
ip route add default via GW
ip link set eth0 up
ip route add default via GW
 
  