blob: 2b7372a22a900dbf4251084328d540c818cee0b7 [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}"
Patrick Williams12fc9392021-08-06 09:16:53 -050017ALLOW_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
Patrick Williams12fc9392021-08-06 09:16:53 -050044RDEPENDS:${PN}-manager += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050045 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050046"
Patrick Williams12fc9392021-08-06 09:16:53 -050047RDEPENDS:${PN}-dreport += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050048 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"
Patrick Williams12fc9392021-08-06 09:16:53 -050053RDEPENDS:${PN}-scripts += " \
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050054 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
Patrick Williams12fc9392021-08-06 09:16:53 -050061FILES:${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 "
Patrick Williams12fc9392021-08-06 09:16:53 -050066FILES:${PN}-monitor += "${bindir}/phosphor-dump-monitor"
67FILES:${PN}-monitor += "${bindir}/phosphor-ramoops-monitor"
68FILES:${PN}-dreport += "${bindir}/dreport"
69FILES:${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050070
Patrick Williams12fc9392021-08-06 09:16:53 -050071DBUS_SERVICE:${PN}-manager += "${MGR_SVC}"
72SYSTEMD_SERVICE:${PN}-monitor += "obmc-dump-monitor.service"
73SYSTEMD_SERVICE:${PN}-monitor += "ramoops-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050074
Ramesh Iyyar42e76b32020-08-21 03:57:44 -050075EXTRA_OEMESON = " \
76 -DBMC_DUMP_PATH=${bmc_dump_path} \
77 -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060078 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050079
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050080S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053081SRC_URI += "file://coretemp.conf"
82
Patrick Williams12fc9392021-08-06 09:16:53 -050083do_install:append() {
Manojkiran Edab36f3142018-05-26 10:37:52 +053084 install -d ${D}${exec_prefix}/lib/tmpfiles.d
85 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
86}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050087
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050088# Install dreport script
89# From tools/dreport.d/dreport to /usr/bin/dreport
90install_dreport() {
91 install -d ${D}${bindir}
92 install -m 0755 ${S}/tools/dreport.d/dreport \
93 ${D}${bindir}/dreport
94}
95
96# Install dreport sample configuration file
97# From tools/dreport.d/sample.conf
98# to /usr/share/dreport.d/conf.d/dreport.conf
99install_dreport_conf_file() {
100 install -d ${D}${dreport_conf_dir}
101 install -m 0644 ${S}/tools/dreport.d/sample.conf \
102 ${D}${dreport_conf_dir}/dreport.conf
103}
104
105# Install dreport plugins
106# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
107install_dreport_plugins_scripts() {
108 install -d ${D}${dreport_plugin_dir}
109 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
110}
111
112# Install dreport utility functions
113# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
114install_dreport_include_scripts() {
115 install -d ${D}${dreport_include_dir}
116 install -m 0755 ${S}/tools/dreport.d/include.d/* \
117 ${D}${dreport_include_dir}/
118}
119
Matt Spinler26ffa122018-03-29 16:18:02 -0500120# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500121# Create user directories based on the dump type value in the config section
122# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500123def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500124 import re
125 import configparser
126
127 #Read the user types from the dreport.conf file
128 configure = configparser.ConfigParser()
129 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
130 confsource = os.path.join(conf_dir, "dreport.conf")
131 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500132
Matt Spinler26ffa122018-03-29 16:18:02 -0500133 config = ("config:")
134 section = "DumpType"
135 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
136
137 script = os.path.basename(script_path)
138 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
139
140 file = open(script_path, "r")
141
142 for line in file:
143 if not config in line:
144 continue
145 revalue = re.search('[0-9]+.[0-9]+', line)
146 if not revalue:
147 bb.warn("Invalid format for config value =%s" % line)
148 continue
149 parse_value = revalue.group(0)
150 config_values = re.split('\W+', parse_value, 1)
151 if(len(config_values) != 2):
152 bb.warn("Invalid config value=%s" % parse_value)
153 break;
154 priority = config_values[1]
155 types = [int(d) for d in str(config_values[0])]
156 for type in types:
157 if not configure.has_option(section, str(type)):
158 bb.warn("Invalid dump type id =%s" % (str(type)))
159 continue
160 typestr = configure.get(section, str(type))
161 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
162 if not os.path.exists(destdir):
163 os.makedirs(destdir)
164 linkname = "E" + priority + script
165 destlink = os.path.join(destdir, linkname)
166 os.symlink(srclink, destlink)
George Liu3b3898d2021-05-02 10:03:08 +0800167 file.close()
Matt Spinler26ffa122018-03-29 16:18:02 -0500168
169#Make the links for all the plugins
170python install_dreport_user_scripts() {
171
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500172 source = d.getVar('S', True)
173 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
174 scripts = os.listdir(source_path)
Matt Spinler26ffa122018-03-29 16:18:02 -0500175
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}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500180
Chirag Sharmab1e568e2021-02-08 01:23:47 -0600181PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \
182 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}"
183PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \
184 -Djffs-workaround=disabled"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500185
Ramesh Iyyarb5c2fac2020-12-07 06:46:45 -0600186PACKAGECONFIG[host-dump-transport-pldm] = " \
187 -Dhost-transport=pldm,, \
Dhruvaraj Subhashchandrancb292282020-03-20 08:17:16 -0500188 pldm \
189 "
190
Dhruvaraj Subhashchandranf7d4b712020-10-06 23:13:01 -0500191PACKAGECONFIG[openpower-dumps-extension] = " \
192 -Dopenpower-dumps-extension=enabled, \
193 -Dopenpower-dumps-extension=disabled \
194"
195
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500196do_install[postfuncs] += "install_dreport"
197do_install[postfuncs] += "install_dreport_conf_file"
198do_install[postfuncs] += "install_dreport_plugins_scripts"
199do_install[postfuncs] += "install_dreport_include_scripts"
200do_install[postfuncs] += "install_dreport_user_scripts"