init: Use image of read only file system in RAM if present
If a read-only file system image is in /run, specifically
/run/image-rofs, then mount it instead of the mtd partition.
This will allow running from ram to allow the flash to be updated,
either from a downloaded image, a packaged image, or an image
copied at boot.
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index d3b4b9f..538299e 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -159,6 +159,12 @@
fsck=$fsckbase$rwfst
fi
+if test -s /run/image-rofs
+then
+ rodev=/run/image-rofs
+ roopts=$roopts,loop
+fi
+
mount $rodev $rodir -t $rofst -o $roopts
if test -x $rodir$fsck