Skip to contentSkip to conversation

poky: added overlay file

PATCH Dr. Arno Baumfalk 2 participants 2 messages Mar 30, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I have found, that the init-live.sh script does not consider, that the overlay filesystem in the linux kernel has been renamed from "overlayfs" to "overlay" (and the mount API has changed, too). Currently the script will not detect "overlay" and use "aufs" as a fallback, if present.

In order not to break anything for users of elder kernel versions I have simply added the "overlay" case to the script, see attached patch.

Best regards,
Arno Baumfalk

From 860a4f3f038f362094c7bd20e6abef08767a44bd Mon Sep 17 00:00:00 2001
From: Arno Baumfalk <[email protected]>
Date: Tue, 22 Mar 2016 16:03:17 +0100
Subject: [PATCH] added overlay filesystem to init-live.sh (overlayfs was
renamed and the mount api was changed)

---
 meta/recipes-core/initrdscripts/files/init-live.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
meta/recipes-core/initrdscripts/files/init-live.sh +18 -1
index d852c57..fa9d9c6 100644
@@ -169,7 +169,9 @@ mount_and_boot() {
 
     # determine which unification filesystem to use
     union_fs_type=""
-    if grep -q -w "overlayfs" /proc/filesystems; then
+    if grep -q -w "overlay" /proc/filesystems; then
+	union_fs_type="overlay"
+    elif grep -q -w "overlayfs" /proc/filesystems; then
 	union_fs_type="overlayfs"
     elif grep -q -w "aufs" /proc/filesystems; then
 	union_fs_type="aufs"
@@ -179,6 +181,21 @@ mount_and_boot() {
 
     # make a union mount if possible
     case $union_fs_type in
+	"overlay")
+	    mkdir -p /rootfs.ro /tmpfs
+	    if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then
+		rm -rf /rootfs.ro /tmpfs
+		fatal "Could not move rootfs mount point"
+	    else
+		mount -t tmpfs -o rw,noatime,mode=755 tmpfs /tmpfs
+		mkdir /tmpfs/rootfs.rw /tmpfs/work
+		mount -t overlay -o "lowerdir=/rootfs.ro,upperdir=/tmpfs/rootfs.rw,workdir=/tmpfs/work" overlay $ROOT_MOUNT
+		mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/tempfs
+		mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+		mount --move /tmpfs $ROOT_MOUNT/tempfs
+		ln -s /tempfs/rootfs.rw $ROOT_MOUNT/rootfs.rw
+	    fi
+	    ;;
 	"overlayfs")
 	    mkdir -p /rootfs.ro /rootfs.rw
 	    if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Dr. Arno Baumfalk

Hello,

I have found, that the init-live.sh script does not consider, that the overlay filesystem in the linux kernel has been renamed from "overlayfs" to "overlay" (and the mount API has changed, too).
Currently the script will not detect "overlay" and use "aufs" as a fallback, if present.

Patches for this have already been sent to the OE-core mailing list. Please check there to see how yours intersect/overlap.

Quoted 4 lines

In order not to break anything for users of elder kernel versions I have simply added the "overlay" case to the script, see attached patch.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------