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