b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | #This is the first script called by init process |
| 3 | |
| 4 | find_mtd_index() { |
| 5 | local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')" |
| 6 | local INDEX="${PART##mtd}" |
| 7 | |
| 8 | echo ${INDEX} |
| 9 | } |
| 10 | |
| 11 | |
| 12 | /bin/mount -a |
| 13 | mount -t tmpfs tmpfs /tmp |
| 14 | echo /sbin/mdev > /proc/sys/kernel/hotplug |
| 15 | mdev -s |
| 16 | |
| 17 | if [ -e /dev/dm-0 ]; then |
| 18 | blkdev=/dev/dm-0 |
| 19 | else |
| 20 | mtdpart_idx="$(find_mtd_index rootfs)" |
| 21 | blkdev=/dev/mtdblock${mtdpart_idx} |
| 22 | fi |
| 23 | |
| 24 | echo "==> mount squashfs from $blkdev to /mnt" |
| 25 | mount -t squashfs -o ro $blkdev /mnt |
| 26 | |