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 autotools \
8        pkgconfig \
9        obmc-phosphor-dbus-service \
10        pythonnative \
11        phosphor-dbus-yaml
12
13require ${PN}.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        sdbusplus-native \
30        phosphor-logging \
31        openpower-dbus-interfaces \
32        phosphor-dbus-interfaces \
33        openpower-dbus-interfaces-native \
34        autoconf-archive-native \
35        obmc-targets \
36        systemd \
37        "
38
39RDEPENDS_${PN} += " \
40               sdbusplus \
41               phosphor-logging \
42               openpower-dbus-interfaces \
43               phosphor-dbus-interfaces \
44               "
45
46EXTRA_OECONF = " \
47             YAML_PATH=${STAGING_DATADIR_NATIVE}/${PN} \
48             PS_DERATING_FACTOR=${POWER_SUPPLY_DERATING_FACTOR} \
49             "
50EXTRA_OECONF_append = "${@bb.utils.contains('OBMC_MACHINE_FEATURES', 'i2c-occ', ' --enable-i2c-occ', '', d)}"
51
52OCC_ENABLE = "enable"
53OCC_DISABLE = "disable"
54HOST_START = "startmin"
55HOST_STOP = "stop"
56
57# Ensure host-stop and host-startmin targets require needed occ states
58OCC_TMPL = "op-occ-{0}@.service"
59HOST_TGTFMT = "obmc-host-{1}@{2}.target"
60OCC_INSTFMT = "op-occ-{0}@{2}.service"
61HOST_OCC_FMT = "../${OCC_TMPL}:${HOST_TGTFMT}.requires/${OCC_INSTFMT}"
62SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_ENABLE', 'HOST_START', 'OBMC_HOST_INSTANCES')}"
63SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'HOST_OCC_FMT', 'OCC_DISABLE', 'HOST_STOP', 'OBMC_HOST_INSTANCES')}"
64
65# Set the occ disable service to be executed on host error
66HOST_ERROR_TARGETS = "crash timeout"
67
68OCC_DISABLE_TMPL = "op-occ-disable@.service"
69HOST_ERROR_TGTFMT = "obmc-host-{0}@{1}.target"
70OCC_DISABLE_INSTFMT = "op-occ-disable@{1}.service"
71HOST_ERROR_FMT = "../${OCC_DISABLE_TMPL}:${HOST_ERROR_TGTFMT}.wants/${OCC_DISABLE_INSTFMT}"
72
73SYSTEMD_LINK_${PN} += "${@compose_list(d, 'HOST_ERROR_FMT', 'HOST_ERROR_TARGETS', 'OBMC_HOST_INSTANCES')}"
74
75S = "${WORKDIR}/git"
76
77# Remove packages not required for native build
78DEPENDS_remove_class-native = " \
79        phosphor-logging \
80        obmc-targets \
81        systemd \
82        virtual/${PN}-config-native \
83        "
84# Remove packages not required for native SDK build
85DEPENDS_remove_class-nativesdk = " \
86        phosphor-logging \
87        obmc-targets \
88        systemd \
89        virtual/${PN}-config-native \
90        "
91
92# Provide a means to enable/disable install_error_yaml feature
93PACKAGECONFIG ??= "install_error_yaml"
94PACKAGECONFIG[install_error_yaml] = "\
95        --enable-install_error_yaml,\
96        --disable-install_error_yaml,\
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
107# Disable generating elog error header file during bitbake. Applications
108# should be using the elog header generated by phosphor-logging recipe
109EXTRA_OECONF += "--disable-gen_errors"
110
111BBCLASSEXTEND += "native nativesdk"
112
113