build: install three targets to handle bmc updates
Transition from three service files to three targets installed by the
BMC library:
- phosphor-ipmi-flash-bmc-prepare.target
- phosphor-ipmi-flash-bmc-verify.target
- phosphor-ipmi-flash-bmc-update.target
The prepare target is started each time the firmware update state
machine changes from notYetStarted to uploadInProgress and can be
leveraged to free memory (flush caches) or anything else required.
The verify target is started when the verify blob is committed. The
implementation of services within this target are such that they are
expected to output a status value that's readable (typically via a
file).
The update target is started when the update blob is committed.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1e838de954a3cf8956ff4b72d090e253b832efe7
diff --git a/configure.ac b/configure.ac
index 2334814..e6a1a8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@
AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
# Checks for library functions.
-LT_INIT # Required for systemd linking
+LT_INIT
# Enable building the host tool (default: yes)
AC_ARG_ENABLE([build-host-tool],
@@ -60,6 +60,8 @@
# Build the BMC by default, so check if set to no.
AS_IF([test "x$enable_build_bmc_blob_handler" != "xno"], [
+ PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
+
PKG_CHECK_MODULES(
[SDBUSPLUS],
[sdbusplus],
@@ -74,6 +76,27 @@
[],
[AC_MSG_ERROR(["phosphor-ipmi-blobs required and not found."])]
)
+
+ PKG_PROG_PKG_CONFIG
+ AC_ARG_WITH([systemdsystemunitdir],
+ [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
+ [],
+ [with_systemdsystemunitdir=auto]
+ )
+ AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
+ [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+ AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+ [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
+ [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]
+ )
+ with_systemdsystemunitdir=no],
+ [with_systemdsystemunitdir="$def_systemdsystemunitdir"]
+ )]
+ )
+ AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
+ [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
+ )
+ AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
])
# If not building the host-tool, we're building the BMC.
@@ -246,16 +269,16 @@
AC_ARG_VAR(
PREPARATION_DBUS_SERVICE,
- [The systemd service started when the host starts to send an update.]
+ [The systemd target started when the host starts to send an update.]
)
AS_IF(
[test "x$PREPARATION_DBUS_SERVICE" == "x"],
- [PREPARATION_DBUS_SERVICE="prepare_update.service"]
+ [PREPARATION_DBUS_SERVICE="phosphor-ipmi-flash-bmc-prepare.target"]
)
AC_DEFINE_UNQUOTED(
[PREPARATION_DBUS_SERVICE],
["$PREPARATION_DBUS_SERVICE"],
- [The systemd service started when the host starts to send an update.]
+ [The systemd target started when the host starts to send an update.]
)
AC_ARG_VAR(
@@ -274,30 +297,30 @@
AC_ARG_VAR(
VERIFY_DBUS_SERVICE,
- [The systemd service started for verification.]
+ [The systemd target started for verification.]
)
AS_IF(
[test "x$VERIFY_DBUS_SERVICE" == "x"],
- [VERIFY_DBUS_SERVICE="verify_image.service"]
+ [VERIFY_DBUS_SERVICE="phosphor-ipmi-flash-bmc-verify.target"]
)
AC_DEFINE_UNQUOTED(
[VERIFY_DBUS_SERVICE],
["$VERIFY_DBUS_SERVICE"],
- [The systemd service started for verification.]
+ [The systemd target started for verification.]
)
AC_ARG_VAR(
UPDATE_DBUS_SERVICE,
- [The systemd service started for updating the BMC.]
+ [The systemd target started for updating the BMC.]
)
AS_IF(
[test "x$UPDATE_DBUS_SERVICE" == "x"],
- [UPDATE_DBUS_SERVICE="update_bmc.service"]
+ [UPDATE_DBUS_SERVICE="phosphor-ipmi-flash-bmc-update.target"]
)
AC_DEFINE_UNQUOTED(
[UPDATE_DBUS_SERVICE],
["$UPDATE_DBUS_SERVICE"],
- [The systemd service started for updating the BMC.]
+ [The systemd target started for updating the BMC.]
)
AC_CHECK_HEADER(linux/ipmi.h, [HAVE_LINUX_IPMI_H=""], [HAVE_LINUX_IPMI_H="-I linux/ipmi.h"])
@@ -432,4 +455,7 @@
AC_CONFIG_FILES([bmc/Makefile bmc/test/Makefile])
AC_CONFIG_FILES([tools/Makefile tools/test/Makefile])
AC_CONFIG_FILES([cleanup/Makefile cleanup/test/Makefile])
+AC_CONFIG_FILES([bmc/phosphor-ipmi-flash-bmc-prepare.target])
+AC_CONFIG_FILES([bmc/phosphor-ipmi-flash-bmc-verify.target])
+AC_CONFIG_FILES([bmc/phosphor-ipmi-flash-bmc-update.target])
AC_OUTPUT