blob: 7f05e75a9a6c3e182ecc3d58bca86991ab154b2e [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."
6
7PR = "r1"
Patrick Ventured29807a2018-10-21 08:25:47 -07008PV = "1.0+git${SRCPV}"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -05009
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050010DEBUG_COLLECTOR_PKGS = " \
11 ${PN}-manager \
12 ${PN}-monitor \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050013 ${PN}-dreport \
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050014 ${PN}-scripts \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050015"
Brad Bishop19a30ad2018-04-11 10:53:06 -040016PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}"
17ALLOW_EMPTY_${PN} = "1"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050018
19DBUS_PACKAGES = "${PN}-manager"
20
21SYSTEMD_PACKAGES = "${PN}-monitor"
22
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050023inherit autotools \
24 pkgconfig \
Jayanth Othayoth55c27902017-06-05 03:10:00 -050025 obmc-phosphor-dbus-service \
Jayanth Othayoth6d7788f2020-02-20 00:14:29 -060026 python3native \
Jayanth Othayoth416458c2017-07-05 10:31:16 -050027 phosphor-debug-collector
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050028
29require phosphor-debug-collector.inc
30
31DEPENDS += " \
32 phosphor-dbus-interfaces \
33 phosphor-dbus-interfaces-native \
34 phosphor-logging \
35 sdbusplus \
Patrick Williams4b32c9a2020-03-31 16:43:15 -050036 ${PYTHON_PN}-sdbus++-native \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050037 autoconf-archive-native \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060038 virtual/phosphor-debug-errors \
Jayanth Othayoth39f5a6b2020-03-17 07:44:21 -050039 ${PYTHON_PN}-native \
40 ${PYTHON_PN}-pyyaml-native \
41 ${PYTHON_PN}-setuptools-native \
42 ${PYTHON_PN}-mako-native \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050043"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050044
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050045RDEPENDS_${PN}-manager += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050046 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050047"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050048RDEPENDS_${PN}-dreport += " \
49 systemd \
50 ${VIRTUAL-RUNTIME_base-utils} \
51 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050052 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050053"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050054RDEPENDS_${PN}-scripts += " \
55 bash \
56"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050057
Jayanth Othayoth416458c2017-07-05 10:31:16 -050058MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
59
60SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
61
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060062FILES_${PN}-manager += " \
Andrew Geissler74b8a092019-06-19 04:22:12 +000063 ${bindir}/phosphor-dump-manager \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060064 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
65 ${datadir}/dump/ \
66 "
Andrew Geissler74b8a092019-06-19 04:22:12 +000067FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050068FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050069FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050070
Jayanth Othayoth416458c2017-07-05 10:31:16 -050071DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050072SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050073
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060074EXTRA_OECONF = " \
75 BMC_DUMP_PATH=${bmc_dump_path} \
76 ERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
77 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050078
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050079S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053080SRC_URI += "file://coretemp.conf"
81
82do_install_append() {
83 install -d ${D}${exec_prefix}/lib/tmpfiles.d
84 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
85}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050086
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050087# Install dreport script
88# From tools/dreport.d/dreport to /usr/bin/dreport
89install_dreport() {
90 install -d ${D}${bindir}
91 install -m 0755 ${S}/tools/dreport.d/dreport \
92 ${D}${bindir}/dreport
93}
94
95# Install dreport sample configuration file
96# From tools/dreport.d/sample.conf
97# to /usr/share/dreport.d/conf.d/dreport.conf
98install_dreport_conf_file() {
99 install -d ${D}${dreport_conf_dir}
100 install -m 0644 ${S}/tools/dreport.d/sample.conf \
101 ${D}${dreport_conf_dir}/dreport.conf
102}
103
104# Install dreport plugins
105# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
106install_dreport_plugins_scripts() {
107 install -d ${D}${dreport_plugin_dir}
108 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
109}
110
111# Install dreport utility functions
112# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
113install_dreport_include_scripts() {
114 install -d ${D}${dreport_include_dir}
115 install -m 0755 ${S}/tools/dreport.d/include.d/* \
116 ${D}${dreport_include_dir}/
117}
118
Matt Spinler26ffa122018-03-29 16:18:02 -0500119# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500120# Create user directories based on the dump type value in the config section
121# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500122def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500123 import re
124 import configparser
125
126 #Read the user types from the dreport.conf file
127 configure = configparser.ConfigParser()
128 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
129 confsource = os.path.join(conf_dir, "dreport.conf")
130 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500131
Matt Spinler26ffa122018-03-29 16:18:02 -0500132 config = ("config:")
133 section = "DumpType"
134 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
135
136 script = os.path.basename(script_path)
137 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
138
139 file = open(script_path, "r")
140
141 for line in file:
142 if not config in line:
143 continue
144 revalue = re.search('[0-9]+.[0-9]+', line)
145 if not revalue:
146 bb.warn("Invalid format for config value =%s" % line)
147 continue
148 parse_value = revalue.group(0)
149 config_values = re.split('\W+', parse_value, 1)
150 if(len(config_values) != 2):
151 bb.warn("Invalid config value=%s" % parse_value)
152 break;
153 priority = config_values[1]
154 types = [int(d) for d in str(config_values[0])]
155 for type in types:
156 if not configure.has_option(section, str(type)):
157 bb.warn("Invalid dump type id =%s" % (str(type)))
158 continue
159 typestr = configure.get(section, str(type))
160 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
161 if not os.path.exists(destdir):
162 os.makedirs(destdir)
163 linkname = "E" + priority + script
164 destlink = os.path.join(destdir, linkname)
165 os.symlink(srclink, destlink)
166
167#Make the links for all the plugins
168python install_dreport_user_scripts() {
169
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500170 source = d.getVar('S', True)
171 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
172 scripts = os.listdir(source_path)
Matt Spinler26ffa122018-03-29 16:18:02 -0500173
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500174 for script in scripts:
175 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500176 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500177}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500178
Brad Bishop8623bbe2018-03-09 00:04:00 -0500179#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
180PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500181PACKAGECONFIG[ubifs-workaround] = " \
182 --enable-ubifs-workaround, \
183 --disable-ubifs-workaround \
184"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500185
Dhruvaraj Subhashchandrancb292282020-03-20 08:17:16 -0500186PACKAGECONFIG[host-dump-offload-pldm] = " \
Joel Stanley81e9ee02020-03-25 16:23:32 +1030187 --with-host-dump-offload-transport=pldm,, \
Dhruvaraj Subhashchandrancb292282020-03-20 08:17:16 -0500188 pldm \
189 "
190
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500191do_install[postfuncs] += "install_dreport"
192do_install[postfuncs] += "install_dreport_conf_file"
193do_install[postfuncs] += "install_dreport_plugins_scripts"
194do_install[postfuncs] += "install_dreport_include_scripts"
195do_install[postfuncs] += "install_dreport_user_scripts"