[PATCH openbmc v2 25/34] init: Add option to copy base read-only filesystem into RAM

OpenBMC Patches openbmc-patches at stwcx.xyz
Tue Mar 8 08:30:14 AEDT 2016


From: "Milton D. Miller II" <miltonm at us.ibm.com>

If copy-base-filesystem-to-ram is found copy the read-only
filesystem source device to /run/image-rofs.  If the copy fails
then remove the partial copy and invoke debug takeover.

This will allow a new image to be downloaded and flashed while
running from the existing copy for the duration of this boot.

Alternatively with the overlay also in RAM pflash could be used
to update the flash from the host as the BMC would no longer need
the flash or flash controller.

Signed-off-by: Milton Miller <miltonm at us.ibm.com>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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 2e8467c..f6a6b7b 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
@@ -169,6 +169,18 @@ then
 	rwfst=none
 fi
 
+if grep -w copy-base-filesystem-to-ram $optfile &&
+	test ! -e /run/image-rofs && ! cp $rodev /run/image-rofs
+then
+	# Remove any partial copy to avoid attempted usage later
+	if test -e  /run/image-rofs
+	then
+		ls -l /run/image-rofs
+		rm -f /run/image-rofs
+	fi
+	debug_takeover "Copying $rodev to /run/image-rofs failed."
+fi
+
 if test -s /run/image-rofs
 then
 	rodev=/run/image-rofs
-- 
2.7.1




More information about the openbmc mailing list