From e1a27d486c2374f46abd264f3fd6561815155ebd Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 28 Nov 2014 01:27:57 +0100 Subject: add support for zram compressed tmpfs Signed-off-by: John Crispin --- initd/early.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'initd/early.c') diff --git a/initd/early.c b/initd/early.c index c622aec..5a83d2c 100644 --- a/initd/early.c +++ b/initd/early.c @@ -24,25 +24,6 @@ #include "../log.h" #include "init.h" -static void -early_mounts(void) -{ - mount("proc", "/proc", "proc", MS_NOATIME, 0); - mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0); - mount("none", "/sys/fs/cgroup", "cgroup", 0, 0); - - mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL); - mkdir("/tmp/run", 0777); - mkdir("/tmp/lock", 0777); - mkdir("/tmp/state", 0777); - symlink("/tmp", "/var"); - - mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K"); - mkdir("/dev/shm", 0755); - mkdir("/dev/pts", 0755); - mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600"); -} - static void early_dev(void) { @@ -77,6 +58,28 @@ early_console(const char *dev) fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK); } +static void +early_mounts(void) +{ + mount("proc", "/proc", "proc", MS_NOATIME, 0); + mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0); + mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K"); + mkdir("/dev/shm", 0755); + mkdir("/dev/pts", 0755); + mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600"); + early_dev(); + + early_console("/dev/console"); + if (mount_zram_on_tmp()) + mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL); + else + mkdev("*", 0600); + mkdir("/tmp/run", 0777); + mkdir("/tmp/lock", 0777); + mkdir("/tmp/state", 0777); + symlink("/tmp", "/var"); +} + static void early_env(void) { @@ -90,9 +93,7 @@ early(void) return; early_mounts(); - early_dev(); early_env(); - early_console("/dev/console"); LOG("Console is alive\n"); } -- cgit v1.2.3