summaryrefslogtreecommitdiff
path: root/meta-quanta/meta-gbs
diff options
context:
space:
mode:
Diffstat (limited to 'meta-quanta/meta-gbs')
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service14
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh34
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb25
3 files changed, 73 insertions, 0 deletions
diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service
new file mode 100644
index 000000000..0627a94d9
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Boot Status LED Manager
+After=xyz.openbmc_project.LED.GroupManager.service
+Requires=xyz.openbmc_project.LED.GroupManager.service
+
+[Service]
+ExecStart=/usr/bin/boot-status-led.sh
+StandardOutput=syslog
+Type=simple
+RemainAfterExit=yes
+Restart=no
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh
new file mode 100644
index 000000000..65fc0bc50
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host"
+BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/os"
+BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status"
+BOOT_Property="OperatingSystemState"
+
+LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager"
+LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive"
+LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby"
+LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group"
+LED_Property="Asserted"
+
+dbus_state=0
+boot_status=""
+check_flag=0
+
+mapper wait $LED_INACTIVE_OBJPATH
+mapper wait $LED_STANDBY_OBJPATH
+while true; do
+ boot_status=$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')
+
+ if [ $boot_status != "\"Standby\"" ] && [ $check_flag -eq 0 ];then
+ busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
+ check_flag=1
+ elif [ $boot_status == "\"Standby\"" ];then
+ busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false
+ busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
+ break
+ fi
+ sleep 1
+done
+
+exit 0
diff --git a/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb
new file mode 100644
index 000000000..61c6ed407
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-gbs/boot-status-led/gbs-boot-status-led.bb
@@ -0,0 +1,25 @@
+SUMMARY = "OpenBMC Quanta Boot Status LED Service"
+DESCRIPTION = "OpenBMC Quanta Boot Status LED Daemon."
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit systemd
+
+DEPENDS += "systemd"
+RDEPENDS_${PN} += "bash"
+
+SRC_URI = " file://boot-status-led.sh \
+ file://boot-status-led.service \
+ "
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/boot-status-led.sh ${D}${bindir}/
+
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/boot-status-led.service ${D}${systemd_system_unitdir}
+}
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "boot-status-led.service"