phosphor-host-postd: allow configuring the daemon

This adds variables to the recipe file which specify the name of the LPC
snoop device and the number of bytes per POST code. The variables can be
easily overridden in a platform-specific bbappend.

Change-Id: Ia7778a72b62225238d2142c62b8e88e5e8ca33ee
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
diff --git a/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd.bb b/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd.bb
index 3edf1e7..92ff489 100644
--- a/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd.bb
+++ b/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd.bb
@@ -12,7 +12,13 @@
 
 RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
 
-SYSTEMD_SERVICE_${PN} += "lpcsnoop.service"
+SNOOP_DEVICE ?= "aspeed-lpc-snoop0"
+POST_CODE_BYTES ?= "1"
+
+SERVICE_FILE = "lpcsnoop.service"
+SYSTEMD_SERVICE_${PN} += "${SERVICE_FILE}"
+SYSTEMD_SUBSTITUTIONS += "SNOOP_DEVICE:${SNOOP_DEVICE}:${SERVICE_FILE}"
+SYSTEMD_SUBSTITUTIONS += "POST_CODE_BYTES:${POST_CODE_BYTES}:${SERVICE_FILE}"
 
 require ${PN}.inc
 
diff --git a/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd/lpcsnoop.service b/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd/lpcsnoop.service
index 23dfd98..117702c 100644
--- a/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd/lpcsnoop.service
+++ b/meta-phosphor/common/recipes-phosphor/host/phosphor-host-postd/lpcsnoop.service
@@ -4,7 +4,7 @@
 
 [Service]
 Restart=always
-ExecStart={sbindir}/snoopd
+ExecStart={sbindir}/snoopd -d "/dev/{SNOOP_DEVICE}" -b "{POST_CODE_BYTES}"
 
 [Install]
 WantedBy={SYSTEMD_DEFAULT_TARGET}