Introducing the Phosphor OpenBMC OE layer

 -Codifies the IBM vision for an OpenBMC build system.
 -Structured around a core DBUS API architecture.
 -Provides implementation flexibility within that architecture.
 -Provides sample qemuarm BSP layer.
diff --git a/classes/obmc-phosphor-c-daemon.bbclass b/classes/obmc-phosphor-c-daemon.bbclass
new file mode 100644
index 0000000..e21d17c
--- /dev/null
+++ b/classes/obmc-phosphor-c-daemon.bbclass
@@ -0,0 +1,17 @@
+# Common code for dbus applications using c.
+
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+DEPENDS += "glib-2.0"
+SRC_URI += " \
+        file://Makefile \
+        file://${PN}.c \
+        "
+S = "${WORKDIR}"
+
+do_install_append() {
+        # install the binary
+        install -d ${D}${sbindir}
+        install -m 0755 ${WORKDIR}/${PN} ${D}${sbindir}
+}
diff --git a/classes/obmc-phosphor-chassis-mgmt.bbclass b/classes/obmc-phosphor-chassis-mgmt.bbclass
new file mode 100644
index 0000000..377da0a
--- /dev/null
+++ b/classes/obmc-phosphor-chassis-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC chassis management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-chassis-mgmt"
diff --git a/classes/obmc-phosphor-event-mgmt.bbclass b/classes/obmc-phosphor-event-mgmt.bbclass
new file mode 100644
index 0000000..01f2edf
--- /dev/null
+++ b/classes/obmc-phosphor-event-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC event management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-event-mgmt"
diff --git a/classes/obmc-phosphor-fan-mgmt.bbclass b/classes/obmc-phosphor-fan-mgmt.bbclass
new file mode 100644
index 0000000..973376d
--- /dev/null
+++ b/classes/obmc-phosphor-fan-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC fan management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-fan-mgmt"
diff --git a/classes/obmc-phosphor-flash-mgmt.bbclass b/classes/obmc-phosphor-flash-mgmt.bbclass
new file mode 100644
index 0000000..d166949
--- /dev/null
+++ b/classes/obmc-phosphor-flash-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC flash management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-flash-mgmt"
diff --git a/classes/obmc-phosphor-image.bbclass b/classes/obmc-phosphor-image.bbclass
new file mode 100644
index 0000000..59be345
--- /dev/null
+++ b/classes/obmc-phosphor-image.bbclass
@@ -0,0 +1,38 @@
+# Common code for generating Phosphor OpenBMC images.
+
+# Additional IMAGE_FEATURES available with Phosphor OpenBMC:
+#
+# - obmc-phosphor-fan-mgmt            - Phosphor OpenBMC fan management
+# - obmc-phosphor-chassis-mgmt        - Phosphor OpenBMC chassis management
+# - obmc-phosphor-sensor-mgmt         - Phosphor OpenBMC sensor management
+# - obmc-phosphor-flash-mgmt          - Phosphor OpenBMC flash management
+# - obmc-phosphor-event-mgmt          - Phosphor OpenBMC event management
+# - obmc-phosphor-policy-mgmt         - Phosphor OpenBMC policy management
+# - obmc-phosphor-system-mgmt         - Phosphor OpenBMC system management
+
+inherit core-image
+inherit obmc-phosphor-license
+
+FEATURE_PACKAGES_obmc-phosphor-fan-mgmt ?= "packagegroup-obmc-phosphor-apps-fan-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-chassis-mgmt ?= "packagegroup-obmc-phosphor-apps-chassis-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-sensor-mgmt ?= "packagegroup-obmc-phosphor-apps-sensor-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-flash-mgmt ?= "packagegroup-obmc-phosphor-apps-flash-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-event-mgmt ?= "packagegroup-obmc-phosphor-apps-event-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-policy-mgmt ?= "packagegroup-obmc-phosphor-apps-policy-mgmt"
+FEATURE_PACKAGES_obmc-phosphor-system-mgmt ?= "packagegroup-obmc-phosphor-apps-system-mgmt"
+
+# Install entire Phosphor application stack by default
+IMAGE_FEATURES += " \
+       obmc-phosphor-fan-mgmt \
+       obmc-phosphor-chassis-mgmt \
+       obmc-phosphor-sensor-mgmt \
+       obmc-phosphor-flash-mgmt \
+       obmc-phosphor-event-mgmt \
+       obmc-phosphor-policy-mgmt \
+       obmc-phosphor-system-mgmt \
+       ssh-server-openssh \
+       "
+
+IMAGE_INSTALL += " \
+       bash \
+       "
diff --git a/classes/obmc-phosphor-license.bbclass b/classes/obmc-phosphor-license.bbclass
new file mode 100644
index 0000000..9694f7f
--- /dev/null
+++ b/classes/obmc-phosphor-license.bbclass
@@ -0,0 +1,4 @@
+# Common code for packages distributed without a license that want Apache-2.0.
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
diff --git a/classes/obmc-phosphor-policy-mgmt.bbclass b/classes/obmc-phosphor-policy-mgmt.bbclass
new file mode 100644
index 0000000..86e0cbe
--- /dev/null
+++ b/classes/obmc-phosphor-policy-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC policy management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-policy-mgmt"
diff --git a/classes/obmc-phosphor-py-daemon.bbclass b/classes/obmc-phosphor-py-daemon.bbclass
new file mode 100644
index 0000000..35c2714
--- /dev/null
+++ b/classes/obmc-phosphor-py-daemon.bbclass
@@ -0,0 +1,17 @@
+# Common code for dbus applications using python.
+
+inherit allarch
+inherit obmc-phosphor-systemd
+inherit obmc-phosphor-license
+
+RDEPENDS_${PN} += "python-dbus python-pygobject"
+SRC_URI += " \
+        file://${PN}.py \
+        "
+S = "${WORKDIR}"
+
+do_install_append() {
+        # install the script
+        install -d ${D}${sbindir}
+        install -m 0755 ${WORKDIR}/${PN}.py ${D}${sbindir}/${PN}
+}
diff --git a/classes/obmc-phosphor-sensor-mgmt.bbclass b/classes/obmc-phosphor-sensor-mgmt.bbclass
new file mode 100644
index 0000000..9939386
--- /dev/null
+++ b/classes/obmc-phosphor-sensor-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC sensor management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-sensor-mgmt"
diff --git a/classes/obmc-phosphor-system-mgmt.bbclass b/classes/obmc-phosphor-system-mgmt.bbclass
new file mode 100644
index 0000000..4939d2f
--- /dev/null
+++ b/classes/obmc-phosphor-system-mgmt.bbclass
@@ -0,0 +1,3 @@
+# Common code for recipes that implement Phosphor OpenBMC system management.
+
+RPROVIDES_${PN} += "virtual/obmc-phosphor-system-mgmt"
diff --git a/classes/obmc-phosphor-systemd.bbclass b/classes/obmc-phosphor-systemd.bbclass
new file mode 100644
index 0000000..7bd2d9d
--- /dev/null
+++ b/classes/obmc-phosphor-systemd.bbclass
@@ -0,0 +1,14 @@
+# Common code for Phosphor OpenBMC systemd services.
+
+inherit systemd
+
+SYSTEMD_SERVICE_${PN} = "${PN}.service"
+SRC_URI += " \
+        file://${PN}.service \
+        "
+
+do_install_append() {
+        # install systemd unit files
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/${PN}.service ${D}${systemd_unitdir}/system
+}
diff --git a/classes/obmc-phosphor-utils.bbclass b/classes/obmc-phosphor-utils.bbclass
new file mode 100644
index 0000000..4f55629
--- /dev/null
+++ b/classes/obmc-phosphor-utils.bbclass
@@ -0,0 +1,14 @@
+# Helper functions for checking feature variables.
+
+inherit utils
+
+def df_enabled(feature, value, d):
+        return base_contains("DISTRO_FEATURES", feature, value, "", d)
+
+def mf_enabled(feature, value, d):
+        return base_contains("MACHINE_FEATURES", feature, value, "", d)
+
+def cf_enabled(feature, value, d):
+        return value if df_enabled(feature, value, d) \
+                and mf_enabled(feature, value, d) \
+                        else ""