Linux Kernel: 6.12.1 Busybox: 1.36.1
- Statically compiled busybox
- Simple directory structure and init scripts
- Easily rebuild the initramfs after booting the system
- Easily customisable with its autorun script
/live
/tmp (chmod 1777)
/dev
/sys
/proc
/bin/busybox
/bin/rebuild-initramfs
/bin/sh -> busybox
/bin/init -> /init
/bin/applets/(busybox applets)
optional lib dirs you might want to create
/usr -> / (optional usr)
/lib
/lib64 -> /lib
other directories could be a symlink from other directories
/etc -> /data/etc
/home -> /data/home
The main init executable is /init
. It is a script run form the system shell and
it's the firt process of the system (PID 1). Its job is to mount /proc
, /sys
and /dev
and
check if the kernel command line has the rescue
argument: if it does it drops you to a shell
(RESCUE MODE), else it reads /rc.init
where the rest of the magic happens.
/rc.init
is a text file that is sourced from /init
. We still are PID 1.
From the kernel documentation:
The kernel parses parameters from the kernel command line up to “–”; if it doesn’t recognize a parameter and it doesn’t contain a ‘.’, the parameter gets passed to init: parameters with > ‘=’ go into init’s environment, others are passed as command line arguments to init. Everything after “–” is passed as an argument to init.
-
If we pass the parameter
live=/dev/sda1
,live=LABEL=(disk-label)
orlive=UUID=(part UUID)
to the kernel command line, the specified partitio will be mounted under /live. -
If the script
/live/$distro/boot/autostart.sh
exists, it will be read and executed.- if the
$distro
environment variable is not passed using the kernel commandline,init.rc
will look for/live/boot/autostart.sh
- if the
-
It runs a root shell