Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,5 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "This feature is not implemented in bletchley and it will be implemented in future."
@@ -0,0 +1,28 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in $HOST_INSTANCES
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,4 @@
[Unit]
Description=Chassis%i (Hard Power Off)
After=multi-user.target
Requires=obmc-poweroff.service
@@ -0,0 +1,3 @@
[Unit]
Description=Chassis%i (Power Off)
After=multi-user.target
@@ -0,0 +1,7 @@
[Unit]
Description=power off host
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/phosphor-fan-sensor-monitor/host-poweroff
@@ -0,0 +1,5 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "This feature is not implemented in Tiogapass and it will be implemented in future."
@@ -0,0 +1,27 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in ${HOST_INSTANCES_SED_REPLACEMENT_VALUE}
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" \
$DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,28 @@
#!/bin/bash
# Power off the hosts when fan sensors crossed thresholds.
echo "Power off the hosts if fansensors threshold crossed ::"
HOST_INSTANCES="HOST_INSTANCES_SED_REPLACEMENT_VALUE"
DBUS_SERVICE="xyz.openbmc_project.State.Chassis"
DBUS_OBJECT="/xyz/openbmc_project/state/chassis"
DBUS_INTERFACE="xyz.openbmc_project.State.Chassis"
DBUS_PROPERTY="RequestedPowerTransition"
PROPERTY_VALUE="xyz.openbmc_project.State.Chassis.Transition.Off"
# Power off the hosts.
power-off-all-hosts()
{
for host_id in $HOST_INSTANCES
do
echo "chosen host id :::$host_id"
# host power off
output=$(busctl set-property $DBUS_SERVICE"$host_id" $DBUS_OBJECT"$host_id" $DBUS_INTERFACE $DBUS_PROPERTY s $PROPERTY_VALUE)
echo "$output"
done
}
power-off-all-hosts
@@ -0,0 +1,52 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
OVERRIDES:append = "${@bb.utils.contains('VIRTUAL-RUNTIME_obmc-host-state-manager', 'phosphor-state-manager-host', ':phosphor-fan-with-psm', ':phosphor-fan-without-psm', d)}"
PHOSPHOR_FAN_EXTRA_SERVICES = "obmc-poweroff.service"
PHOSPHOR_FAN_EXTRA_SERVICES:append:phosphor-fan-without-psm = " \
obmc-chassis-hard-poweroff@.target \
obmc-chassis-poweroff@0.target \
"
SRC_URI:append:fb-withhost = " file://obmc-chassis-hard-poweroff@.target \
file://obmc-chassis-poweroff@0.target \
file://obmc-poweroff.service \
file://host-poweroff"
PACKAGECONFIG:append = " json sensor-monitor"
EXTRA_OEMESON = "-Duse-host-power-state=enabled"
RDEPENDS:${PN}-sensor-monitor = " bash"
do_install:append:fb-withhost() {
install -d ${D}${systemd_system_unitdir}
for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do
install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir}
done
# Store the bitbake variable OBMC_HOST_INSTANCES inside the script as HOST_INSTANCES variable using sed.
sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff
install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor
install -d ${D}${libexecdir}/phosphor-fan-sensor-monitor
install -m 0777 ${WORKDIR}/host-poweroff ${D}${libexecdir}/phosphor-fan-sensor-monitor/
}
pkg_postinst:${PN}-sensor-monitor() {
mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires
mkdir -p $D/var/lib/phosphor-fan-presence
LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target"
TARGET="../obmc-chassis-poweroff@0.target"
ln -s $TARGET $LINK
LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service"
TARGET="../obmc-poweroff.service"
ln -s $TARGET $LINK
}
FILES:${PN}-sensor-monitor += "${libexecdir}/phosphor-fan-sensor-monitor/host-poweroff"
FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}"
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
EXTRA_OECONF:append = " --enable-configure-dbus=yes"