Clear volatile PNOR partitions when required
The OpenPOWER host firmware requires OpenBMC to clear out certain
"volatile" sections of it's flash chip in certain scenarios:
- Any fresh power on
- Any boot/reboot of the server where a certain "volatile" sensor is
enabled
This commit utilizes the obmc-host-start target, which is only run during
fresh power on operations, to ensure the volatile sensor is set. The new
obmc-host-startmin target is then utilized to check for this sensor and
clear the host volatile flash sections if the sensor is set. In this
way, the volatile flash sections are cleared on all fresh power on
operations and in any reboot loop that the host has set the sensor.
Testing:
- Clean Power On (cleared as expected)
Starting Enable the clearing of the Volatile PNOR partitions in host0...
Started Enable the clearing of the Volatile PNOR partitions in host0.
Starting Clear the Volatile PNOR partitions in host0 if Enabled...
Clear /var/lib/phosphor-software-manager/pnor/rw/HB_VOLATILE
Started Clear the Volatile PNOR partitions in host0 if Enabled.
- Host Reboot with host running (cleared as expected)
Starting Clear the Volatile PNOR partitions in host0 if Enabled...
Clear /var/lib/phosphor-software-manager/pnor/rw/HB_VOLATILE
Started Clear the Volatile PNOR partitions in host0 if Enabled.
- Reboot during hostboot, before istep 16 (nothing cleared as expected)
Starting Clear the Volatile PNOR partitions in host0 if Enabled...
Started Clear the Volatile PNOR partitions in host0 if Enabled.
Resolves openbmc/openbmc#2397
Change-Id: I56a897ce8919a95f9e80ab730ecabf880723f1f6
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
index 2b8c841..93dc56e 100644
--- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager.bb
@@ -52,4 +52,19 @@
obmc-flash-bios-updatesymlinks.service \
obmc-flash-bios-ubiclear@.service \
obmc-flash-bios-cleanup.service \
+ obmc-flash-bios-enable-clearvolatile@.service \
+ obmc-flash-bios-check-clearvolatile@.service \
"
+
+ENABLE_CLEAR_VOLATILE_TMPL = "obmc-flash-bios-enable-clearvolatile@.service"
+HOST_START_TGTFMT = "obmc-host-start@{0}.target"
+ENABLE_CLEAR_VOLATILE_INSTFMT = "obmc-flash-bios-enable-clearvolatile@{0}.service"
+ENABLE_CLEAR_VOLATILE_START_FMT = "../${ENABLE_CLEAR_VOLATILE_TMPL}:${HOST_START_TGTFMT}.requires/${ENABLE_CLEAR_VOLATILE_INSTFMT}"
+
+CHECK_CLEAR_VOLATILE_TMPL = "obmc-flash-bios-check-clearvolatile@.service"
+HOST_STARTMIN_TGTFMT = "obmc-host-startmin@{0}.target"
+CHECK_CLEAR_VOLATILE_INSTFMT = "obmc-flash-bios-check-clearvolatile@{0}.service"
+CHECK_CLEAR_VOLATILE_START_FMT = "../${CHECK_CLEAR_VOLATILE_TMPL}:${HOST_STARTMIN_TGTFMT}.requires/${CHECK_CLEAR_VOLATILE_INSTFMT}"
+
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'ENABLE_CLEAR_VOLATILE_START_FMT', 'OBMC_HOST_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'CHECK_CLEAR_VOLATILE_START_FMT', 'OBMC_HOST_INSTANCES')}"