1SUMMARY = "OpenPOWER OCC controller"
2DESCRIPTION = "Application to control the OpenPOWER On-Chip-Controller"
3HOMEPAGE = "https://github.com/openbmc/openpower-occ-control"
4PR = "r1"
5PV = "1.0+git${SRCPV}"
6
7inherit meson \
8        pkgconfig \
9        obmc-phosphor-dbus-service \
10        python3native \
11        phosphor-dbus-yaml
12
13require ${BPN}.inc
14
15SRC_URI += "file://occ-active.sh"
16do_install:append() {
17        install -d ${D}${bindir}
18        install -m 0755 ${WORKDIR}/occ-active.sh \
19            ${D}${bindir}/occ-active.sh
20}
21
22DBUS_SERVICE:${PN} += "org.open_power.OCC.Control.service"
23SYSTEMD_SERVICE:${PN} += "op-occ-enable@.service"
24SYSTEMD_SERVICE:${PN} += "op-occ-disable@.service"
25
26DEPENDS += "virtual/${PN}-config-native"
27DEPENDS += " \
28        sdbusplus \
29        ${PYTHON_PN}-sdbus++-native \
30        phosphor-logging \
31        phosphor-dbus-interfaces \
32        autoconf-archive-native \
33        systemd \
34        ${PYTHON_PN}-native \
35        ${PYTHON_PN}-pyyaml-native \
36        ${PYTHON_PN}-setuptools-native \
37        ${PYTHON_PN}-mako-native \
38        "
39
40RDEPENDS:${PN} += "phosphor-state-manager-obmc-targets"
41
42EXTRA_OEMESON = " \
43             -Dyamldir=${STAGING_DATADIR_NATIVE}/${PN} \
44             -Dps-derating-factor=${POWER_SUPPLY_DERATING_FACTOR} \
45             "
46EXTRA_OEMESON:append = "${@bb.utils.contains('MACHINE_FEATURES', 'i2c-occ', ' -Di2c-occ=enabled', '', d)}"
47
48OCC_ENABLE = "enable"
49OCC_DISABLE = "disable"
50HOST_START = "startmin"
51HOST_STOP = "stop"
52
53# Ensure host-stop and host-startmin targets wants needed occ states
54OCC_TMPL = "op-occ-{0}@.service"
55HOST_TGTFMT = "obmc-host-{1}@{2}.target"
56OCC_INSTFMT = "op-occ-{0}@{2}.service"
57HOST_OCC_FMT = "../${OCC_TMPL}:${HOST_TGTFMT}.wants/${OCC_INSTFMT}"
58SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_ENABLE', 'HOST_START', 'OBMC_HOST_INSTANCES')}"
59SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_DISABLE', 'HOST_STOP', 'OBMC_HOST_INSTANCES')}"
60
61# Set the occ disable service to be executed on host error
62HOST_ERROR_TARGETS = "crash timeout"
63
64OCC_DISABLE_TMPL = "op-occ-disable@.service"
65HOST_ERROR_TGTFMT = "obmc-host-{0}@{1}.target"
66OCC_DISABLE_INSTFMT = "op-occ-disable@{1}.service"
67HOST_ERROR_FMT = "../${OCC_DISABLE_TMPL}:${HOST_ERROR_TGTFMT}.wants/${OCC_DISABLE_INSTFMT}"
68
69SYSTEMD_LINK:${PN} += "${@compose_list(d, 'HOST_ERROR_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
70
71S = "${WORKDIR}/git"
72
73# Remove packages not required for native build
74DEPENDS:remove:class-native = " \
75        phosphor-logging \
76        systemd \
77        sdbusplus \
78        virtual/${PN}-config-native \
79        "
80RDEPENDS:${PN}:remove:class-native = "phosphor-state-manager-obmc-targets"
81
82# Remove packages not required for native SDK build
83DEPENDS:remove:class-nativesdk = " \
84        phosphor-logging \
85        systemd \
86        sdbusplus \
87        virtual/${PN}-config-native \
88        "
89RDEPENDS:${PN}:remove:class-nativesdk = "phosphor-state-manager-obmc-targets"
90
91# Provide a means to enable/disable install_error_yaml feature
92PACKAGECONFIG ??= "install_error_yaml"
93PACKAGECONFIG[install_error_yaml] = "\
94        -Dinstall-error-yaml=enabled,\
95        -Dinstall-error-yaml=disabled,\
96        ,\
97        "
98
99# Enable install_error_yaml during native and native SDK build
100PACKAGECONFIG:add:class-native = "install_error_yaml"
101PACKAGECONFIG:add:class-nativesdk = "install_error_yaml"
102
103# Disable install_error_yaml during target build
104PACKAGECONFIG:remove:class-target = "install_error_yaml"
105
106BBCLASSEXTEND += "native nativesdk"
107