From deacdd3d6bf9a47d22d9dd2c7a058c7f11ee0449 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Tue, 6 Mar 2018 14:12:03 -0600 Subject: 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 --- .../flash/phosphor-software-manager/obmc-flash-bmc | 9 ++++++--- 1 file 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}")" -- cgit v1.2.3