diff options
author | Lei YU <mine260309@gmail.com> | 2018-07-19 15:41:44 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-08-20 14:33:27 +0800 |
commit | 28b2ba4a2dc75d56d9a52686b67d752b735cd260 (patch) | |
tree | d7b4bf604b5a467f2e9c55a855843a2f0c150e3c | |
parent | 87c781732247086a56d8f8cb4360c6eb4863f658 (diff) | |
download | phosphor-bmc-code-mgmt-28b2ba4a2dc75d56d9a52686b67d752b735cd260.tar.gz phosphor-bmc-code-mgmt-28b2ba4a2dc75d56d9a52686b67d752b735cd260.zip |
static layout: support factory reset
Implement factory reset for static flash layout, that starts
obmc-flash-bmc-setenv to set factory-reset u-boot env and let
init to do the cleanup.
Tested: Invoke factory reset on /xyz/openbmc_project/software and verify
everything in rwfs is deleted, and after reboot, the BMC acts
like a fresh new one.
Change-Id: I20e361519af6c3c12703315070debabd8cf88060
Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r-- | static/item_updater_helper.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/static/item_updater_helper.cpp b/static/item_updater_helper.cpp index e639e63..19ac61d 100644 --- a/static/item_updater_helper.cpp +++ b/static/item_updater_helper.cpp @@ -1,3 +1,4 @@ +#include "config.h" #include "item_updater_helper.hpp" namespace phosphor @@ -6,6 +7,10 @@ namespace software { namespace updater { +// openbmconce=clean-rwfs-filesystem factory-reset +#define ENV_FACTORY_RESET "openbmconce\\x3dfactory\\x2dreset" +#define SERVICE_FACTORY_RESET \ + "obmc-flash-bmc-setenv@" ENV_FACTORY_RESET ".service" void Helper::setEntry(const std::string& entryId, uint8_t value) { @@ -24,7 +29,12 @@ void Helper::cleanup() void Helper::factoryReset() { - // TODO + // Set openbmconce=factory-reset env in U-Boot. + // The init will cleanup rwfs during boot. + auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, + SYSTEMD_INTERFACE, "StartUnit"); + method.append(SERVICE_FACTORY_RESET, "replace"); + bus.call_noreply(method); } void Helper::removeVersion(const std::string& versionId) |