initfs: Mount ro and rw filesystems under /run/mnt
Experiment with ro and rw under /run/mnt instead of the api instead of
under the API directory /run/initramfs to avoid confusion with the bind
mount systemd does to pivot_root into shutdown.
Explictly create the api directory, leave commented out lines to revert
and or mount either a tmpfs or just the bind mount ourselves for simple
editing.
Teach update to use the new location if the mount exists.
Signed-off-by: Milton Miller <mdmii@outlook.com>
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
index 3df371f..ad73a55 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
@@ -1,8 +1,11 @@
#!/bin/sh
fslist="proc sys dev run"
-rodir=run/initramfs/ro
-rwdir=run/initramfs/rw
+api=run/initramfs
+#mnt=$api
+mnt=run/mnt
+rodir=$mnt/ro
+rwdir=$mnt/rw
upper=$rwdir/cow
work=$rwdir/work
@@ -12,14 +15,22 @@
mount dev dev -tdevtmpfs
mount sys sys -tsysfs
mount proc proc -tproc
+if grep $api proc/mounts
+then
+ umount $api
+fi
if ! grep run proc/mounts
then
mount tmpfs run -t tmpfs -o mode=755,nodev
fi
+mkdir -p $api
+#mount initrd $api -t tmpfs
+#mount --bind $api $api
+cp -rp init shutdown update whitelist bin sbin usr lib etc var $api
+
mkdir -p $rodir $rwdir
-cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs
# To start a interactive shell with job control at this point, run
# getty 38400 ttyS4
@@ -180,17 +191,18 @@
roopts=ro
rwopts=rw
-image=/run/initramfs/image-
+image=$api/image-
+update=$api/update
trigger=${image}rwfs
init=/sbin/init
fsckbase=/sbin/fsck.
fsck=$fsckbase$rwfst
fsckopts=-a
+
optfile=/run/initramfs/init-options
optbase=/run/initramfs/init-options-base
urlfile=/run/initramfs/init-download-url
-update=/run/initramfs/update
if test -e /${optfile##*/}
then
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh
index 9f3b587..f67d292 100755
--- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh
@@ -88,6 +88,11 @@
rorwopts=ro${rwopts#rw}
rwdir=/run/initramfs/rw
+rwalt=/run/mnt/rw
+if test -d $rwalt
+then
+ rwdir="$rwalt"
+fi
upper=$rwdir/cow
save=/run/save/${upper##*/}