1SUMMARY = "Bletchley Motor control" 2PR = "r1" 3LICENSE = "Apache-2.0" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" 5 6inherit obmc-phosphor-systemd 7 8RDEPENDS:${PN} += "bash" 9RDEPENDS:${PN} += "i2c-tools" 10RDEPENDS:${PN} += "libgpiod-tools" 11RDEPENDS:${PN} += "mdio-util" 12 13S = "${WORKDIR}" 14SRC_URI += " \ 15 file://motor-ctrl \ 16 file://motor-init \ 17 file://power-ctrl \ 18 " 19 20do_install() { 21 install -d ${D}${sbindir} 22 install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir} 23 24 install -d ${D}${libexecdir} 25 install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir} 26 install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir} 27} 28 29TGT = "${SYSTEMD_DEFAULT_TARGET}" 30MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service" 31PWR_ON_INSTFMT="../host-poweron@.service:obmc-host-startmin@{0}.target.wants/host-poweron@{0}.service" 32PWR_OFF_INSTFMT="../host-poweroff@.service:obmc-host-shutdown@{0}.target.wants/host-poweroff@{0}.service" 33AC_ON_INSTFMT="../host-ac-on@.service:${TGT}.wants/host-ac-on@{0}.service" 34AC_OFF_INSTFMT="host-ac-off@.service:host-ac-off@{0}.service" 35 36SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service" 37SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}" 38 39SYSTEMD_SERVICE:${PN} += "host-poweron@.service" 40SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}" 41 42SYSTEMD_SERVICE:${PN} += "host-poweroff@.service" 43SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}" 44 45SYSTEMD_SERVICE:${PN} += "host-ac-on@.service" 46SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}" 47 48SYSTEMD_SERVICE:${PN} += "host-ac-off@.service" 49SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}" 50 51# Host on requires these chassis on 52START_TMPL_CTRL = "obmc-chassis-poweron@.target" 53START_TGTFMT_CTRL = "obmc-host-startmin@{0}.target" 54START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target" 55START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}" 56SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" 57 58# Chassis off requires host off 59STOP_TMPL_CTRL = "obmc-host-stop@.target" 60STOP_TGTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" 61STOP_INSTFMT_CTRL = "obmc-host-stop@{0}.target" 62STOP_FMT_CTRL = "../${STOP_TMPL_CTRL}:${STOP_TGTFMT_CTRL}.requires/${STOP_INSTFMT_CTRL}" 63SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'STOP_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" 64 65# Hard power off requires chassis off 66HARD_OFF_TMPL_CTRL = "obmc-chassis-poweroff@.target" 67HARD_OFF_TGTFMT_CTRL = "obmc-chassis-hard-poweroff@{0}.target" 68HARD_OFF_INSTFMT_CTRL = "obmc-chassis-poweroff@{0}.target" 69HARD_OFF_FMT_CTRL = "../${HARD_OFF_TMPL_CTRL}:${HARD_OFF_TGTFMT_CTRL}.requires/${HARD_OFF_INSTFMT_CTRL}" 70SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HARD_OFF_FMT_CTRL', 'OBMC_HOST_INSTANCES')}" 71 72# Host on unit configurations 73HOST_ON_OVERRIDE_CONF_FMT = "host-poweron.conf:host-poweron@{0}.service.d/host-poweron.conf" 74SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_ON_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}" 75 76# Host off unit configurations 77HOST_OFF_OVERRIDE_CONF_FMT = "host-poweroff.conf:host-poweroff@{0}.service.d/host-poweroff.conf" 78SYSTEMD_OVERRIDE:${PN}:bletchley += "${@compose_list_zip(d, 'HOST_OFF_OVERRIDE_CONF_FMT', 'OBMC_HOST_INSTANCES')}" 79 80