summaryrefslogtreecommitdiffstats
path: root/pyflashbmc
diff options
context:
space:
mode:
authorMilton Miller <miltonm@us.ibm.com>2017-08-15 06:57:14 +0000
committerMilton Miller <miltonm@us.ibm.com>2017-08-15 16:19:35 -0500
commit3fc6b790e64f1ba801eb9081642af64152ed8e1a (patch)
treee39f703a815956c43976a367101975dce41a18d0 /pyflashbmc
parent62d11c3e0d98e9a3f8908ec934698f90a55435fb (diff)
downloadtalos-skeleton-3fc6b790e64f1ba801eb9081642af64152ed8e1a.tar.gz
talos-skeleton-3fc6b790e64f1ba801eb9081642af64152ed8e1a.zip
bmc_update: explictly save firmware environment
Find the file to copy from the firmware environent config, and assume the complete file should be saved as an image to the u-boot-env mtd partition. Preserve network settings has worked to save the u-boot-env by copying the runtime copy of the env saved by the initramfs init script to /run/fw_env. That copy was created as a workaround for a flash erase problem that can not be created with the current driver. Change-Id: Ie42ddbb4f821447349f70ab21d1333194aba08cf Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Diffstat (limited to 'pyflashbmc')
-rw-r--r--pyflashbmc/bmc_update.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/pyflashbmc/bmc_update.py b/pyflashbmc/bmc_update.py
index c1c04ec..56940fe 100644
--- a/pyflashbmc/bmc_update.py
+++ b/pyflashbmc/bmc_update.py
@@ -27,6 +27,25 @@ def doExtract(members, files):
yield tarinfo
+def save_fw_env():
+ fw_env = "/etc/fw_env.config"
+ lines = 0
+ files=[]
+ envcfg = open(fw_env, 'r')
+ try:
+ for line in envcfg.readlines():
+ # ignore lines that are blank or start with #
+ if (line.startswith("#")): continue
+ if (not len(line.strip())): continue
+ fn = line.partition("\t")[0];
+ files.append(fn)
+ lines += 1
+ finally:
+ envcfg.close()
+ if (lines < 1 or lines > 2 or (lines == 2 and files[0] != files[1])):
+ raise Exception("Error parsing %s\n" % fw_env)
+ shutil.copyfile(files[0], os.path.join(UPDATE_PATH, "image-u-boot-env"))
+
class BmcFlashControl(DbusProperties, DbusObjectManager):
def __init__(self, bus, name):
super(BmcFlashControl, self).__init__(
@@ -138,7 +157,7 @@ class BmcFlashControl(DbusProperties, DbusObjectManager):
if self.Get(DBUS_NAME, "preserve_network_settings"):
print "Preserving network settings"
- shutil.copy2("/run/fw_env", UPDATE_PATH+"/image-u-boot-env")
+ save_fw_env()
except Exception as e:
print e
OpenPOWER on IntegriCloud