bmc : add config-static-bmc-with-update-status.json.in
Add a default json file with update status (file path defined with
UPDATE_STATUS_FILENAME) enabled with --enable-update-status flag.
Change-Id: I62d3b547d91840451906e26cbec55dfa74934b5e
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/README.md b/README.md
index 1b4c244..954f7bd 100644
--- a/README.md
+++ b/README.md
@@ -172,6 +172,14 @@
------------------------ | -------
`--enable-reboot-update` | Enable use of reboot update mechanism.
+If you would like the update status to be tracked with a status file, this
+option can be enabled. Note that `--enable-update-status` option and the above
+`--enable-reboot-update` option cannot be enabled at the same time.
+
+Option | Meaning
+------------------------ | -------
+`--enable-update-status` | Enable use of update status file.
+
### Internal Configuration Details
The following variables can be set to whatever you wish, however they have
@@ -186,6 +194,7 @@
`VERIFY_STATUS_FILENAME` | `/tmp/bmc.verify` | The file checked for the verification status.
`VERIFY_DBUS_SERVICE` | `phosphor-ipmi-flash-bmc-verify.target` | The systemd target started for verification.
`UPDATE_DBUS_SERVICE` | `phosphor-ipmi-flash-bmc-update.target` | The systemd target started for updating the BMC.
+`UPDATE_STATUS_FILENAME` | `/tmp/bmc.update` | The file checked for the update status.
`BIOS_STAGED_NAME` | `/tmp/bios-image` | The file to use for staging the bios firmware update.
`BIOS_VERIFY_STATUS_FILENAME` | `/tmp/bios.verify` | The file checked for the verification status.
`PREPARATION_BIOS_TARGET` | `phosphor-ipmi-flash-bios-prepare.target` | The systemd target when the host starts to send an update.
diff --git a/bmc/Makefile.am b/bmc/Makefile.am
index f8db30b..52cab6e 100644
--- a/bmc/Makefile.am
+++ b/bmc/Makefile.am
@@ -13,9 +13,13 @@
if ENABLE_REBOOT_UPDATE
dist_pkgdata_DATA += config-static-bmc-reboot.json
else
+if ENABLE_UPDATE_STATUS
+dist_pkgdata_DATA += config-static-bmc-with-update-status.json
+else
dist_pkgdata_DATA += config-static-bmc.json
endif
endif
+endif
if ENABLE_HOST_BIOS
dist_pkgdata_DATA += config-bios.json
diff --git a/bmc/config-static-bmc-with-update-status.json.in b/bmc/config-static-bmc-with-update-status.json.in
new file mode 100644
index 0000000..65d856a
--- /dev/null
+++ b/bmc/config-static-bmc-with-update-status.json.in
@@ -0,0 +1,23 @@
+[{
+ "blob": "/flash/image",
+ "handler": {
+ "type": "file",
+ "path": "@STATIC_HANDLER_STAGED_NAME@"
+ },
+ "actions": {
+ "preparation": {
+ "type": "systemd",
+ "unit": "@PREPARATION_DBUS_SERVICE@"
+ },
+ "verification": {
+ "type": "fileSystemdVerify",
+ "unit": "@VERIFY_DBUS_SERVICE@",
+ "path": "@VERIFY_STATUS_FILENAME@"
+ },
+ "update": {
+ "type": "fileSystemdUpdate",
+ "unit": "@UPDATE_DBUS_SERVICE@",
+ "path": "@UPDATE_STATUS_FILENAME@"
+ }
+ }
+}]
\ No newline at end of file
diff --git a/cleanup/main.cpp b/cleanup/main.cpp
index 74612f6..95ab271 100644
--- a/cleanup/main.cpp
+++ b/cleanup/main.cpp
@@ -27,9 +27,9 @@
namespace ipmi_flash
{
-std::vector<std::string> files = {STATIC_HANDLER_STAGED_NAME,
- TARBALL_STAGED_NAME, HASH_FILENAME,
- VERIFY_STATUS_FILENAME};
+std::vector<std::string> files = {
+ STATIC_HANDLER_STAGED_NAME, TARBALL_STAGED_NAME, HASH_FILENAME,
+ VERIFY_STATUS_FILENAME, UPDATE_STATUS_FILENAME};
}
extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
diff --git a/configure.ac b/configure.ac
index e82aca7..f38c5f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,6 +154,15 @@
AX_APPEND_COMPILE_FLAGS([-DENABLE_REBOOT_UPDATE], [CXXFLAGS])
])
+# Enable the update with status file
+AC_ARG_ENABLE([update-status],
+ AS_HELP_STRING([--enable-update-status],
+ [Enable use of update status file.]))
+AM_CONDITIONAL([ENABLE_UPDATE_STATUS], [test "x$enable_update_status" = "xyes"])
+AS_IF([test "x$enable_update_status" = "xyes"], [
+ AX_APPEND_COMPILE_FLAGS([-DENABLE_UPDATE_STATUS], [CXXFLAGS])
+])
+
# Enable the cleanup handle that deletes the temporary files. (default: no)
AC_ARG_ENABLE([cleanup-delete],
AS_HELP_STRING([--enable-cleanup-delete],
@@ -377,6 +386,20 @@
)
AC_ARG_VAR(
+ UPDATE_STATUS_FILENAME,
+ [The file checked for the update status.]
+)
+AS_IF(
+ [test "x$UPDATE_STATUS_FILENAME" == "x"],
+ [UPDATE_STATUS_FILENAME="/tmp/bmc.update"]
+)
+AC_DEFINE_UNQUOTED(
+ [UPDATE_STATUS_FILENAME],
+ ["$UPDATE_STATUS_FILENAME"],
+ [The file checked for the update status.]
+)
+
+AC_ARG_VAR(
PREPARATION_BIOS_TARGET,
[The systemd target started when the host starts to send an update.]
)
@@ -556,5 +579,6 @@
AC_CONFIG_FILES([bmc/phosphor-ipmi-flash-bios-update.target])
AC_CONFIG_FILES([bmc/config-static-bmc-reboot.json])
AC_CONFIG_FILES([bmc/config-static-bmc.json])
+AC_CONFIG_FILES([bmc/config-static-bmc-with-update-status.json])
AC_CONFIG_FILES([bmc/config-bios.json])
AC_OUTPUT