2 # Copyright (C) 2006 OpenWrt.org
5 mkdir -p /dev/pts /dev/shm
6 mount none /dev/pts -t devpts
7 mount none /proc -t proc
9 size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
10 mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
12 if grep devfs /proc/filesystems > /dev/null; then
13 mount none /dev -t devfs
16 HOTPLUG=/sbin/hotplug-call
18 mount -t sysfs none /sys
19 mount -t tmpfs tmpfs /dev -o size=512K
20 mknod /dev/console c 5 1
22 /sbin/hotplug2 --no-persistent --coldplug --set-rules-file /etc/hotplug2-init.rules
28 # the shell really doesn't like having stdin/out closed
29 # that's why we use /dev/pty/m0 and m1 as replacement
30 # for /dev/console if there's no serial console available
31 dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null || \
34 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
37 mtdpart="$(find_mtd_part rootfs_data)"
38 magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
39 [ "$magic" != "deadc0de" ]
42 [ failsafe != "$1" ] && {
43 grep rootfs /proc/mtd >/dev/null 2>/dev/null && {
45 grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && {
48 echo "switching to jffs2"
49 mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2
52 echo "jffs2 not ready yet; using ramdisk"
56 } || mount -o remount,rw /dev/root /