54 lines
957 B
Plaintext
54 lines
957 B
Plaintext
#!/usr/bin/busybox sh
|
|
|
|
# debugging
|
|
set -x
|
|
|
|
# install busybox
|
|
/usr/bin/busybox --install -s /usr/bin
|
|
|
|
panic() { echo "bruh moment :(" && sh; }
|
|
|
|
# silence is golden
|
|
#echo 0 > /proc/sys/kernel/printk
|
|
|
|
# check config
|
|
[ -f /config ] && . /config || panic
|
|
|
|
# mount pseudofs's
|
|
mount -t proc none /proc
|
|
mount -t sysfs none /sys
|
|
mount -t devtmpfs none /dev
|
|
|
|
# setup mdev
|
|
#echo "/sbin/mdev" >/proc/sys/kernel/hotplug
|
|
#mdev -s
|
|
|
|
# setup udev
|
|
udevd --daemon
|
|
udevadm trigger --action=add --type=subsystems
|
|
udevadm trigger --action=add --type=devices
|
|
udevadm settle
|
|
|
|
# TODO parse /proc/cmdline
|
|
|
|
# load drivers
|
|
#modprobe -a $drivers
|
|
|
|
# merge mount flags
|
|
[ -n "$rootflags" ] && mountargs="$rootflags"
|
|
[ -n "$rootfstype" ] && mountargs="$mountargs -t $rootfstype"
|
|
|
|
# mount rootfs
|
|
mount $mountargs "$root" "/mnt/root" || panic
|
|
|
|
# clean up
|
|
udevadm control --exit
|
|
|
|
umount "/dev"
|
|
umount "/sys"
|
|
umount "/proc"
|
|
|
|
# boot system
|
|
echo SUCCESS
|
|
exec switch_root "/mnt/root" "/sbin/init"
|