obmc-flash-bmc: write variables twice to ensure both banks are correct

The U-Boot environment maintains two banks of environment variables. The
banks need to be consistent with each other to ensure that these
variables can be reliably read from file, as they would be in the
context of a C++ program. In order to guarantee that the two banks are
both correct, we need to run fw_setenv twice when writing environment
variables.

This change accompanies a change to phosphor-bmc-code-mgmt for
openbmc/openbmc#2666.

Change-Id: I72d7fd79faf271d017703464fd9ad0cd20f4e2a0
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 40ec068..da62b10 100644
--- a/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -259,13 +259,19 @@
 }
 
 ubi_setenv() {
+    # The U-Boot environment maintains two banks of environment variables.
+    # The banks need to be consistent with each other to ensure that these
+    # variables can reliably be read from file. In order to guarantee that the
+    # banks are both correct, we need to run fw_setenv twice.
     variable=$1
     if [[ "$variable" == *"="* ]]; then
         varName="${variable%=*}"
         value="${variable##*=}"
         fw_setenv "$varName" "$value"
+        fw_setenv "$varName" "$value"
     else
         fw_setenv "$variable"
+        fw_setenv "$variable"
     fi
 }