#!/bin/busybox sh

# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

# Do your stuff here.
echo "This script just mounts and boots the rootfs, nothing else!"

rescue_shell() {
    echo "Something went wrong. Dropping to a shell."
    exec sh
}

# Mount the root filesystem.
echo "wait 10sec"
sleep 10
mount -o ro /dev/sda1 /mnt/root || rescue_shell

# Clean up.
umount /proc
umount /sys
umount /dev

# Boot the real thing.
exec switch_root /mnt/root /sbin/init
