blob: cc5bf78821a47152708c64d1cb4f7dd881238ace [file] [log] [blame]
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -05001SUMMARY = "Ampere Computing LLC Host Control Implementation"
2DESCRIPTION = "A host control implementation suitable for Ampere Computing LLC's systems"
3PR = "r1"
4LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
6
7inherit systemd
8inherit obmc-phosphor-systemd
9
10S = "${WORKDIR}"
11
12SRC_URI = "file://ampere-host-shutdown.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050013 file://ampere_power_util.sh \
14 file://ampere-chassis-poweroff.service \
15 file://ampere-chassis-poweron.service \
Charles Boyer17b216a2021-08-27 16:09:03 -050016 file://ampere-chassis-powercycle.service \
Charles Boyer1c51ca52021-08-24 11:25:03 -050017 file://ampere-host-shutdown-ack.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050018 file://ampere-host-power-cycle.service \
Charles Boyerab616162021-12-06 13:56:23 -060019 file://ampere-host-reset.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050020 "
21
22DEPENDS = "systemd"
Mohaimen Alsamaraif59d0172021-08-17 09:34:22 -050023RDEPENDS:${PN} = "bash"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050024
25SYSTEMD_PACKAGES = "${PN}"
Mohaimen Alsamaraif59d0172021-08-17 09:34:22 -050026SYSTEMD_SERVICE:${PN} = " \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050027 ampere-host-shutdown.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050028 ampere-chassis-poweroff.service \
29 ampere-chassis-poweron.service \
Charles Boyer17b216a2021-08-27 16:09:03 -050030 ampere-chassis-powercycle.service \
Charles Boyer1c51ca52021-08-24 11:25:03 -050031 ampere-host-shutdown-ack.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050032 ampere-host-power-cycle.service \
Charles Boyerab616162021-12-06 13:56:23 -060033 ampere-host-reset.service \
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050034 "
35# host power control
36# overwrite the host shutdown to graceful shutdown
37HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service"
38HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target"
39HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}"
Patrick Williamse83c2202021-09-01 16:17:33 -050040SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_SHUTDOWN_FMT', 'OBMC_HOST_INSTANCES')}"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050041
42# Force the power cycle target to run the ampere power cycle
43HOST_REBOOT_SVC = "ampere-host-power-cycle.service"
44HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target"
45HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -050046SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050047
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050048# chassis power control
49CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service"
50CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target"
51CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -050052SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050053
54CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service"
55CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
56CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}"
Patrick Williamse83c2202021-09-01 16:17:33 -050057SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050058
Charles Boyer17b216a2021-08-27 16:09:03 -050059CHASSIS_POWERCYCLE_SVC = "ampere-chassis-powercycle.service"
60CHASSIS_POWERCYCLE_TGTFMT = "obmc-chassis-powercycle@{0}.target"
61CHASSIS_POWERCYCLE_FMT = "../${CHASSIS_POWERCYCLE_SVC}:${CHASSIS_POWERCYCLE_TGTFMT}.requires/${CHASSIS_POWERCYCLE_SVC}"
Charles Boyer6e1b2182021-11-22 11:58:31 -060062SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERCYCLE_FMT', 'OBMC_CHASSIS_INSTANCES')}"
Charles Boyer17b216a2021-08-27 16:09:03 -050063
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050064TMPL = "phosphor-gpio-monitor@.service"
65INSTFMT = "phosphor-gpio-monitor@{0}.service"
66TGT = "multi-user.target"
67FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
Patrick Williamse83c2202021-09-01 16:17:33 -050068SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050069
70do_install() {
Charles Boyer2adad362021-11-24 15:58:03 -060071 install -d ${D}${libexecdir}/${PN}
72 install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}${libexecdir}/${PN}/ampere_power_util.sh
Mohaimen Alsamarai82a11d82021-06-24 16:59:29 -050073}