20_device_fs_mount 786 B

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