10_essential_fs 607 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # Copyright (C) 2006 OpenWrt.org
  3. # Copyright (C) 2010 Vertical Communications
  4. do_mount_procfs() {
  5. mount -o noatime -t proc proc /proc
  6. }
  7. do_mount_sysfs() {
  8. mount -o noatime -tsysfs sysfs /sys
  9. }
  10. calc_tmpfs_size() {
  11. pi_size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)
  12. }
  13. do_mount_tmpfs() {
  14. calc_tmpfs_size
  15. mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp
  16. }
  17. boot_hook_add preinit_essential do_mount_procfs
  18. boot_hook_add preinit_essential do_mount_sysfs
  19. boot_hook_add preinit_essential do_mount_tmpfs