Merge pull request #21 from bradbishop/master

Add IPMI to build
diff --git a/classes/obmc-phosphor-c-daemon.bbclass b/classes/obmc-phosphor-c-daemon.bbclass
index e21d17c..0ceed96 100644
--- a/classes/obmc-phosphor-c-daemon.bbclass
+++ b/classes/obmc-phosphor-c-daemon.bbclass
@@ -4,14 +4,12 @@
 inherit obmc-phosphor-license
 
 DEPENDS += "glib-2.0"
-SRC_URI += " \
-        file://Makefile \
-        file://${PN}.c \
-        "
-S = "${WORKDIR}"
+
+INSTALL_NAME ?= "${PN}"
+BIN_NAME ?= "${INSTALL_NAME}"
 
 do_install_append() {
         # install the binary
         install -d ${D}${sbindir}
-        install -m 0755 ${WORKDIR}/${PN} ${D}${sbindir}
+        install -m 0755 ${S}/${BIN_NAME} ${D}${sbindir}/${INSTALL_NAME}
 }
diff --git a/classes/obmc-phosphor-chassis-mgmt.bbclass b/classes/obmc-phosphor-chassis-mgmt.bbclass
index 377da0a..edf18c0 100644
--- a/classes/obmc-phosphor-chassis-mgmt.bbclass
+++ b/classes/obmc-phosphor-chassis-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC chassis management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-chassis-mgmt"
+PROVIDES += "virtual/obmc-phosphor-chassis-mgmt"
diff --git a/classes/obmc-phosphor-event-mgmt.bbclass b/classes/obmc-phosphor-event-mgmt.bbclass
index 01f2edf..afab38f 100644
--- a/classes/obmc-phosphor-event-mgmt.bbclass
+++ b/classes/obmc-phosphor-event-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC event management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-event-mgmt"
+PROVIDES += "virtual/obmc-phosphor-event-mgmt"
diff --git a/classes/obmc-phosphor-fan-mgmt.bbclass b/classes/obmc-phosphor-fan-mgmt.bbclass
index 973376d..2e64773 100644
--- a/classes/obmc-phosphor-fan-mgmt.bbclass
+++ b/classes/obmc-phosphor-fan-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC fan management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-fan-mgmt"
+PROVIDES += "virtual/obmc-phosphor-fan-mgmt"
diff --git a/classes/obmc-phosphor-flash-mgmt.bbclass b/classes/obmc-phosphor-flash-mgmt.bbclass
index d166949..4898c20 100644
--- a/classes/obmc-phosphor-flash-mgmt.bbclass
+++ b/classes/obmc-phosphor-flash-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC flash management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-flash-mgmt"
+PROVIDES += "virtual/obmc-phosphor-flash-mgmt"
diff --git a/classes/obmc-phosphor-host-ipmi-hw.bbclass b/classes/obmc-phosphor-host-ipmi-hw.bbclass
new file mode 100644
index 0000000..974c010
--- /dev/null
+++ b/classes/obmc-phosphor-host-ipmi-hw.bbclass
@@ -0,0 +1,4 @@
+# Common code for recipes that implement Phosphor OpenBMC IPMI HW to DBUS translation.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-host-ipmi-hw"
+PROVIDES += "virtual/obmc-phosphor-host-ipmi-hw"
diff --git a/classes/obmc-phosphor-policy-mgmt.bbclass b/classes/obmc-phosphor-policy-mgmt.bbclass
index 86e0cbe..35397b8 100644
--- a/classes/obmc-phosphor-policy-mgmt.bbclass
+++ b/classes/obmc-phosphor-policy-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC policy management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-policy-mgmt"
+PROVIDES += "virtual/obmc-phosphor-policy-mgmt"
diff --git a/classes/obmc-phosphor-py-daemon.bbclass b/classes/obmc-phosphor-py-daemon.bbclass
index 35c2714..9cb8bfd 100644
--- a/classes/obmc-phosphor-py-daemon.bbclass
+++ b/classes/obmc-phosphor-py-daemon.bbclass
@@ -5,13 +5,11 @@
 inherit obmc-phosphor-license
 
 RDEPENDS_${PN} += "python-dbus python-pygobject"
-SRC_URI += " \
-        file://${PN}.py \
-        "
-S = "${WORKDIR}"
+INSTALL_NAME ?= "${PN}"
+SCRIPT_NAME ?= "${INSTALL_NAME}.py"
 
 do_install_append() {
         # install the script
         install -d ${D}${sbindir}
-        install -m 0755 ${WORKDIR}/${PN}.py ${D}${sbindir}/${PN}
+        install -m 0755 ${S}/${SCRIPT_NAME} ${D}${sbindir}/${INSTALL_NAME}
 }
