Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" |
| 2 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 3 | OVERRIDES:append = "${@bb.utils.contains('VIRTUAL-RUNTIME_obmc-host-state-manager', 'phosphor-state-manager-host', ':phosphor-fan-with-psm', ':phosphor-fan-without-psm', d)}" |
| 4 | |
| 5 | PHOSPHOR_FAN_EXTRA_SERVICES = "obmc-poweroff.service" |
| 6 | PHOSPHOR_FAN_EXTRA_SERVICES:append:phosphor-fan-without-psm = " \ |
| 7 | obmc-chassis-hard-poweroff@.target \ |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 8 | obmc-chassis-poweroff@0.target \ |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 9 | " |
| 10 | |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 11 | SRC_URI:append:fb-withhost = " file://obmc-chassis-hard-poweroff@.target \ |
| 12 | file://obmc-chassis-poweroff@0.target \ |
| 13 | file://obmc-poweroff.service \ |
| 14 | file://host-poweroff" |
| 15 | |
| 16 | PACKAGECONFIG:append = " json sensor-monitor" |
| 17 | |
Matt Spinler | dbdec8b | 2022-08-19 18:14:38 +0000 | [diff] [blame] | 18 | EXTRA_OEMESON = "-Duse-host-power-state=enabled" |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 19 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 20 | RDEPENDS:${PN}-sensor-monitor = " bash" |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 21 | |
| 22 | do_install:append:fb-withhost() { |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 23 | install -d ${D}${systemd_system_unitdir} |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 24 | for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 25 | install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir} |
| 26 | done |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 27 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 28 | # Store the bitbake variable OBMC_HOST_INSTANCES inside the script as HOST_INSTANCES variable using sed. |
| 29 | sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 30 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 31 | install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 32 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 33 | install -d ${D}/usr/libexec/phosphor-fan-sensor-monitor |
| 34 | install -m 0777 ${WORKDIR}/host-poweroff ${D}/usr/libexec/phosphor-fan-sensor-monitor/ |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 35 | } |
| 36 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 37 | pkg_postinst:${PN}-sensor-monitor() { |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 38 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 39 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires |
| 40 | mkdir -p $D/var/lib/phosphor-fan-presence |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 41 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 42 | LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target" |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 43 | TARGET="../obmc-chassis-poweroff@0.target" |
| 44 | ln -s $TARGET $LINK |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 45 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 46 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service" |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 47 | TARGET="../obmc-poweroff.service" |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 48 | ln -s $TARGET $LINK |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 49 | } |
| 50 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 51 | FILES:${PN}-sensor-monitor += "/usr/libexec/phosphor-fan-sensor-monitor/host-poweroff" |
| 52 | FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}" |