summaryrefslogtreecommitdiff
path: root/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
diff options
context:
space:
mode:
authorMichael Tritz <mtritz@us.ibm.com>2017-07-14 00:26:15 +0300
committerPatrick Williams <patrick@stwcx.xyz>2017-07-24 21:58:57 +0300
commit9196bc389d1080e937381af78c3535e9c9f02ece (patch)
tree6fee0cf6702ae0dd2c438b42878f7a52e640718a /meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
parent3fb3920d7587fc82f28a51a96fbbf7ff81f97415 (diff)
downloadopenbmc-9196bc389d1080e937381af78c3535e9c9f02ece.tar.xz
BMC Code Mgmt: Service files for factory reset
This commit extends the obmc-flash-bmc script and includes a pair of service files. A U-Boot environment variable will be set to indicate that the BMC read-write volume needs to be reset. When this variable is present, the read-write volume will be removed and recreated. Change-Id: I6e39727cd3898d66bdbc63e9071f3a8b20a77673 Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc')
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index a451503277..5c960f3b85 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -21,6 +21,11 @@ ubi_rw() {
rw="${rwmtd#mtd}"
ubidev="/dev/ubi${rw}"
+ if [ "$(fw_printenv rwreset)" == "rwreset=true" ]; then
+ ubi_remove
+ fw_setenv rwreset
+ fi
+
# Create a ubi volume of size 4MB, that is the current size of the rwfs image
vol="$(findubi "${name}")"
if [ -z "${vol}" ]; then
@@ -59,6 +64,28 @@ ubi_updatevol() {
ubiupdatevol "/dev/ubi${ubidevid}" "${img}"
}
+ubi_remove() {
+ vol="$(findubi "${name}")"
+
+ if [ ! -z "$vol" ]; then
+ vol="${vol%_*}"
+
+ if grep -q "${vol}:$name" /proc/mounts; then
+ mountdir=$(grep "${vol}:$name" /proc/mounts | cut -d " " -f 2)
+ umount "$mountdir"
+ rm -r "$mountdir"
+ fi
+
+ ubirmvol "/dev/${vol}" -N "$name"
+ fi
+}
+
+ubi_setenv() {
+ varName="${variable%"\x3d"*}"
+ value="${variable##*"\x3d"}"
+ fw_setenv "$varName" "$value"
+}
+
case "$1" in
ubirw)
reqmtd="$2"
@@ -84,6 +111,14 @@ case "$1" in
ubi_ro
ubi_updatevol
;;
+ ubiremove)
+ name="$2"
+ ubi_remove
+ ;;
+ ubisetenv)
+ variable="$2"
+ ubi_setenv
+ ;;
*)
echo "Invalid argument"
exit 1