blob: da3151b9c444c3e29845d954959badb9afaaf7b7 [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"
8
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -05009DEBUG_COLLECTOR_PKGS = " \
10 ${PN}-manager \
11 ${PN}-monitor \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050012 ${PN}-dreport \
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050013 ${PN}-scripts \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050014"
Brad Bishop19a30ad2018-04-11 10:53:06 -040015PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}"
16ALLOW_EMPTY_${PN} = "1"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050017
18DBUS_PACKAGES = "${PN}-manager"
19
20SYSTEMD_PACKAGES = "${PN}-monitor"
21
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050022inherit autotools \
23 pkgconfig \
Jayanth Othayoth55c27902017-06-05 03:10:00 -050024 obmc-phosphor-dbus-service \
Jayanth Othayoth416458c2017-07-05 10:31:16 -050025 pythonnative \
26 phosphor-debug-collector
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050027
28require phosphor-debug-collector.inc
29
30DEPENDS += " \
31 phosphor-dbus-interfaces \
32 phosphor-dbus-interfaces-native \
33 phosphor-logging \
34 sdbusplus \
35 sdbusplus-native \
36 autoconf-archive-native \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050037"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050038
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050039RDEPENDS_${PN}-manager += " \
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050040 sdbusplus \
41 phosphor-dbus-interfaces \
42 phosphor-logging \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050043 ${PN}-dreport \
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050044"
45RDEPENDS_${PN}-monitor += " \
46 sdbusplus \
47 phosphor-dbus-interfaces \
48 phosphor-logging \
49"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050050RDEPENDS_${PN}-dreport += " \
51 systemd \
52 ${VIRTUAL-RUNTIME_base-utils} \
53 bash \
Jayanth Othayothd3e04c62017-07-25 09:29:37 -050054 xz \
Jayanth Othayothf4e66072017-07-29 22:28:44 -050055"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050056RDEPENDS_${PN}-scripts += " \
57 bash \
58"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050059
Jayanth Othayoth416458c2017-07-05 10:31:16 -050060MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
61
62SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
63
Manojkiran Edab36f3142018-05-26 10:37:52 +053064FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager ${exec_prefix}/lib/tmpfiles.d/coretemp.conf"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050065FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050066FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050067FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050068
Jayanth Othayoth416458c2017-07-05 10:31:16 -050069DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050070SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050071
Jayanth Othayoth771b37b2017-07-05 10:54:35 -050072EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}"
Jayanth Othayoth416458c2017-07-05 10:31:16 -050073
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050074S = "${WORKDIR}/git"
Manojkiran Edab36f3142018-05-26 10:37:52 +053075SRC_URI += "file://coretemp.conf"
76
77do_install_append() {
78 install -d ${D}${exec_prefix}/lib/tmpfiles.d
79 install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/
80}
Jayanth Othayothf4e66072017-07-29 22:28:44 -050081
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050082# Install dreport script
83# From tools/dreport.d/dreport to /usr/bin/dreport
84install_dreport() {
85 install -d ${D}${bindir}
86 install -m 0755 ${S}/tools/dreport.d/dreport \
87 ${D}${bindir}/dreport
88}
89
90# Install dreport sample configuration file
91# From tools/dreport.d/sample.conf
92# to /usr/share/dreport.d/conf.d/dreport.conf
93install_dreport_conf_file() {
94 install -d ${D}${dreport_conf_dir}
95 install -m 0644 ${S}/tools/dreport.d/sample.conf \
96 ${D}${dreport_conf_dir}/dreport.conf
97}
98
99# Install dreport plugins
100# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
101install_dreport_plugins_scripts() {
102 install -d ${D}${dreport_plugin_dir}
103 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
104}
105
106# Install dreport utility functions
107# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
108install_dreport_include_scripts() {
109 install -d ${D}${dreport_include_dir}
110 install -m 0755 ${S}/tools/dreport.d/include.d/* \
111 ${D}${dreport_include_dir}/
112}
113
Matt Spinler26ffa122018-03-29 16:18:02 -0500114# Make the links for a single user plugin script
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500115# Create user directories based on the dump type value in the config section
116# Create softlinks for the base scripts in the user directories
Matt Spinler26ffa122018-03-29 16:18:02 -0500117def install_dreport_user_script(script_path, d):
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500118 import re
119 import configparser
120
121 #Read the user types from the dreport.conf file
122 configure = configparser.ConfigParser()
123 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
124 confsource = os.path.join(conf_dir, "dreport.conf")
125 configure.read(confsource)
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500126
Matt Spinler26ffa122018-03-29 16:18:02 -0500127 config = ("config:")
128 section = "DumpType"
129 dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True)
130
131 script = os.path.basename(script_path)
132 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
133
134 file = open(script_path, "r")
135
136 for line in file:
137 if not config in line:
138 continue
139 revalue = re.search('[0-9]+.[0-9]+', line)
140 if not revalue:
141 bb.warn("Invalid format for config value =%s" % line)
142 continue
143 parse_value = revalue.group(0)
144 config_values = re.split('\W+', parse_value, 1)
145 if(len(config_values) != 2):
146 bb.warn("Invalid config value=%s" % parse_value)
147 break;
148 priority = config_values[1]
149 types = [int(d) for d in str(config_values[0])]
150 for type in types:
151 if not configure.has_option(section, str(type)):
152 bb.warn("Invalid dump type id =%s" % (str(type)))
153 continue
154 typestr = configure.get(section, str(type))
155 destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
156 if not os.path.exists(destdir):
157 os.makedirs(destdir)
158 linkname = "E" + priority + script
159 destlink = os.path.join(destdir, linkname)
160 os.symlink(srclink, destlink)
161
162#Make the links for all the plugins
163python install_dreport_user_scripts() {
164
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500165 source = d.getVar('S', True)
166 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
167 scripts = os.listdir(source_path)
Matt Spinler26ffa122018-03-29 16:18:02 -0500168
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500169 for script in scripts:
170 srcname = os.path.join(source_path, script)
Matt Spinler26ffa122018-03-29 16:18:02 -0500171 install_dreport_user_script(srcname, d)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500172}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500173
Brad Bishop8623bbe2018-03-09 00:04:00 -0500174#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
175PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500176PACKAGECONFIG[ubifs-workaround] = " \
177 --enable-ubifs-workaround, \
178 --disable-ubifs-workaround \
179"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500180
181do_install[postfuncs] += "install_dreport"
182do_install[postfuncs] += "install_dreport_conf_file"
183do_install[postfuncs] += "install_dreport_plugins_scripts"
184do_install[postfuncs] += "install_dreport_include_scripts"
185do_install[postfuncs] += "install_dreport_user_scripts"