blob: d618e14bacbe604a6c0bc9a2e5b6dfbf249e43b1 [file] [log] [blame]
Jayanth Othayoth9be81b12017-05-08 09:25:05 -05001SUMMARY = "Phosphor Debug Collector"
2DESCRIPTION = "Phosphor Debug Collector provides mechanisms \
Gunnar Millsdc81cf12017-08-08 10:53:28 -05003to collect various log files and system parameters. \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -05004This will be helpful for troubleshooting the problems in OpenBMC \
5based systems."
Jayanth Othayoth9be81b12017-05-08 09:25:05 -05006DEPENDS += " \
7 phosphor-dbus-interfaces \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -05008 phosphor-logging \
9 sdbusplus \
Patrick Williams4b32c9a2020-03-31 16:43:15 -050010 ${PYTHON_PN}-sdbus++-native \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050011 autoconf-archive-native \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060012 virtual/phosphor-debug-errors \
Jayanth Othayoth39f5a6b2020-03-17 07:44:21 -050013 ${PYTHON_PN}-native \
14 ${PYTHON_PN}-pyyaml-native \
15 ${PYTHON_PN}-setuptools-native \
16 ${PYTHON_PN}-mako-native \
George Liu970dc7e2021-07-12 16:53:19 +080017 fmt \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050018"
Ed Tanous9936f862022-09-19 09:13:20 -070019PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \
20 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}"
21PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \
22 -Djffs-workaround=disabled"
23PACKAGECONFIG[host-dump-transport-pldm] = " \
24 -Dhost-transport=pldm,, \
25 pldm \
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 -DBMC_DUMP_PATH=${bmc_dump_path} \
49 -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
50 "
51
52do_install:append() {
53 install -d ${D}${exec_prefix}/lib/tmpfiles.d
54 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
55}
56do_install[postfuncs] += "install_dreport"
57do_install[postfuncs] += "install_dreport_conf_file"
58do_install[postfuncs] += "install_dreport_plugins_scripts"
59do_install[postfuncs] += "install_dreport_include_scripts"
60do_install[postfuncs] += "install_dreport_user_scripts"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050061
Patrick Williams12fc9392021-08-06 09:16:53 -050062RDEPENDS:${PN}-manager += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050063 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050064"
Patrick Williams12fc9392021-08-06 09:16:53 -050065RDEPENDS:${PN}-dreport += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050066 systemd \
67 ${VIRTUAL-RUNTIME_base-utils} \
68 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050069 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050070"
Patrick Williams12fc9392021-08-06 09:16:53 -050071RDEPENDS:${PN}-scripts += " \
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050072 bash \
73"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050074
Ed Tanous9936f862022-09-19 09:13:20 -070075FILES:${PN}-manager += " \
Andrew Geissler74b8a092019-06-19 04:22:12 +000076 ${bindir}/phosphor-dump-manager \
Dhruvaraj Subhashchandran6bec7232022-02-28 09:11:43 -060077 ${bindir}/phosphor-offload-handler \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060078 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
79 ${datadir}/dump/ \
80 "
Patrick Williams12fc9392021-08-06 09:16:53 -050081FILES:${PN}-monitor += "${bindir}/phosphor-dump-monitor"
82FILES:${PN}-monitor += "${bindir}/phosphor-ramoops-monitor"
83FILES:${PN}-dreport += "${bindir}/dreport"
84FILES:${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050085
Ed Tanous9936f862022-09-19 09:13:20 -070086require phosphor-debug-collector.inc
87
88ALLOW_EMPTY:${PN} = "1"
89
90DEBUG_COLLECTOR_PKGS = " \
91 ${PN}-manager \
92 ${PN}-monitor \
93 ${PN}-dreport \
94 ${PN}-scripts \
95"
96PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}"
97DBUS_PACKAGES = "${PN}-manager"
98MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
Patrick Williams12fc9392021-08-06 09:16:53 -050099DBUS_SERVICE:${PN}-manager += "${MGR_SVC}"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500100# Install dreport script
101# From tools/dreport.d/dreport to /usr/bin/dreport
102install_dreport() {
103 install -d ${D}${bindir}
104 install -m 0755 ${S}/tools/dreport.d/dreport \
105 ${D}${bindir}/dreport
106}
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500107# Install dreport sample configuration file
108# From tools/dreport.d/sample.conf
109# to /usr/share/dreport.d/conf.d/dreport.conf
110install_dreport_conf_file() {
111 install -d ${D}${dreport_conf_dir}
112 install -m 0644 ${S}/tools/dreport.d/sample.conf \
113 ${D}${dreport_conf_dir}/dreport.conf
114}
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500115# Install dreport plugins
116# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
117install_dreport_plugins_scripts() {
118 install -d ${D}${dreport_plugin_dir}
119 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
120}
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500121# Install dreport utility functions
122# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
123install_dreport_include_scripts() {
124 install -d ${D}${dreport_include_dir}
125 install -m 0755 ${S}/tools/dreport.d/include.d/* \
126 ${D}${dreport_include_dir}/
127}
Matt Spinler26ffa122018-03-29 16:18:02 -0500128# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500129# Create user directories based on the dump type value in the config section
130# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500131def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500132 import re
133 import configparser
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500134 #Read the user types from the dreport.conf file
135 configure = configparser.ConfigParser()
136 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
137 confsource = os.path.join(conf_dir, "dreport.conf")
138 configure.read(confsource)
Matt Spinler26ffa122018-03-29 16:18:02 -0500139 config = ("config:")
140 section = "DumpType"
141 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
Matt Spinler26ffa122018-03-29 16:18:02 -0500142 script = os.path.basename(script_path)
143 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500144 file = open(script_path, "r")
Matt Spinler26ffa122018-03-29 16:18:02 -0500145 for line in file:
146 if not config in line:
147 continue
148 revalue = re.search('[0-9]+.[0-9]+', line)
149 if not revalue:
150 bb.warn("Invalid format for config value =%s" % line)
151 continue
152 parse_value = revalue.group(0)
George Liuaad4f3d2021-10-13 15:47:46 +0800153 config_values = re.split(r'\W+', parse_value, 1)
Matt Spinler26ffa122018-03-29 16:18:02 -0500154 if(len(config_values) != 2):
155 bb.warn("Invalid config value=%s" % parse_value)
156 break;
157 priority = config_values[1]
158 types = [int(d) for d in str(config_values[0])]
159 for type in types:
160 if not configure.has_option(section, str(type)):
161 bb.warn("Invalid dump type id =%s" % (str(type)))
162 continue
163 typestr = configure.get(section, str(type))
164 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
165 if not os.path.exists(destdir):
166 os.makedirs(destdir)
167 linkname = "E" + priority + script
168 destlink = os.path.join(destdir, linkname)
169 os.symlink(srclink, destlink)
George Liu3b3898d2021-05-02 10:03:08 +0800170 file.close()
Matt Spinler26ffa122018-03-29 16:18:02 -0500171#Make the links for all the plugins
172python install_dreport_user_scripts() {
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500173 source = d.getVar('S', True)
174 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
175 scripts = os.listdir(source_path)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500176 for script in scripts:
177 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500178 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500179}