2 # Copyright (C) 2006 OpenWrt.org
3 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
11 mount none /proc -t proc
12 mount none /sys -t sysfs
14 size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
15 mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
17 if grep devfs /proc/filesystems > /dev/null; then
18 mount none /dev -t devfs
21 HOTPLUG=/sbin/hotplug-call
23 mount -t tmpfs tmpfs /dev -o size=512K
24 mknod /dev/console c 5 1
26 /sbin/hotplug2 --no-persistent --coldplug --set-rules-file /etc/hotplug2-init.rules
32 mkdir -p /dev/pts /dev/shm
33 mount none /dev/pts -t devpts
35 # the shell really doesn't like having stdin/out closed
36 # that's why we use /dev/pty/m0 and m1 as replacement
37 # for /dev/console if there's no serial console available
38 dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
47 [ -e /etc/preinit.arch ] && . /etc/preinit.arch
50 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
52 eval ${FAILSAFE:+failsafe}
53 lock -w /tmp/.failsafe
58 } | tee /tmp/preinit.log