#!/bin/sh rootfs=/squashfs rootdir=/overlay/root workdir=/overlay/work mount -t devtmpfs devtmpfs /dev mount -t proc proc /proc mount -t sysfs sysfs /sys sleep 1 [ -e /dev/mmcblk0p1 ] || exec sh fsck.fat -a /dev/mmcblk0p1 mkdir -p $rootfs /mnt /overlay /sdcard /tmp mount -r /dev/mmcblk0p1 /sdcard || exec sh cp -f /sdcard/rootfs.squashfs.* /tmp || exec sh mount /tmp/rootfs.squashfs.* $rootfs || exec sh mount -t tmpfs tmpfs -o size=5M /overlay [ -e /sdcard/settings.tar ] && tar -xf /sdcard/settings.tar -C /overlay mkdir -p $rootdir $workdir mount -t overlay overlay -o lowerdir=$rootfs,upperdir=$rootdir,workdir=$workdir /mnt mount -o move /dev /mnt/dev mount -o move /overlay /mnt/overlay mount -o move $rootfs /mnt/rom umount /sdcard umount /proc umount /sys exec switch_root /mnt /sbin/init