use hotplug2 for serializing hotplug events on 2.6
[openwrt.git] / package / base-files / files / sbin / mount_root
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 . /etc/functions.sh
4
5 mount none /proc -t proc
6 size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo)
7
8 mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
9 if grep devfs /proc/filesystems >/dev/null; then
10 mount none /dev -t devfs
11 else
12 mount -t tmpfs tmpfs /dev -o size=512K
13 mknod /dev/console c 5 1
14 exec >/dev/console </dev/console 2>&1
15 fi
16 mkdir /dev/shm
17 if grep sysfs /proc/filesystems >/dev/null; then
18 mount -t sysfs none /sys
19 HOTPLUG=""
20 # use a minimal ruleset only for creating device nodes
21 /sbin/hotplug2 --no-persistent --coldplug --set-rules-file /etc/hotplug2-init.rules
22 else
23 HOTPLUG="/sbin/hotplug2-dnode"
24 fi
25 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
26
27 mkdir -p /dev/pts
28 mount none /dev/pts -t devpts
29
30 [ failsafe != "$1" ] && {
31 grep rootfs /proc/mtd >/dev/null 2>/dev/null && {
32 mtd unlock rootfs
33 grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && {
34 . /bin/firstboot
35 echo "switching to jffs2"
36 mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2
37 fopivot /jffs /rom
38 }
39 } || mount -o remount,rw /dev/root /
40 }
This page took 0.044092 seconds and 5 git commands to generate.