From 8ae92b7601003e7ee6ad35e954df797363d8b66c Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 8 Dec 2013 19:31:34 +0100 Subject: [PATCH] linuxrc: fix /dev/shm mount, move it after /dev mount, add strictatime support to busybox The busybox patch has been backported 1.21.1. --- defaults/initrd.d/00-devmgr.sh | 4 ++ defaults/linuxrc | 1 - .../1.20.2/busybox-1.20.1-strict-atime.patch | 49 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 patches/busybox/1.20.2/busybox-1.20.1-strict-atime.patch diff --git a/defaults/initrd.d/00-devmgr.sh b/defaults/initrd.d/00-devmgr.sh index 4c48165..05677df 100755 --- a/defaults/initrd.d/00-devmgr.sh +++ b/defaults/initrd.d/00-devmgr.sh @@ -69,6 +69,10 @@ mount_devfs() { mount -t devpts -o gid=5,mode=0620 devpts /dev/pts \ || bad_msg "Failed to mount /dev/pts" fi + + mkdir -p -m 1777 /dev/shm + mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs \ + /dev/shm || bad_msg "Failed to mount /dev/shm" } device_list() { diff --git a/defaults/linuxrc b/defaults/linuxrc index 858026f..44a146f 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -16,7 +16,6 @@ fi mount -t proc -o noexec,nosuid,nodev proc /proc >/dev/null 2>&1 mount -o remount,rw / >/dev/null 2>&1 mount -t tmpfs -o rw,nosuid,nodev,relatime,mode=755 none /run 2>&1 -mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm 2>&1 /bin/busybox --install -s diff --git a/patches/busybox/1.20.2/busybox-1.20.1-strict-atime.patch b/patches/busybox/1.20.2/busybox-1.20.1-strict-atime.patch new file mode 100644 index 0000000..cf72953 --- /dev/null +++ b/patches/busybox/1.20.2/busybox-1.20.1-strict-atime.patch @@ -0,0 +1,49 @@ +Add support for the "strictatime" mount option. + +Upstream-Status: Backport [9ad8979ff15e1b894ee1f4bb6a2535a1a2c20d65] +Signed-off-by: Ross Burton + +Index: busybox-1.20.2/util-linux/mount.c +=================================================================== +--- busybox-1.20.2.orig/util-linux/mount.c 2012-07-02 15:08:25.000000000 +0100 ++++ busybox-1.20.2/util-linux/mount.c 2013-03-22 15:37:31.340277463 +0000 +@@ -113,6 +113,12 @@ + #ifndef MS_RELATIME + # define MS_RELATIME (1 << 21) + #endif ++#ifndef MS_STRICTATIME ++# define MS_STRICTATIME (1 << 24) ++#endif ++ ++/* Any ~MS_FOO value has this bit set: */ ++#define BB_MS_INVERTED_VALUE (1u << 31) + + #include "libbb.h" + #if ENABLE_FEATURE_MOUNT_LABEL +@@ -239,6 +245,7 @@ + /* "nomand" */ ~MS_MANDLOCK, + /* "relatime" */ MS_RELATIME, + /* "norelatime" */ ~MS_RELATIME, ++ /* "strictatime" */ MS_STRICTATIME, + /* "loud" */ ~MS_SILENT, + /* "rbind" */ MS_BIND|MS_RECURSIVE, + +@@ -295,6 +302,7 @@ + "nomand\0" + "relatime\0" + "norelatime\0" ++ "strictatime\0" + "loud\0" + "rbind\0" + +@@ -466,8 +474,8 @@ + // Find this option in mount_options + for (i = 0; i < ARRAY_SIZE(mount_options); i++) { + if (strcasecmp(option_str, options) == 0) { +- long fl = mount_options[i]; +- if (fl < 0) ++ unsigned long fl = mount_options[i]; ++ if (fl & BB_MS_INVERTED_VALUE) + flags &= fl; + else + flags |= fl;