Root/package/base-files/files/lib/preinit/10_essential_fs

1#!/bin/sh
2# Copyright (C) 2006 OpenWrt.org
3# Copyright (C) 2010 Vertical Communications
4
5do_mount_procfs() {
6   mount -o noatime -t proc proc /proc
7}
8
9do_mount_sysfs() {
10   mount -o noatime -tsysfs sysfs /sys
11}
12
13calc_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
17do_mount_tmpfs() {
18    calc_tmpfs_size
19    mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp
20}
21
22boot_hook_add preinit_essential do_mount_procfs
23boot_hook_add preinit_essential do_mount_sysfs
24boot_hook_add preinit_essential do_mount_tmpfs
25
26

Archive Download this file



interactive