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,3 @@
[Unit]
Requires=bletchley-system-state-init@%i.service
After=bletchley-system-state-init@%i.service
@@ -0,0 +1,9 @@
#!/bin/bash
if [ "$1" == "0" ]; then
echo "Enter chassis-cycle"
/usr/sbin/power-ctrl chassis-cycle
else
echo "Enter sled$1 cycle"
/usr/sbin/power-ctrl "sled$1" cycle
fi
@@ -0,0 +1,9 @@
[Unit]
Description=Chassis Power Cycle: %i
[Service]
Type=oneshot
ExecStart=/usr/libexec/phosphor-state-manager/chassis-powercycle %i
[Install]
WantedBy=obmc-chassis-powercycle@%i.target
@@ -0,0 +1,9 @@
[Unit]
Description=Turn off AC at Sled%i
Conflicts=chassis-poweron@%i.service
After=host-poweroff@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i ac-off
SyslogIdentifier=power-ctrl
@@ -0,0 +1,14 @@
[Unit]
Description=Turn on AC at Sled%i
Requires=motor-init-calibration@%i.service
After=motor-init-calibration@%i.service
Conflicts=chassis-poweroff@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i ac-on
SyslogIdentifier=power-ctrl
ExecStartPost=/bin/systemctl restart phosphor-discover-system-state@%i.service
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,9 @@
[Unit]
Description=Sled%i Host Power Cycle
Requires=motor-init-calibration@%i.service
After=motor-init-calibration@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i cycle
SyslogIdentifier=power-ctrl
@@ -0,0 +1,11 @@
[Unit]
Description=Power off System in Sled%i by Step Motor
Requires=motor-init-calibration@%i.service
After=motor-init-calibration@%i.service
Conflicts=host-poweron@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i off
SyslogIdentifier=power-ctrl
@@ -0,0 +1,13 @@
[Unit]
Description=Power on System in Sled%i by Step Motor
Requires=motor-init-calibration@%i.service
After=motor-init-calibration@%i.service
Requires=chassis-poweron@%i.service
After=chassis-poweron@%i.service
Conflicts=host-poweroff@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i boot-from-bootmode
SyslogIdentifier=power-ctrl
@@ -0,0 +1,9 @@
[Unit]
Description=Sled%i Host Power Reset
Requires=motor-init-calibration@%i.service
After=motor-init-calibration@%i.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-ctrl sled%i reset
SyslogIdentifier=power-ctrl
@@ -0,0 +1,47 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:bletchley = " \
file://chassis-powercycle \
file://chassis-powercycle@.service \
file://chassis-poweroff@.service \
file://chassis-poweron@.service \
file://host-poweroff@.service \
file://host-poweron@.service \
"
RDEPENDS:${PN}-discover:append:bletchley = " bletchley-common-tool"
RDEPENDS:${PN}:append:bletchley = " bash motor-ctrl"
do_install:append:bletchley() {
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/*.service ${D}${systemd_system_unitdir}/
install -d ${D}${libexecdir}/${PN}
install -m 0777 ${WORKDIR}/chassis-powercycle ${D}${libexecdir}/${PN}/
}
FILES:${PN}:append:bletchley = " ${systemd_system_unitdir}"
FILES:${PN}:append:bletchley = " ${libexecdir}/${PN}"
# Because Bletchley does not have IPMI between Bmc & Host, the Host init
# state will set to Off after Bmc booted. We require an extra service to
# check and set Host state & Chassis power state to correct state before
# doing any power action or power policy restore.
BLETCHLEY_SYS_ST_INIT_CONF_FMT = "bletchley-system-state-init.conf:phosphor-discover-system-state@{0}.service.d/bletchley-system-state-init.conf"
SYSTEMD_OVERRIDE:${PN}-discover:bletchley += "${@compose_list_zip(d, 'BLETCHLEY_SYS_ST_INIT_CONF_FMT', 'OBMC_HOST_INSTANCES')}"
#======================
# Workaround for bletchley
#======================
CHASSIS_DEFAULT_TARGETS:remove:bletchley = " \
obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-on@{}.service \
obmc-chassis-powerreset@{}.target.requires/phosphor-reset-chassis-running@{}.service \
obmc-chassis-poweroff@{}.target.requires/obmc-power-stop@{}.service \
obmc-chassis-poweron@{}.target.requires/obmc-power-start@{}.service \
"
HOST_DEFAULT_TARGETS:append = " \
obmc-host-startmin@{}.target.wants/host-poweron@{}.service \
obmc-host-stop@{}.target.wants/host-poweroff@{}.service \
"