diff --git a/classes/obmc-phosphor-sensor-mgmt.bbclass b/classes/obmc-phosphor-sensor-mgmt.bbclass
index 9939386..0d9982e 100644
--- a/classes/obmc-phosphor-sensor-mgmt.bbclass
+++ b/classes/obmc-phosphor-sensor-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC sensor management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-sensor-mgmt"
+PROVIDES += "virtual/obmc-phosphor-sensor-mgmt"
diff --git a/classes/obmc-phosphor-system-mgmt.bbclass b/classes/obmc-phosphor-system-mgmt.bbclass
index 4939d2f..07c89c4 100644
--- a/classes/obmc-phosphor-system-mgmt.bbclass
+++ b/classes/obmc-phosphor-system-mgmt.bbclass
@@ -1,3 +1,4 @@
 # Common code for recipes that implement Phosphor OpenBMC system management.
 
 RPROVIDES_${PN} += "virtual/obmc-phosphor-system-mgmt"
+PROVIDES += "virtual/obmc-phosphor-system-mgmt"
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmi-bt.bb b/common/recipes-phosphor/host-ipmid/host-ipmi-bt.bb
new file mode 100644
index 0000000..830f754
--- /dev/null
+++ b/common/recipes-phosphor/host-ipmid/host-ipmi-bt.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Phosphor OpenBMC BT to DBUS"
+DESCRIPTION = "Phosphor OpenBMC BT to DBUS."
+PR = "r1"
+
+RDEPENDS_${PN} += "python-subprocess"
+
+SYSTEMD_SERVICE_${PN} = "host-ipmi-bt.service"
+
+inherit obmc-phosphor-pydbus-service
+inherit obmc-phosphor-host-ipmi-hw
+
+S = "${WORKDIR}/git"
+SRC_URI += "git://github.com/openbmc/skeleton.git;subpath=bin;destsuffix=git"
+SRCREV="${AUTOREV}"
+
+SCRIPT_NAME = "ipmid.py"
+INSTALL_NAME = "host-ipmi-bt"
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmi-bt/host-ipmi-bt.service b/common/recipes-phosphor/host-ipmid/host-ipmi-bt/host-ipmi-bt.service
new file mode 100644
index 0000000..dfc0416
--- /dev/null
+++ b/common/recipes-phosphor/host-ipmid/host-ipmi-bt/host-ipmi-bt.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Phosphor OpenBMC BT to DBUS 
+
+[Service]
+ExecStart=/usr/sbin/host-ipmi-bt
+
+[Install]
+WantedBy=multi-user.target
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example.bb b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example.bb
new file mode 100644
index 0000000..c979110
--- /dev/null
+++ b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Phosphor OpenBMC host IPMI to DBUS Example"
+DESCRIPTION = "Phosphor OpenBMC host IPMI to DBUS example implementation."
+PR = "r1"
+
+RDEPENDS_${PN} += "python-subprocess"
+
+SYSTEMD_SERVICE_${PN} = "host-ipmi-hw.service"
+
+inherit obmc-phosphor-pydbus-service
+inherit obmc-phosphor-host-ipmi-hw
+
+S = "${WORKDIR}/git"
+SRC_URI += "git://github.com/openbmc/skeleton.git;subpath=bin;destsuffix=git"
+SRC_URI += "file://systembus.patch"
+SRCREV="${AUTOREV}"
+
+SCRIPT_NAME = "ipmi_debug.py"
+INSTALL_NAME = "host-ipmi-hw"
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service
new file mode 100644
index 0000000..b6baa6f
--- /dev/null
+++ b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Phosphor OpenBMC host IPMI to DBUS example implementation
+
+[Service]
+ExecStart=/usr/sbin/host-ipmi-hw
+
+[Install]
+WantedBy=multi-user.target
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/systembus.patch b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/systembus.patch
new file mode 100644
index 0000000..402816a
--- /dev/null
+++ b/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/systembus.patch
@@ -0,0 +1,11 @@
+--- a/ipmi_debug.py
++++ b/ipmi_debug.py
+@@ -69,7 +69,7 @@ class ConsoleReader(object):
+ 
+ def main():
+     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+-    bus = dbus.SessionBus()
++    bus = dbus.SystemBus()
+     name = dbus.service.BusName(DBUS_NAME, bus)
+     obj = IpmiDebug(bus, OBJ_NAME)
+     mainloop = gobject.MainLoop()
diff --git a/common/recipes-phosphor/host-ipmid/host-ipmid.bb b/common/recipes-phosphor/host-ipmid/host-ipmid.bb
index 5e7ad64..ab3a1cb 100644
--- a/common/recipes-phosphor/host-ipmid/host-ipmid.bb
+++ b/common/recipes-phosphor/host-ipmid/host-ipmid.bb
@@ -3,19 +3,20 @@
 HOMEPAGE = "http://github.com/openbmc/phosphor-host-ipmid"
 PR = "r1"
 
