summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-10-11 13:09:04 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-12 16:57:21 +0100
commit2848e37111ac969f1ae67010342ec36c80d7bbe5 (patch)
treed7f304ac46d4d5371631986bf5c2b72e60e68474 /meta
parent6dd32df4b4cf2c07c8a0845ec300ce48d74ad5fe (diff)
downloadpoky-2848e37111ac969f1ae67010342ec36c80d7bbe5.tar.gz
initscripts: read-only-rootfs-hook: Use overlay if available
Copying files from the read-only /var/lib to tmpfs can be slow and waste memory. If the kernel supports the overlay file system, use it to mount a writable tmpfs on top of the read-only /var/lib and avoid the file copy. (From OE-Core rev: 370fda1b2e8d5dc011522131bba4106de26bfb19) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 1a0328d63e..bd445ddb07 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -31,8 +31,13 @@ if [ "$1" = "start" ] ; then
31 if [ `is_on_read_only_partition /var/lib` = "yes" ]; then 31 if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
32 grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile 32 grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
33 mkdir -p /var/volatile/lib 33 mkdir -p /var/volatile/lib
34 cp -a /var/lib/* /var/volatile/lib 34 mkdir -p /var/volatile/.lib-work
35 mount --bind /var/volatile/lib /var/lib 35 # Try to mount using overlay, which is much faster than copying
36 # files. If that fails, fallback to the slower copy
37 if ! mount -t overlay overlay -olowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work /var/lib > /dev/null 2>&1; then
38 cp -a /var/lib/* /var/volatile/lib
39 mount --bind /var/volatile/lib /var/lib
40 fi
36 fi 41 fi
37fi 42fi
38 43