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             -Dtests=disabled \
46             "
47EXTRA_OEMESON:append = "${@bb.utils.contains('MACHINE_FEATURES', 'i2c-occ', ' -Di2c-occ=enabled', '', d)}"
48
49OCC_ENABLE = "enable"
50OCC_DISABLE = "disable"
51HOST_START = "startmin"
52HOST_STOP = "stop"
53
54# Ensure host-stop and host-startmin targets wants needed occ states
55OCC_TMPL = "op-occ-{0}@.service"
56HOST_TGTFMT = "obmc-host-{1}@{2}.target"
57OCC_INSTFMT = "op-occ-{0}@{2}.service"
58HOST_OCC_FMT = "../${OCC_TMPL}:${HOST_TGTFMT}.wants/${OCC_INSTFMT}"
59SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_ENABLE', 'HOST_START', 'OBMC_HOST_INSTANCES')}"
60SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_DISABLE', 'HOST_STOP', 'OBMC_HOST_INSTANCES')}"
61
62# Set the occ disable service to be executed on host error
63HOST_ERROR_TARGETS = "crash timeout"
64
65OCC_DISABLE_TMPL = "op-occ-disable@.service"
66HOST_ERROR_TGTFMT = "obmc-host-{0}@{1}.target"
67OCC_DISABLE_INSTFMT = "op-occ-disable@{1}.service"
68HOST_ERROR_FMT = "../${OCC_DISABLE_TMPL}:${HOST_ERROR_TGTFMT}.wants/${OCC_DISABLE_INSTFMT}"
69
70SYSTEMD_LINK:${PN} += "${@compose_list(d, 'HOST_ERROR_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
71
72S = "${WORKDIR}/git"
73
74# Remove packages not required for native build
75DEPENDS:remove:class-native = " \
76        phosphor-logging \
77        systemd \
78        sdbusplus \
79        virtual/${PN}-config-native \
80        "
81RDEPENDS:${PN}:remove:class-native = "phosphor-state-manager-obmc-targets"
82
83# Remove packages not required for native SDK build
84DEPENDS:remove:class-nativesdk = " \
85        phosphor-logging \
86        systemd \
87        sdbusplus \
88        virtual/${PN}-config-native \
89        "
90RDEPENDS:${PN}:remove:class-nativesdk = "phosphor-state-manager-obmc-targets"
91
92# Provide a means to enable/disable install_error_yaml feature
93PACKAGECONFIG ??= "install_error_yaml"
94PACKAGECONFIG[install_error_yaml] = "\
95        -Dinstall-error-yaml=enabled,\
96        -Dinstall-error-yaml=disabled,\
97        ,\
98        "
99
100# Enable install_error_yaml during native and native SDK build
101PACKAGECONFIG:add:class-native = "install_error_yaml"
102PACKAGECONFIG:add:class-nativesdk = "install_error_yaml"
103
104# Disable install_error_yaml during target build
105PACKAGECONFIG:remove:class-target = "install_error_yaml"
106
107BBCLASSEXTEND += "native nativesdk"
108