+RRECOMMENDS_${PN} = "virtual/obmc-phosphor-host-ipmi-hw"
+
 inherit obmc-phosphor-license
 inherit obmc-phosphor-sdbus-service
+inherit obmc-phosphor-c-daemon
 
 SRC_URI += "git://github.com/openbmc/phosphor-host-ipmid"
 
 SRCREV = "98900a99254cd177c8308b63c341f793d2ac119d"
 
 S = "${WORKDIR}/git"
+INSTALL_NAME = "ipmid"
 
 do_install() {
-        install -m 0755 -d ${D}${sbindir}
-        install -m 0755 ${S}/ipmid ${D}${sbindir}/
-
         install -m 0755 -d ${D}${libdir}/host-ipmid
         install -m 0755 ${S}/*.so ${D}${libdir}/host-ipmid/
 
diff --git a/common/recipes-phosphor/host-ipmid/files/host-ipmid.service b/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
similarity index 65%
rename from common/recipes-phosphor/host-ipmid/files/host-ipmid.service
rename to common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
index 0636f12..ee9ce1a 100644
--- a/common/recipes-phosphor/host-ipmid/files/host-ipmid.service
+++ b/common/recipes-phosphor/host-ipmid/host-ipmid/host-ipmid.service
@@ -1,5 +1,5 @@
 [Unit]
-Description="Phosphor OpenBMC IPMI daemon"
+Description=Phosphor OpenBMC IPMI daemon
 
 [Service]
 ExecStart=/usr/sbin/ipmid
diff --git a/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb b/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
index ad642a3..d7a8ed9 100644
--- a/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
+++ b/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-chassis-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb b/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
index 998648c..b5a54da 100644
--- a/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
+++ b/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-event-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb b/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
index c140c9b..1446a73 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
+++ b/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
@@ -11,8 +11,10 @@
 
 client = "pyclient-sample"
 SRC_URI += "file://${client}.py"
+SRC_URI += "file://${PN}.py"
+S = "${WORKDIR}"
 
 do_install_append() {
         install -d ${D}${bindir}
-        install -m 0755 ${WORKDIR}/${client}.py ${D}${bindir}/${client}
+        install -m 0755 ${S}/${client}.py ${D}${bindir}/${client}
 }
diff --git a/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb b/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
index 89fbdb1..f1a9eb9 100644
--- a/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
+++ b/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
@@ -7,5 +7,9 @@
         org.openbmc.examples.SDBusService1 \
         "
 
+S = "${WORKDIR}"
+SRC_URI += "file://Makefile \
+           file://obmc-phosphor-example-sdbus.c \
+           "
 inherit obmc-phosphor-sdbus-service
 inherit obmc-phosphor-c-daemon
diff --git a/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb b/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
index 79e2e6c..8c937c6 100644
--- a/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
+++ b/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
@@ -5,3 +5,8 @@
 inherit obmc-phosphor-fan-mgmt
 inherit obmc-phosphor-sdbus-service
 inherit obmc-phosphor-c-daemon
+
+S = "${WORKDIR}"
+SRC_URI += "file://Makefile \
+           file://obmc-phosphor-fand.c \
+           "
diff --git a/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb b/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
index bd4b1af..6e4c04a 100644
--- a/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
+++ b/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-flash-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb b/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
index 664760e..05471d5 100644
--- a/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
+++ b/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-policy-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb b/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
index fc646a5..7a82fb5 100644
--- a/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
+++ b/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-sensor-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb b/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
index 3dc9a64..bcb5d32 100644
--- a/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
+++ b/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
@@ -4,3 +4,6 @@
 
 inherit obmc-phosphor-system-mgmt
 inherit obmc-phosphor-pydbus-service
+
+S = "${WORKDIR}"
+SRC_URI += "file://${PN}.py"
diff --git a/conf/machine/include/sample.inc b/conf/machine/include/sample.inc
index 89ad0ec..801706f 100644
--- a/conf/machine/include/sample.inc
+++ b/conf/machine/include/sample.inc
@@ -17,3 +17,5 @@
 VIRTUAL-RUNTIME_obmc-phosphor-flash-ctl = " \
        obmc-phosphor-example-pydbus \
        "
+
+PREFERRED_PROVIDER_virtual/obmc-phosphor-host-ipmi-hw ?= "host-ipmi-hw-example"