fw_update: add pre-post update conditions
Description: This commit introduces the concept of pre and post update conditions in the firmware update process to meet the code-update design[1]. Allow platform specific systemd units to run before an update starts and after an update has finished successfully. A pre-update condition is executed before the firmware update flow starts, and a failing one aborts the update. A post-update condition is executed only after the update has succeeded, as defined by the design; no condition is executed once the update itself has failed. [1]: https://github.com/openbmc/docs/blob/master/designs/code-update.md#pre-and-post-update-conditions - Added a new JSON schema for defining pre and post update conditions - A condition service that needs arguments is configured as a systemd template unit and receives all supported named arguments as its escaped instance name Motivation: The firmware update process may require certain conditions to be met before and after the update. This feature allows for greater flexibility and control over the update process, ensuring that the system is in a valid state before and after the update. Tested: Platform: Yosemite 4, Sentinel Dome T2 in slot 1, BIC firmware update over PLDM (EID 10, ast1030 v2023SD). - Parameterized post update condition: pldm resolved yv4-bic-post-update@.service into the escaped instance boardName=Yosemite_4_Sentinel_Dome_T2_Slot_1,applyTime=OnReset, systemd job 34591 returned "done" and the update completed. - Non parameterized pre update condition: pldm started yv4-bic-pre-update.service without an instance name, dropping the arguments as expected, job 21105 returned "done" and the update proceeded into the transfer. - No condition configured: with both targets omitted for the component, both conditions were skipped and the update still completed, so the base update flow is unaffected. - Unit tests pass in the OpenBMC unit test container, with the format and cppcheck stages clean. Not covered on hardware: a condition that fails, a condition unit that hits its start timeout, and a manager erased while its condition is still running. Change-Id: Ie862c8ec6aa41db3239a6e7438953326e99a7bc3 Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
U
Unive Tien committed
ea365dcadbac0ec5436603baf3db2911695801ca
Parent: 7dabc62