1SUMMARY = "Phosphor Debug Collector"
2DESCRIPTION = "Phosphor Debug Collector provides mechanisms \
3to collect various log files and system parameters. \
4This will be helpful for troubleshooting the problems in OpenBMC \
5based systems."
6DEPENDS += " \
7        phosphor-dbus-interfaces \
8        phosphor-logging \
9        sdbusplus \
10        ${PYTHON_PN}-sdbus++-native \
11        autoconf-archive-native \
12        virtual/phosphor-debug-errors \
13        ${PYTHON_PN}-native \
14        ${PYTHON_PN}-pyyaml-native \
15        ${PYTHON_PN}-setuptools-native \
16        ${PYTHON_PN}-mako-native \
17        nlohmann-json \
18"
19PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \
20         'obmc-ubi-fs phosphor-mmc obmc-static-norootfs', '', 'jffs-workaround', d)}"
21PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \
22        -Djffs-workaround=disabled"
23PACKAGECONFIG[host-dump-transport-pldm] = " \
24        -Dhost-transport=pldm,, \
25        libpldm \
26        "
27PACKAGECONFIG[openpower-dumps-extension] = " \
28       -Dopenpower-dumps-extension=enabled, \
29       -Dopenpower-dumps-extension=disabled  \
30"
31PV = "1.0+git${SRCPV}"
32PR = "r1"
33
34SRC_URI += "file://coretemp.conf"
35
36SYSTEMD_PACKAGES = "${PN}-monitor"
37SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
38SYSTEMD_SERVICE:${PN}-monitor += "obmc-dump-monitor.service"
39SYSTEMD_SERVICE:${PN}-monitor += "ramoops-monitor.service"
40S = "${WORKDIR}/git"
41
42inherit pkgconfig meson \
43        obmc-phosphor-dbus-service \
44        python3native \
45        phosphor-debug-collector
46
47EXTRA_OEMESON = " \
48    -Dtests=disabled \
49    -DBMC_DUMP_PATH=${bmc_dump_path} \
50    -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
51    "
52
53do_install:append() {
54    install -d ${D}${exec_prefix}/lib/tmpfiles.d
55    install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
56}
57do_install[postfuncs] += "install_dreport"
58do_install[postfuncs] += "install_dreport_conf_file"
59do_install[postfuncs] += "install_dreport_plugins_scripts"
60do_install[postfuncs] += "install_dreport_include_scripts"
61do_install[postfuncs] += "install_dreport_user_scripts"
62
63RDEPENDS:${PN}-manager += " \
64        ${PN}-dreport \
65"
66RDEPENDS:${PN}-dreport += " \
67        systemd \
68        ${VIRTUAL-RUNTIME_base-utils} \
69        bash \
70        xz \
71"
72RDEPENDS:${PN}-scripts += " \
73        bash \
74"
75
76FILES:${PN}-manager += " \
77    ${bindir}/phosphor-dump-manager \
78    ${bindir}/phosphor-offload-handler \
79    ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
80    ${datadir}/dump/ \
81    "
82FILES:${PN}-monitor += "${bindir}/phosphor-dump-monitor"
83FILES:${PN}-monitor += "${bindir}/phosphor-ramoops-monitor"
84FILES:${PN}-dreport += "${bindir}/dreport"
85FILES:${PN}-scripts += "${dreport_dir}"
86
87require phosphor-debug-collector.inc
88
89ALLOW_EMPTY:${PN} = "1"
90
91DEBUG_COLLECTOR_PKGS = " \
92    ${PN}-manager \
93    ${PN}-monitor \
94    ${PN}-dreport \
95    ${PN}-scripts \
96"
97PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}"
98DBUS_PACKAGES = "${PN}-manager"
99MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
100DBUS_SERVICE:${PN}-manager += "${MGR_SVC}"
101# Install dreport script
102# From tools/dreport.d/dreport to /usr/bin/dreport
103install_dreport() {
104    install -d ${D}${bindir}
105    install -m 0755 ${S}/tools/dreport.d/dreport \
106                    ${D}${bindir}/dreport
107}
108# Install dreport sample configuration file
109# From tools/dreport.d/sample.conf
110# to /usr/share/dreport.d/conf.d/dreport.conf
111install_dreport_conf_file() {
112    install -d ${D}${dreport_conf_dir}
113    install -m 0644 ${S}/tools/dreport.d/sample.conf \
114                        ${D}${dreport_conf_dir}/dreport.conf
115}
116# Install dreport plugins
117# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
118install_dreport_plugins_scripts() {
119    install -d ${D}${dreport_plugin_dir}
120    install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
121}
122# Install dreport utility functions
123# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
124install_dreport_include_scripts() {
125    install -d ${D}${dreport_include_dir}
126    install -m 0755 ${S}/tools/dreport.d/include.d/* \
127                ${D}${dreport_include_dir}/
128}
129
130#Make the links for all the plugins
131python install_dreport_user_scripts() {
132    source = d.getVar('S', True)
133    source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
134    scripts = os.listdir(source_path)
135    for script in scripts:
136        srcname = os.path.join(source_path, script)
137        install_dreport_user_script("dreport.conf", srcname, d)
138}
139