blob: cca5d629eafc4f8a91a05e5f9f7ccaaafab3a633 [file] [log] [blame]
Jayanth Othayoth9963d172017-05-08 09:25:05 -05001SUMMARY = "Phosphor Debug Collector"
2DESCRIPTION = "Phosphor Debug Collector provides mechanisms \
Gunnar Mills2867a482017-08-08 10:53:28 -05003to collect various log files and system parameters. \
Jayanth Othayoth9963d172017-05-08 09:25:05 -05004This will be helpful for troubleshooting the problems in OpenBMC \
5based systems."
6
7PR = "r1"
Patrick Venture32f84232018-10-21 08:25:47 -07008PV = "1.0+git${SRCPV}"
Jayanth Othayoth9963d172017-05-08 09:25:05 -05009
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050010DEBUG_COLLECTOR_PKGS = " \
11 ${PN}-manager \
12 ${PN}-monitor \
Jayanth Othayothd2592492017-07-29 22:28:44 -050013 ${PN}-dreport \
Marri Devender Rao33603922017-10-11 02:22:46 -050014 ${PN}-scripts \
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050015"
Brad Bishopbe45c3f2018-04-11 10:53:06 -040016PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}"
17ALLOW_EMPTY_${PN} = "1"
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050018
19DBUS_PACKAGES = "${PN}-manager"
20
21SYSTEMD_PACKAGES = "${PN}-monitor"
22
Ramesh Iyyarb5f0cdd2020-08-21 03:57:44 -050023inherit meson \
Jayanth Othayothaae91e32017-06-05 03:10:00 -050024 obmc-phosphor-dbus-service \
Jayanth Othayothf9cd1c62020-02-20 00:14:29 -060025 python3native \
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050026 phosphor-debug-collector
Jayanth Othayoth9963d172017-05-08 09:25:05 -050027
28require phosphor-debug-collector.inc
29
30DEPENDS += " \
31 phosphor-dbus-interfaces \
Jayanth Othayoth9963d172017-05-08 09:25:05 -050032 phosphor-logging \
33 sdbusplus \
Patrick Williams2bebd122020-03-31 16:43:15 -050034 ${PYTHON_PN}-sdbus++-native \
Jayanth Othayoth9963d172017-05-08 09:25:05 -050035 autoconf-archive-native \
Marri Devender Raoae622542018-11-21 06:30:36 -060036 virtual/phosphor-debug-errors \
Jayanth Othayoth5216d112020-03-17 07:44:21 -050037 ${PYTHON_PN}-native \
38 ${PYTHON_PN}-pyyaml-native \
39 ${PYTHON_PN}-setuptools-native \
40 ${PYTHON_PN}-mako-native \
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050041"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050042
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050043RDEPENDS_${PN}-manager += " \
Jayanth Othayothd2592492017-07-29 22:28:44 -050044 ${PN}-dreport \
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050045"
Jayanth Othayothd2592492017-07-29 22:28:44 -050046RDEPENDS_${PN}-dreport += " \
47 systemd \
48 ${VIRTUAL-RUNTIME_base-utils} \
49 bash \
Jayanth Othayoth947c07b2017-07-25 09:29:37 -050050 xz \
Jayanth Othayothd2592492017-07-29 22:28:44 -050051"
Marri Devender Rao33603922017-10-11 02:22:46 -050052RDEPENDS_${PN}-scripts += " \
53 bash \
54"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050055
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050056MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
57
58SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
59
Marri Devender Raoae622542018-11-21 06:30:36 -060060FILES_${PN}-manager += " \
Andrew Geisslerf09b8a82019-06-19 04:22:12 +000061 ${bindir}/phosphor-dump-manager \
Marri Devender Raoae622542018-11-21 06:30:36 -060062 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
63 ${datadir}/dump/ \
64 "
Andrew Geisslerf09b8a82019-06-19 04:22:12 +000065FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor"
Jayanth Othayothd2592492017-07-29 22:28:44 -050066FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Rao33603922017-10-11 02:22:46 -050067FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050068
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050069DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothce4dfa02017-09-15 10:55:35 -050070SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050071
Ramesh Iyyarb5f0cdd2020-08-21 03:57:44 -050072EXTRA_OEMESON = " \
73 -DBMC_DUMP_PATH=${bmc_dump_path} \
74 -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
Marri Devender Raoae622542018-11-21 06:30:36 -060075 "
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050076
Jayanth Othayoth9963d172017-05-08 09:25:05 -050077S = "${WORKDIR}/git"
Manojkiran Eda9fe03c62018-05-26 10:37:52 +053078SRC_URI += "file://coretemp.conf"
79
80do_install_append() {
81 install -d ${D}${exec_prefix}/lib/tmpfiles.d
82 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
83}
Jayanth Othayothd2592492017-07-29 22:28:44 -050084
Marri Devender Rao33603922017-10-11 02:22:46 -050085# Install dreport script
86# From tools/dreport.d/dreport to /usr/bin/dreport
87install_dreport() {
88 install -d ${D}${bindir}
89 install -m 0755 ${S}/tools/dreport.d/dreport \
90 ${D}${bindir}/dreport
91}
92
93# Install dreport sample configuration file
94# From tools/dreport.d/sample.conf
95# to /usr/share/dreport.d/conf.d/dreport.conf
96install_dreport_conf_file() {
97 install -d ${D}${dreport_conf_dir}
98 install -m 0644 ${S}/tools/dreport.d/sample.conf \
99 ${D}${dreport_conf_dir}/dreport.conf
100}
101
102# Install dreport plugins
103# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
104install_dreport_plugins_scripts() {
105 install -d ${D}${dreport_plugin_dir}
106 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
107}
108
109# Install dreport utility functions
110# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
111install_dreport_include_scripts() {
112 install -d ${D}${dreport_include_dir}
113 install -m 0755 ${S}/tools/dreport.d/include.d/* \
114 ${D}${dreport_include_dir}/
115}
116
Matt Spinler015f6b12018-03-29 16:18:02 -0500117# Make the links for a single user plugin script
Marri Devender Rao33603922017-10-11 02:22:46 -0500118# Create user directories based on the dump type value in the config section
119# Create softlinks for the base scripts in the user directories
Matt Spinler015f6b12018-03-29 16:18:02 -0500120def install_dreport_user_script(script_path, d):
Marri Devender Rao33603922017-10-11 02:22:46 -0500121 import re
122 import configparser
123
124 #Read the user types from the dreport.conf file
125 configure = configparser.ConfigParser()
126 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
127 confsource = os.path.join(conf_dir, "dreport.conf")
128 configure.read(confsource)
Marri Devender Rao33603922017-10-11 02:22:46 -0500129
Matt Spinler015f6b12018-03-29 16:18:02 -0500130 config = ("config:")
131 section = "DumpType"
132 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
133
134 script = os.path.basename(script_path)
135 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
136
137 file = open(script_path, "r")
138
139 for line in file:
140 if not config in line:
141 continue
142 revalue = re.search('[0-9]+.[0-9]+', line)
143 if not revalue:
144 bb.warn("Invalid format for config value =%s" % line)
145 continue
146 parse_value = revalue.group(0)
147 config_values = re.split('\W+', parse_value, 1)
148 if(len(config_values) != 2):
149 bb.warn("Invalid config value=%s" % parse_value)
150 break;
151 priority = config_values[1]
152 types = [int(d) for d in str(config_values[0])]
153 for type in types:
154 if not configure.has_option(section, str(type)):
155 bb.warn("Invalid dump type id =%s" % (str(type)))
156 continue
157 typestr = configure.get(section, str(type))
158 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
159 if not os.path.exists(destdir):
160 os.makedirs(destdir)
161 linkname = "E" + priority + script
162 destlink = os.path.join(destdir, linkname)
163 os.symlink(srclink, destlink)
164
165#Make the links for all the plugins
166python install_dreport_user_scripts() {
167
Marri Devender Rao33603922017-10-11 02:22:46 -0500168 source = d.getVar('S', True)
169 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
170 scripts = os.listdir(source_path)
Matt Spinler015f6b12018-03-29 16:18:02 -0500171
Marri Devender Rao33603922017-10-11 02:22:46 -0500172 for script in scripts:
173 srcname = os.path.join(source_path, script)
Matt Spinler015f6b12018-03-29 16:18:02 -0500174 install_dreport_user_script(srcname, d)
Jayanth Othayothd2592492017-07-29 22:28:44 -0500175}
Jayanth Othayothb6a69b52017-10-12 01:47:31 -0500176
Brad Bishop811eeec2018-03-09 00:04:00 -0500177#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
178PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayothb6a69b52017-10-12 01:47:31 -0500179PACKAGECONFIG[ubifs-workaround] = " \
Ramesh Iyyarb5f0cdd2020-08-21 03:57:44 -0500180 -Dubifs-workaround=enabled, \
181 -Dubifs-workaround=disabled \
Jayanth Othayothb6a69b52017-10-12 01:47:31 -0500182"
Marri Devender Rao33603922017-10-11 02:22:46 -0500183
Ramesh Iyyar17743ee2020-12-07 06:46:45 -0600184PACKAGECONFIG[host-dump-transport-pldm] = " \
185 -Dhost-transport=pldm,, \
Dhruvaraj Subhashchandran04027432020-03-20 08:17:16 -0500186 pldm \
187 "
188
Dhruvaraj Subhashchandran9cc0e412020-10-06 23:13:01 -0500189PACKAGECONFIG[openpower-dumps-extension] = " \
190 -Dopenpower-dumps-extension=enabled, \
191 -Dopenpower-dumps-extension=disabled \
192"
193
Marri Devender Rao33603922017-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"