Root/package/base-files/files/lib/preinit/20_device_fs_mount

1#!/bin/sh
2# Copyright (C) 2006 OpenWrt.org
3# Copyright (C) 2010 Vertical Communications
4
5do_move_devtmpfs() {
6    local mnt="$(grep devtmpfs /proc/mounts)"
7          mnt="${mnt#* }"; mnt="${mnt%% *}"
8
9    [ "$mnt" = "/dev" ] || mount -o noatime,move "$mnt" /dev
10}
11
12do_mount_devfs() {
13    mount -o noatime -t devfs devfs /dev
14}
15
16do_mount_hotplug() {
17    mount -t tmpfs -o noatime,mode=0755,size=512K tmpfs /dev
18}
19
20do_mount_udev() {
21    mount -n -t tmpfs -o noatime,mode=0755 udev /dev
22}
23
24choose_device_fs() {
25    if grep -q devtmpfs /proc/mounts; then
26        do_move_devtmpfs
27    elif grep -q devfs /proc/filesystems; then
28        do_mount_devfs
29    elif [ -x /sbin/hotplug2 ]; then
30        do_mount_hotplug
31    elif [ -x /sbin/udevd ]; then
32        do_mount_udev
33    fi
34}
35
36boot_hook_add preinit_essential choose_device_fs
37
38

Archive Download this file



interactive