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