summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2018-03-06 23:12:03 +0300
committerAdriana Kobylak <anoo@us.ibm.com>2018-03-08 17:27:02 +0300
commitdeacdd3d6bf9a47d22d9dd2c7a058c7f11ee0449 (patch)
treeb64301def6729a1477f5f818922a057902ad593d
parent455adc7d4396de8746f4dfc1e9a341b3e48a9217 (diff)
downloadopenbmc-deacdd3d6bf9a47d22d9dd2c7a058c7f11ee0449.tar.xz
obmc-flash-bmc: Ignore error if rwfs_size is not set
Ignore the return code of fw_printenv in case rwfs_size doesn't exist, otherwise the function fails and doesn't get set. Also check that the imgsize variable is set before calling fw_setenv to prevent accidentally clearing the rwfs_size. Tested: Verified that rwfs_size gets set when it didn't exist. Also that it gets updated when the value is different than the one passed. And that it doesn't get cleared if the function is called without passing the imgsize argument. Change-Id: I02e3414e3b22da55890b7343b8805402139b6bad Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rw-r--r--meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc9
1 files changed, 6 insertions, 3 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 d570e83e1..26b83e664 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
@@ -108,9 +108,12 @@ ubi_rw() {
rw="${rwmtd#mtd}"
ubidev="/dev/ubi${rw}"
- rwsize="$(fw_printenv -n rwfs_size)"
- if [[ "${imgsize}" != "${rwsize}" ]]; then
- fw_setenv rwfs_size "${imgsize}"
+ # Update rwfs_size, check imgsize was specified, otherwise it'd clear the var
+ if [ ! -z "$imgsize" ]; then
+ rwsize="$(fw_printenv -n rwfs_size 2>/dev/null)" || true
+ if [[ "${imgsize}" != "${rwsize}" ]]; then
+ fw_setenv rwfs_size "${imgsize}"
+ fi
fi
vol="$(findubi "${name}")"