blob: 3ac005b88bc92d841b29ee0ff711616d93577d73 [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 Venture70852f22018-10-16 09:47:15 -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
Jayanth Othayoth9963d172017-05-08 09:25:05 -050023inherit autotools \
24 pkgconfig \
Jayanth Othayothaae91e32017-06-05 03:10:00 -050025 obmc-phosphor-dbus-service \
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050026 pythonnative \
27 phosphor-debug-collector
Jayanth Othayoth9963d172017-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 \
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050038"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050039
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050040RDEPENDS_${PN}-manager += " \
Jayanth Othayoth9963d172017-05-08 09:25:05 -050041 sdbusplus \
42 phosphor-dbus-interfaces \
43 phosphor-logging \
Jayanth Othayothd2592492017-07-29 22:28:44 -050044 ${PN}-dreport \
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050045"
46RDEPENDS_${PN}-monitor += " \
47 sdbusplus \
48 phosphor-dbus-interfaces \
49 phosphor-logging \
50"
Jayanth Othayothd2592492017-07-29 22:28:44 -050051RDEPENDS_${PN}-dreport += " \
52 systemd \
53 ${VIRTUAL-RUNTIME_base-utils} \
54 bash \
Jayanth Othayoth947c07b2017-07-25 09:29:37 -050055 xz \
Jayanth Othayothd2592492017-07-29 22:28:44 -050056"
Marri Devender Rao33603922017-10-11 02:22:46 -050057RDEPENDS_${PN}-scripts += " \
58 bash \
59"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050060
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050061MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
62
63SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
64
Manojkiran Eda9fe03c62018-05-26 10:37:52 +053065FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager ${exec_prefix}/lib/tmpfiles.d/coretemp.conf"
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050066FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
Jayanth Othayothd2592492017-07-29 22:28:44 -050067FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Rao33603922017-10-11 02:22:46 -050068FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth9d21d6c2017-05-31 06:25:55 -050069
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050070DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothce4dfa02017-09-15 10:55:35 -050071SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9963d172017-05-08 09:25:05 -050072
Jayanth Othayothf1b85172017-07-05 10:54:35 -050073EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}"
Jayanth Othayoth5f6d8852017-07-05 10:31:16 -050074
Jayanth Othayoth9963d172017-05-08 09:25:05 -050075S = "${WORKDIR}/git"
Manojkiran Eda9fe03c62018-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 Othayothd2592492017-07-29 22:28:44 -050082
Marri Devender Rao33603922017-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 Spinler015f6b12018-03-29 16:18:02 -0500115# Make the links for a single user plugin script
Marri Devender Rao33603922017-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 Spinler015f6b12018-03-29 16:18:02 -0500118def install_dreport_user_script(script_path, d):
Marri Devender Rao33603922017-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 Rao33603922017-10-11 02:22:46 -0500127
Matt Spinler015f6b12018-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 Rao33603922017-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 Spinler015f6b12018-03-29 16:18:02 -0500169
Marri Devender Rao33603922017-10-11 02:22:46 -0500170 for script in scripts:
171 srcname = os.path.join(source_path, script)
Matt Spinler015f6b12018-03-29 16:18:02 -0500172 install_dreport_user_script(srcname, d)
Jayanth Othayothd2592492017-07-29 22:28:44 -0500173}
Jayanth Othayothb6a69b52017-10-12 01:47:31 -0500174
Brad Bishop811eeec2018-03-09 00:04:00 -0500175#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
176PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayothb6a69b52017-10-12 01:47:31 -0500177PACKAGECONFIG[ubifs-workaround] = " \
178 --enable-ubifs-workaround, \
179 --disable-ubifs-workaround \
180"
Marri Devender Rao33603922017-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"