blob: 3fd6f0ba0fc83ce67072d929aa96074632362930 [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 Othayoth9be81b12017-05-08 09:25:05 -050042 sdbusplus \
43 phosphor-dbus-interfaces \
44 phosphor-logging \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050045 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050046"
47RDEPENDS_${PN}-monitor += " \
48 sdbusplus \
49 phosphor-dbus-interfaces \
50 phosphor-logging \
51"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050052RDEPENDS_${PN}-dreport += " \
53 systemd \
54 ${VIRTUAL-RUNTIME_base-utils} \
55 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050056 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050057"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050058RDEPENDS_${PN}-scripts += " \
59 bash \
60"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050061
Jayanth Othayoth416458c2017-07-05 10:31:16 -050062MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
63
64SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
65
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060066FILES_${PN}-manager += " \
67 ${sbindir}/phosphor-dump-manager \
68 ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
69 ${datadir}/dump/ \
70 "
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050071FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050072FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050073FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050074
Jayanth Othayoth416458c2017-07-05 10:31:16 -050075DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050076SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050077
Marri Devender Rao5035fcf2018-11-21 06:30:36 -060078EXTRA_OECONF = " \
79 BMC_DUMP_PATH=${bmc_dump_path} \
80 ERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
81 "
Jayanth Othayoth416458c2017-07-05 10:31:16 -050082
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050083S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053084SRC_URI += "file://coretemp.conf"
85
86do_install_append() {
87 install -d ${D}${exec_prefix}/lib/tmpfiles.d
88 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
89}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050090
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050091# Install dreport script
92# From tools/dreport.d/dreport to /usr/bin/dreport
93install_dreport() {
94 install -d ${D}${bindir}
95 install -m 0755 ${S}/tools/dreport.d/dreport \
96 ${D}${bindir}/dreport
97}
98
99# Install dreport sample configuration file
100# From tools/dreport.d/sample.conf
101# to /usr/share/dreport.d/conf.d/dreport.conf
102install_dreport_conf_file() {
103 install -d ${D}${dreport_conf_dir}
104 install -m 0644 ${S}/tools/dreport.d/sample.conf \
105 ${D}${dreport_conf_dir}/dreport.conf
106}
107
108# Install dreport plugins
109# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
110install_dreport_plugins_scripts() {
111 install -d ${D}${dreport_plugin_dir}
112 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
113}
114
115# Install dreport utility functions
116# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
117install_dreport_include_scripts() {
118 install -d ${D}${dreport_include_dir}
119 install -m 0755 ${S}/tools/dreport.d/include.d/* \
120 ${D}${dreport_include_dir}/
121}
122
Matt Spinler26ffa122018-03-29 16:18:02 -0500123# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500124# Create user directories based on the dump type value in the config section
125# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500126def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500127 import re
128 import configparser
129
130 #Read the user types from the dreport.conf file
131 configure = configparser.ConfigParser()
132 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
133 confsource = os.path.join(conf_dir, "dreport.conf")
134 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500135
Matt Spinler26ffa122018-03-29 16:18:02 -0500136 config = ("config:")
137 section = "DumpType"
138 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
139
140 script = os.path.basename(script_path)
141 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
142
143 file = open(script_path, "r")
144
145 for line in file:
146 if not config in line:
147 continue
148 revalue = re.search('[0-9]+.[0-9]+', line)
149 if not revalue:
150 bb.warn("Invalid format for config value =%s" % line)
151 continue
152 parse_value = revalue.group(0)
153 config_values = re.split('\W+', parse_value, 1)
154 if(len(config_values) != 2):
155 bb.warn("Invalid config value=%s" % parse_value)
156 break;
157 priority = config_values[1]
158 types = [int(d) for d in str(config_values[0])]
159 for type in types:
160 if not configure.has_option(section, str(type)):
161 bb.warn("Invalid dump type id =%s" % (str(type)))
162 continue
163 typestr = configure.get(section, str(type))
164 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
165 if not os.path.exists(destdir):
166 os.makedirs(destdir)
167 linkname = "E" + priority + script
168 destlink = os.path.join(destdir, linkname)
169 os.symlink(srclink, destlink)
170
171#Make the links for all the plugins
172python install_dreport_user_scripts() {
173
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500174 source = d.getVar('S', True)
175 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
176 scripts = os.listdir(source_path)
Matt Spinler26ffa122018-03-29 16:18:02 -0500177
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500178 for script in scripts:
179 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500180 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500181}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500182
Brad Bishop8623bbe2018-03-09 00:04:00 -0500183#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
184PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500185PACKAGECONFIG[ubifs-workaround] = " \
186 --enable-ubifs-workaround, \
187 --disable-ubifs-workaround \
188"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500189
190do_install[postfuncs] += "install_dreport"
191do_install[postfuncs] += "install_dreport_conf_file"
192do_install[postfuncs] += "install_dreport_plugins_scripts"
193do_install[postfuncs] += "install_dreport_include_scripts"
194do_install[postfuncs] += "install_dreport_user_scripts"