All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] live image: try to make a valid union mount
@ 2013-06-28  7:48 Qi.Chen
  2013-06-28  7:48 ` [PATCH 1/2] initrdscripts: unionfs cleanup Qi.Chen
  2013-06-28  7:48 ` [PATCH 2/2] init-live.sh: try to make a union mount when possible Qi.Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Qi.Chen @ 2013-06-28  7:48 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

This patchset cleans up the unionfs related code and tries to make a union mount
with aufs or overlayfs.

The following changes since commit 042203531b10b37ac9a8201b376f5dec403e51d8:

  sanity.bbclass: Fix COREBASE sanity tests (2013-06-27 12:48:56 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/live-image-union-mount
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/live-image-union-mount

Chen Qi (2):
  initrdscripts: unionfs cleanup
  init-live.sh: try to make a union mount when possible

 meta/recipes-core/initrdscripts/files/init-live.sh |   71 ++++++++++++++------
 .../initrdscripts/initramfs-live-boot_1.0.bb       |    7 --
 2 files changed, 52 insertions(+), 26 deletions(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] initrdscripts: unionfs cleanup
  2013-06-28  7:48 [PATCH 0/2] live image: try to make a valid union mount Qi.Chen
@ 2013-06-28  7:48 ` Qi.Chen
  2013-06-28  7:48 ` [PATCH 2/2] init-live.sh: try to make a union mount when possible Qi.Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Qi.Chen @ 2013-06-28  7:48 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

The unionfs has been disabled for more than a year and it's not going
to be used any more.

This patch cleans up the unionfs related code.

[YOCTO #4761]
[YOCTO #1487]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   22 +++-----------------
 .../initrdscripts/initramfs-live-boot_1.0.bb       |    7 -------
 2 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 804e16e..00c2558 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -7,7 +7,6 @@ ROOT_IMAGE="rootfs.img"
 MOUNT="/bin/mount"
 UMOUNT="/bin/umount"
 ISOLINUX=""
-UNIONFS="no"
 
 # Copied from initramfs-framework. The core of this script probably should be
 # turned into initramfs-framework modules to reduce duplication.
@@ -140,25 +139,10 @@ case $label in
     boot)
 	mkdir $ROOT_MOUNT
 	mknod /dev/loop0 b 7 0 2>/dev/null
-
-	
-	if [ "$UNIONFS" = "yes" ]; then
-	    mkdir /rootfs-tmp
-
-	    if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs-tmp ; then
-		fatal "Could not mount rootfs image"
-	    else
-		mkdir /cow
-		mount -t tmpfs -o rw,noatime,mode=755 tmpfs /cow
-		mount -t unionfs -o dirs=/cow:/rootfs-tmp=ro unionfs $ROOT_MOUNT
-		boot_live_root
-	    fi
+	if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+	    fatal "Could not mount rootfs image"
 	else
-	    if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
-		fatal "Could not mount rootfs image"
-	    else
-		boot_live_root
-	    fi
+	    boot_live_root
 	fi
 	;;
     install|install-efi)
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
index 0cbfe02..8626bb5 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -7,13 +7,6 @@ SRC_URI = "file://init-live.sh"
 
 PR = "r11"
 
-do_compile() {
-	#if grep -q "CONFIG_UNION_FS=y" ${STAGING_KERNEL_DIR}/.config; then
-	#	sed -i 's/UNIONFS="no"/UNIONFS="yes"/g' ${WORKDIR}/init-live.sh
-	#fi
-	:
-}
- 
 do_install() {
         install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
 }
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] init-live.sh: try to make a union mount when possible
  2013-06-28  7:48 [PATCH 0/2] live image: try to make a valid union mount Qi.Chen
  2013-06-28  7:48 ` [PATCH 1/2] initrdscripts: unionfs cleanup Qi.Chen
@ 2013-06-28  7:48 ` Qi.Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Qi.Chen @ 2013-06-28  7:48 UTC (permalink / raw)
  To: openembedded-core; +Cc: qingtao.cao

From: Chen Qi <Qi.Chen@windriver.com>

This patch tries to make a union mount in live image. For example,
if aufs is enabled with the aufs-enable.scc configuration fragment,
the init-live.sh script will use aufs to make a union mount.

Although overlayfs is not supported by Yocto kernel yet, this patch
still takes it into consideration with the expect that the related
code should at least serve as a placeholder.

[YOCTO #1487]
[YOCTO #4761]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   63 +++++++++++++++++---
 1 file changed, 56 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 00c2558..9804504 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -135,15 +135,64 @@ do
   sleep 1
 done
 
+# Try to make a union mount of the root image.
+# If no unification filesystem is available, mount the image read-only.
+mount_and_boot() {
+    mkdir $ROOT_MOUNT
+    mknod /dev/loop0 b 7 0 2>/dev/null
+
+    # determine which unification filesystem to use
+    union_fs_type=""
+    if grep -q -w "overlayfs" /proc/filesystems; then
+	union_fs_type="overlayfs"
+    elif grep -q -w "aufs" /proc/filesystems; then
+	union_fs_type="aufs"
+    else
+	union_fs_type=""
+    fi
+
+    # make a union mount if possible
+    case $union_fs_type in
+	"overlayfs")
+	    mkdir -p /rootfs.ro /rootfs.rw
+	    if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
+		rm -rf /rootfs.ro /rootfs.rw
+		fatal "Could not mount rootfs image"
+	    else
+		mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+		mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
+		mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+		mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+		mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+	    fi
+	    ;;
+	"aufs")
+	    mkdir -p /rootfs.ro /rootfs.rw
+	    if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
+		rm -rf /rootfs.ro /rootfs.rw
+		fatal "Could not mount rootfs image"
+	    else
+		mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
+		mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT
+		mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
+		mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
+		mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
+	    fi
+	    ;;
+	"")
+	    if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+		fatal "Could not mount rootfs image"
+	    fi
+	    ;;
+    esac
+
+    # boot the image
+    boot_live_root
+}
+
 case $label in
     boot)
-	mkdir $ROOT_MOUNT
-	mknod /dev/loop0 b 7 0 2>/dev/null
-	if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
-	    fatal "Could not mount rootfs image"
-	else
-	    boot_live_root
-	fi
+	mount_and_boot
 	;;
     install|install-efi)
 	if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-28  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28  7:48 [PATCH 0/2] live image: try to make a valid union mount Qi.Chen
2013-06-28  7:48 ` [PATCH 1/2] initrdscripts: unionfs cleanup Qi.Chen
2013-06-28  7:48 ` [PATCH 2/2] init-live.sh: try to make a union mount when possible Qi.Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.