bmc_update.py: Call fw_setenv twice for PrepareForUpdate
Support for u-boot redundant environment variables was
added where u-boot alternates writing to each environment
every time an variable is written. But initramfs doesn't
know which environment is active so it always reads from
the same one. Therefore need to twice set the
environments that initramfs reads so that they're written
to both environments and initramfs can read it.
Part of openbmc/openbmc#2292
Change-Id: Ifaa9a55067cdd2f42b534b680809552f6574a56a
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/pyflashbmc/bmc_update.py b/pyflashbmc/bmc_update.py
index 56940fe..a83eafe 100644
--- a/pyflashbmc/bmc_update.py
+++ b/pyflashbmc/bmc_update.py
@@ -301,6 +301,13 @@
"fw_setenv",
"openbmconce",
"copy-files-to-ram copy-base-filesystem-to-ram"])
+ # Set the variable twice so that it is written to both environments of
+ # the u-boot redundant environment variables since initramfs can only
+ # read one of the environments.
+ subprocess.call([
+ "fw_setenv",
+ "openbmconce",
+ "copy-files-to-ram copy-base-filesystem-to-ram"])
self.Set(DBUS_NAME, "status", "Switch to update mode in progress")
o = bus.get_object(BMC_DBUS_NAME, BMC_OBJ_NAME)
intf = dbus.Interface(o, BMC_DBUS_NAME)