meta-facebook: greatlakes: System state initialization

Description:
- System state initialization.

Design:
- Use script to determine 12V and host current state
  12V: use BMC gpio
  host: Use BIC gpio
- Set correct state on CurrentHostState property for host status
- Set correcr state on CurrentPowerState property for 12V status

Test Case:
1. 12V on and host off
2. 12V on and host on
3. 12V off and host off

Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Change-Id: Ibff1f6e79290cfb39dc5442c240e324b38c18ecd
diff --git a/meta-facebook/meta-greatlakes/recipes-greatlakes/greatlakes-sysinit/greatlakes-sysinit.bb b/meta-facebook/meta-greatlakes/recipes-greatlakes/greatlakes-sysinit/greatlakes-sysinit.bb
new file mode 100644
index 0000000..716251e
--- /dev/null
+++ b/meta-facebook/meta-greatlakes/recipes-greatlakes/greatlakes-sysinit/greatlakes-sysinit.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Initialize system state"
+DESCRIPTION = "Initialize system state"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit pkgconfig
+inherit systemd
+inherit obmc-phosphor-systemd
+
+RDEPENDS:${PN} += "bash"
+
+SRC_URI += " \
+    file://greatlakes-system-state-init \
+    file://greatlakes-system-state-init@.service \
+    "
+
+do_install() {
+    install -d ${D}${libexecdir}/${PN}
+    install -m 0755 ${WORKDIR}/greatlakes-system-state-init ${D}${libexecdir}/${PN}/
+}
+
+TGT = "${SYSTEMD_DEFAULT_TARGET}"
+GREATLAKES_SYS_ST_INIT_INSTFMT="../greatlakes-system-state-init@.service:${TGT}.wants/greatlakes-system-state-init@{0}.service"
+
+SYSTEMD_SERVICE:${PN} += "greatlakes-system-state-init@.service"
+SYSTEMD_LINK:${PN} += "${@compose_list(d, 'GREATLAKES_SYS_ST_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"