[2/4] initramfs-module-setup-live: add realroot

Submitted by Hongxu Jia on Dec. 3, 2018, 10:13 a.m. | Patch ID: 156816

Details

Message ID 1543832010-8787-2-git-send-email-hongxu.jia@windriver.com
State New
Headers show

Commit Message

Hongxu Jia Dec. 3, 2018, 10:13 a.m.
The setup-live module of initramfs-framework is introduced to integrate
the functionality of init-live.sh, but it missed to create /media/realroot

Refer init-live.sh, add scriptlet named `realroot' after scriptlet `union-fs'

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 .../initrdscripts/initramfs-framework/realroot             | 14 ++++++++++++++
 .../initrdscripts/initramfs-module-setup-live_1.0.bb       |  3 +++
 2 files changed, 17 insertions(+)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/realroot

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/realroot b/meta/recipes-core/initrdscripts/initramfs-framework/realroot
new file mode 100644
index 0000000..19ff855
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/realroot
@@ -0,0 +1,14 @@ 
+realroot_enabled() {
+    return 0
+}
+
+realroot_run() {
+    for i in `ls /run/media 2>/dev/null`; do
+        if [ -f /run/media/$i/rootfs.img -o -f /run/media/$i/isolinux/rootfs.img ] ; then
+            echo "Move /run/media/$i to /media/realroot"
+            mkdir -p  $ROOTFS_DIR/media/realroot
+            mount -n --move "/run/media/$i" $ROOTFS_DIR/media/realroot
+            break
+        fi
+    done
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
index 30831c2..c0ebd40 100644
--- a/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
@@ -10,6 +10,7 @@  inherit allarch
 FILESEXTRAPATHS_prepend := "${THISDIR}/initramfs-framework:"
 SRC_URI = "file://setup-live \
            file://union-fs \
+           file://realroot \
 "
 
 S = "${WORKDIR}"
@@ -18,8 +19,10 @@  do_install() {
     install -d ${D}/init.d
     install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live
     install -m 0755 ${WORKDIR}/union-fs ${D}/init.d/91-union-fs
+    install -m 0755 ${WORKDIR}/realroot ${D}/init.d/92-realroot
 }
 
 FILES_${PN} = "/init.d/80-setup-live \
                /init.d/91-union-fs \
+               /init.d/92-realroot \
               "