blob: fb799f2d64557d6f9a3cc2ce9b2b2c50150a852b [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
Ramesh Iyyar42e76b32020-08-21 03:57:44 -050023inherit meson \
Jayanth Othayoth55c27902017-06-05 03:10:00 -050024 obmc-phosphor-dbus-service \
Jayanth Othayoth6d7788f2020-02-20 00:14:29 -060025 python3native \
Jayanth Othayoth416458c2017-07-05 10:31:16 -050026 phosphor-debug-collector
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050027
28require phosphor-debug-collector.inc
29
30DEPENDS += " \
31 phosphor-dbus-interfaces \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050032 phosphor-logging \
33 sdbusplus \
Patrick Williams4b32c9a2020-03-31 16:43:15 -050034 ${PYTHON_PN}-sdbus++-native \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050035 autoconf-archive-native \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060036 virtual/phosphor-debug-errors \
Jayanth Othayoth39f5a6b2020-03-17 07:44:21 -050037 ${PYTHON_PN}-native \
38 ${PYTHON_PN}-pyyaml-native \
39 ${PYTHON_PN}-setuptools-native \
40 ${PYTHON_PN}-mako-native \
George Liu970dc7e2021-07-12 16:53:19 +080041 fmt \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050042"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050043
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050044RDEPENDS_${PN}-manager += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050045 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050046"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050047RDEPENDS_${PN}-dreport += " \
48 systemd \
49 ${VIRTUAL-RUNTIME_base-utils} \
50 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050051 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050052"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050053RDEPENDS_${PN}-scripts += " \
54 bash \
55"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050056
Jayanth Othayoth416458c2017-07-05 10:31:16 -050057MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
58
59SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
60
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060061FILES_${PN}-manager += " \
Andrew Geissler74b8a092019-06-19 04:22:12 +000062 ${bindir}/phosphor-dump-manager \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060063 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
64 ${datadir}/dump/ \
65 "
Andrew Geissler74b8a092019-06-19 04:22:12 +000066FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050067FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050068FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050069
Jayanth Othayoth416458c2017-07-05 10:31:16 -050070DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050071SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050072
Ramesh Iyyar42e76b32020-08-21 03:57:44 -050073EXTRA_OEMESON = " \
74 -DBMC_DUMP_PATH=${bmc_dump_path} \
75 -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060076 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050077
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050078S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053079SRC_URI += "file://coretemp.conf"
80
81do_install_append() {
82 install -d ${D}${exec_prefix}/lib/tmpfiles.d
83 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
84}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050085
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050086# Install dreport script
87# From tools/dreport.d/dreport to /usr/bin/dreport
88install_dreport() {
89 install -d ${D}${bindir}
90 install -m 0755 ${S}/tools/dreport.d/dreport \
91 ${D}${bindir}/dreport
92}
93
94# Install dreport sample configuration file
95# From tools/dreport.d/sample.conf
96# to /usr/share/dreport.d/conf.d/dreport.conf
97install_dreport_conf_file() {
98 install -d ${D}${dreport_conf_dir}
99 install -m 0644 ${S}/tools/dreport.d/sample.conf \
100 ${D}${dreport_conf_dir}/dreport.conf
101}
102
103# Install dreport plugins
104# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
105install_dreport_plugins_scripts() {
106 install -d ${D}${dreport_plugin_dir}
107 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
108}
109
110# Install dreport utility functions
111# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
112install_dreport_include_scripts() {
113 install -d ${D}${dreport_include_dir}
114 install -m 0755 ${S}/tools/dreport.d/include.d/* \
115 ${D}${dreport_include_dir}/
116}
117
Matt Spinler26ffa122018-03-29 16:18:02 -0500118# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500119# Create user directories based on the dump type value in the config section
120# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500121def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500122 import re
123 import configparser
124
125 #Read the user types from the dreport.conf file
126 configure = configparser.ConfigParser()
127 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
128 confsource = os.path.join(conf_dir, "dreport.conf")
129 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500130
Matt Spinler26ffa122018-03-29 16:18:02 -0500131 config = ("config:")
132 section = "DumpType"
133 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
134
135 script = os.path.basename(script_path)
136 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
137
138 file = open(script_path, "r")
139
140 for line in file:
141 if not config in line:
142 continue
143 revalue = re.search('[0-9]+.[0-9]+', line)
144 if not revalue:
145 bb.warn("Invalid format for config value =%s" % line)
146 continue
147 parse_value = revalue.group(0)
148 config_values = re.split('\W+', parse_value, 1)
149 if(len(config_values) != 2):
150 bb.warn("Invalid config value=%s" % parse_value)
151 break;
152 priority = config_values[1]
153 types = [int(d) for d in str(config_values[0])]
154 for type in types:
155 if not configure.has_option(section, str(type)):
156 bb.warn("Invalid dump type id =%s" % (str(type)))
157 continue
158 typestr = configure.get(section, str(type))
159 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
160 if not os.path.exists(destdir):
161 os.makedirs(destdir)
162 linkname = "E" + priority + script
163 destlink = os.path.join(destdir, linkname)
164 os.symlink(srclink, destlink)
George Liu3b3898d2021-05-02 10:03:08 +0800165 file.close()
Matt Spinler26ffa122018-03-29 16:18:02 -0500166
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
Chirag Sharmab1e568e2021-02-08 01:23:47 -0600179PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \
180 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}"
181PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \
182 -Djffs-workaround=disabled"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500183
Ramesh Iyyarb5c2fac2020-12-07 06:46:45 -0600184PACKAGECONFIG[host-dump-transport-pldm] = " \
185 -Dhost-transport=pldm,, \
Dhruvaraj Subhashchandrancb292282020-03-20 08:17:16 -0500186 pldm \
187 "
188
Dhruvaraj Subhashchandranf7d4b712020-10-06 23:13:01 -0500189PACKAGECONFIG[openpower-dumps-extension] = " \
190 -Dopenpower-dumps-extension=enabled, \
191 -Dopenpower-dumps-extension=disabled \
192"
193
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500194do_install[postfuncs] += "install_dreport"
195do_install[postfuncs] += "install_dreport_conf_file"
196do_install[postfuncs] += "install_dreport_plugins_scripts"
197do_install[postfuncs] += "install_dreport_include_scripts"
198do_install[postfuncs] += "install_dreport_user_scripts"