blob: c57e90f527ed041eecba3970a3725b38441a0067 [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
Andrew Geisslerec34cc62021-11-03 09:57:52 -050023inherit pkgconfig 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 \
Dhruvaraj Subhashchandran6bec7232022-02-28 09:11:43 -060063 ${bindir}/phosphor-offload-handler \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060064 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
65 ${datadir}/dump/ \
66 "
Patrick Williams12fc9392021-08-06 09:16:53 -050067FILES:${PN}-monitor += "${bindir}/phosphor-dump-monitor"
68FILES:${PN}-monitor += "${bindir}/phosphor-ramoops-monitor"
69FILES:${PN}-dreport += "${bindir}/dreport"
70FILES:${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050071
Patrick Williams12fc9392021-08-06 09:16:53 -050072DBUS_SERVICE:${PN}-manager += "${MGR_SVC}"
73SYSTEMD_SERVICE:${PN}-monitor += "obmc-dump-monitor.service"
74SYSTEMD_SERVICE:${PN}-monitor += "ramoops-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050075
Ramesh Iyyar42e76b32020-08-21 03:57:44 -050076EXTRA_OEMESON = " \
77 -DBMC_DUMP_PATH=${bmc_dump_path} \
78 -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060079 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050080
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050081S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053082SRC_URI += "file://coretemp.conf"
83
Patrick Williams12fc9392021-08-06 09:16:53 -050084do_install:append() {
Manojkiran Edab36f3142018-05-26 10:37:52 +053085 install -d ${D}${exec_prefix}/lib/tmpfiles.d
86 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
87}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050088
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050089# Install dreport script
90# From tools/dreport.d/dreport to /usr/bin/dreport
91install_dreport() {
92 install -d ${D}${bindir}
93 install -m 0755 ${S}/tools/dreport.d/dreport \
94 ${D}${bindir}/dreport
95}
96
97# Install dreport sample configuration file
98# From tools/dreport.d/sample.conf
99# to /usr/share/dreport.d/conf.d/dreport.conf
100install_dreport_conf_file() {
101 install -d ${D}${dreport_conf_dir}
102 install -m 0644 ${S}/tools/dreport.d/sample.conf \
103 ${D}${dreport_conf_dir}/dreport.conf
104}
105
106# Install dreport plugins
107# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
108install_dreport_plugins_scripts() {
109 install -d ${D}${dreport_plugin_dir}
110 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
111}
112
113# Install dreport utility functions
114# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
115install_dreport_include_scripts() {
116 install -d ${D}${dreport_include_dir}
117 install -m 0755 ${S}/tools/dreport.d/include.d/* \
118 ${D}${dreport_include_dir}/
119}
120
Matt Spinler26ffa122018-03-29 16:18:02 -0500121# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500122# Create user directories based on the dump type value in the config section
123# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500124def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500125 import re
126 import configparser
127
128 #Read the user types from the dreport.conf file
129 configure = configparser.ConfigParser()
130 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
131 confsource = os.path.join(conf_dir, "dreport.conf")
132 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500133
Matt Spinler26ffa122018-03-29 16:18:02 -0500134 config = ("config:")
135 section = "DumpType"
136 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
137
138 script = os.path.basename(script_path)
139 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
140
141 file = open(script_path, "r")
142
143 for line in file:
144 if not config in line:
145 continue
146 revalue = re.search('[0-9]+.[0-9]+', line)
147 if not revalue:
148 bb.warn("Invalid format for config value =%s" % line)
149 continue
150 parse_value = revalue.group(0)
George Liuaad4f3d2021-10-13 15:47:46 +0800151 config_values = re.split(r'\W+', parse_value, 1)
Matt Spinler26ffa122018-03-29 16:18:02 -0500152 if(len(config_values) != 2):
153 bb.warn("Invalid config value=%s" % parse_value)
154 break;
155 priority = config_values[1]
156 types = [int(d) for d in str(config_values[0])]
157 for type in types:
158 if not configure.has_option(section, str(type)):
159 bb.warn("Invalid dump type id =%s" % (str(type)))
160 continue
161 typestr = configure.get(section, str(type))
162 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
163 if not os.path.exists(destdir):
164 os.makedirs(destdir)
165 linkname = "E" + priority + script
166 destlink = os.path.join(destdir, linkname)
167 os.symlink(srclink, destlink)
George Liu3b3898d2021-05-02 10:03:08 +0800168 file.close()
Matt Spinler26ffa122018-03-29 16:18:02 -0500169
170#Make the links for all the plugins
171python install_dreport_user_scripts() {
172
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)
Matt Spinler26ffa122018-03-29 16:18:02 -0500176
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500177 for script in scripts:
178 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500179 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500180}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500181
Chirag Sharmab1e568e2021-02-08 01:23:47 -0600182PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \
183 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}"
184PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \
185 -Djffs-workaround=disabled"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500186
Ramesh Iyyarb5c2fac2020-12-07 06:46:45 -0600187PACKAGECONFIG[host-dump-transport-pldm] = " \
188 -Dhost-transport=pldm,, \
Dhruvaraj Subhashchandrancb292282020-03-20 08:17:16 -0500189 pldm \
190 "
191
Dhruvaraj Subhashchandranf7d4b712020-10-06 23:13:01 -0500192PACKAGECONFIG[openpower-dumps-extension] = " \
193 -Dopenpower-dumps-extension=enabled, \
194 -Dopenpower-dumps-extension=disabled \
195"
196
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500197do_install[postfuncs] += "install_dreport"
198do_install[postfuncs] += "install_dreport_conf_file"
199do_install[postfuncs] += "install_dreport_plugins_scripts"
200do_install[postfuncs] += "install_dreport_include_scripts"
201do_install[postfuncs] += "install_dreport_user_scripts"