2020-01-07 19:35:34 +05:30
|
|
|
#!/usr/bin/busybox sh
|
2020-01-05 23:31:39 +05:30
|
|
|
|
|
|
|
# debugging
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# install busybox
|
2020-01-07 19:35:34 +05:30
|
|
|
/usr/bin/busybox --install -s /usr/bin
|
2020-01-05 23:31:39 +05:30
|
|
|
|
|
|
|
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 "/bin/mdev" >/proc/sys/kernel/hotplug
|
|
|
|
#mdev -s
|
|
|
|
|
|
|
|
# TODO parse /proc/cmdline
|
|
|
|
|
|
|
|
# load drivers
|
2020-01-06 18:54:54 +05:30
|
|
|
modprobe -a $drivers
|
2020-01-05 23:31:39 +05:30
|
|
|
|
|
|
|
# find rootfs
|
|
|
|
# TODO busybox findfs doesn't support PART{UUID,LABEL}.
|
|
|
|
root="$(findfs $root)" || panic
|
|
|
|
[ -n "$rootflags" ] && mountargs="$rootflags"
|
|
|
|
[ -n "$rootfstype" ] && mountargs="$mountargs -t $rootfstype"
|
|
|
|
|
|
|
|
# mount rootfs
|
|
|
|
mount $mountargs "$root" "/mnt/root" || panic
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
umount "/dev"
|
|
|
|
umount "/sys"
|
|
|
|
umount "/proc"
|
|
|
|
|
|
|
|
# boot system
|
|
|
|
echo SUCCESS
|
|
|
|
exec switch_root "/mnt/root" "/sbin/init"
|