blob: 92212479800fdfc238d3af2e59d9fe2da35e5aee [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 Othayoth416458c2017-07-05 10:31:16 -050026 pythonnative \
27 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 \
36 sdbusplus-native \
37 autoconf-archive-native \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060038 virtual/phosphor-debug-errors \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050039"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050040
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050041RDEPENDS_${PN}-manager += " \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050042 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050043"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050044RDEPENDS_${PN}-dreport += " \
45 systemd \
46 ${VIRTUAL-RUNTIME_base-utils} \
47 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050048 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050049"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050050RDEPENDS_${PN}-scripts += " \
51 bash \
52"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050053
Jayanth Othayoth416458c2017-07-05 10:31:16 -050054MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
55
56SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
57
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060058FILES_${PN}-manager += " \
Andrew Geissler74b8a092019-06-19 04:22:12 +000059 ${bindir}/phosphor-dump-manager \
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060060 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
61 ${datadir}/dump/ \
62 "
Andrew Geissler74b8a092019-06-19 04:22:12 +000063FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050064FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050065FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050066
Jayanth Othayoth416458c2017-07-05 10:31:16 -050067DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050068SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050069
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060070EXTRA_OECONF = " \
71 BMC_DUMP_PATH=${bmc_dump_path} \
72 ERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
73 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050074
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050075S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053076SRC_URI += "file://coretemp.conf"
77
78do_install_append() {
79 install -d ${D}${exec_prefix}/lib/tmpfiles.d
80 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
81}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050082
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050083# Install dreport script
84# From tools/dreport.d/dreport to /usr/bin/dreport
85install_dreport() {
86 install -d ${D}${bindir}
87 install -m 0755 ${S}/tools/dreport.d/dreport \
88 ${D}${bindir}/dreport
89}
90
91# Install dreport sample configuration file
92# From tools/dreport.d/sample.conf
93# to /usr/share/dreport.d/conf.d/dreport.conf
94install_dreport_conf_file() {
95 install -d ${D}${dreport_conf_dir}
96 install -m 0644 ${S}/tools/dreport.d/sample.conf \
97 ${D}${dreport_conf_dir}/dreport.conf
98}
99
100# Install dreport plugins
101# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
102install_dreport_plugins_scripts() {
103 install -d ${D}${dreport_plugin_dir}
104 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
105}
106
107# Install dreport utility functions
108# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
109install_dreport_include_scripts() {
110 install -d ${D}${dreport_include_dir}
111 install -m 0755 ${S}/tools/dreport.d/include.d/* \
112 ${D}${dreport_include_dir}/
113}
114
Matt Spinler26ffa122018-03-29 16:18:02 -0500115# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500116# Create user directories based on the dump type value in the config section
117# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500118def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500119 import re
120 import configparser
121
122 #Read the user types from the dreport.conf file
123 configure = configparser.ConfigParser()
124 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
125 confsource = os.path.join(conf_dir, "dreport.conf")
126 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500127
Matt Spinler26ffa122018-03-29 16:18:02 -0500128 config = ("config:")
129 section = "DumpType"
130 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
131
132 script = os.path.basename(script_path)
133 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
134
135 file = open(script_path, "r")
136
137 for line in file:
138 if not config in line:
139 continue
140 revalue = re.search('[0-9]+.[0-9]+', line)
141 if not revalue:
142 bb.warn("Invalid format for config value =%s" % line)
143 continue
144 parse_value = revalue.group(0)
145 config_values = re.split('\W+', parse_value, 1)
146 if(len(config_values) != 2):
147 bb.warn("Invalid config value=%s" % parse_value)
148 break;
149 priority = config_values[1]
150 types = [int(d) for d in str(config_values[0])]
151 for type in types:
152 if not configure.has_option(section, str(type)):
153 bb.warn("Invalid dump type id =%s" % (str(type)))
154 continue
155 typestr = configure.get(section, str(type))
156 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
157 if not os.path.exists(destdir):
158 os.makedirs(destdir)
159 linkname = "E" + priority + script
160 destlink = os.path.join(destdir, linkname)
161 os.symlink(srclink, destlink)
162
163#Make the links for all the plugins
164python install_dreport_user_scripts() {
165
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500166 source = d.getVar('S', True)
167 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
168 scripts = os.listdir(source_path)
Matt Spinler26ffa122018-03-29 16:18:02 -0500169
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500170 for script in scripts:
171 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500172 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500173}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500174
Brad Bishop8623bbe2018-03-09 00:04:00 -0500175#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
176PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500177PACKAGECONFIG[ubifs-workaround] = " \
178 --enable-ubifs-workaround, \
179 --disable-ubifs-workaround \
180"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500181
182do_install[postfuncs] += "install_dreport"
183do_install[postfuncs] += "install_dreport_conf_file"
184do_install[postfuncs] += "install_dreport_plugins_scripts"
185do_install[postfuncs] += "install_dreport_include_scripts"
186do_install[postfuncs] += "install_dreport_user_scripts"