| #!/bin/sh | |
| #This is the first script called by init process | |
| find_mtd_index() { | |
| local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')" | |
| local INDEX="${PART##mtd}" | |
| echo ${INDEX} | |
| } | |
| /bin/mount -a | |
| mount -t tmpfs tmpfs /tmp | |
| echo /sbin/mdev > /proc/sys/kernel/hotplug | |
| mdev -s | |
| if [ -e /dev/dm-0 ]; then | |
| blkdev=/dev/dm-0 | |
| else | |
| mtdpart_idx="$(find_mtd_index rootfs)" | |
| blkdev=/dev/mtdblock${mtdpart_idx} | |
| fi | |
| echo "==> mount squashfs from $blkdev to /mnt" | |
| mount -t squashfs -o ro $blkdev /mnt | |