blob: fcbe8ae5eeba57737b8f9d4052f3996cdd65770e [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"
15PACKAGES =+ "${DEBUG_COLLECTOR_PKGS}"
16PACKAGES_remove = "${PN}"
17RDEPENDS_${PN}-dev = "${DEBUG_COLLECTOR_PKGS}"
18RDEPENDS_${PN}-staticdev = "${DEBUG_COLLECTOR_PKGS}"
19
20DBUS_PACKAGES = "${PN}-manager"
21
22SYSTEMD_PACKAGES = "${PN}-monitor"
23
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050024inherit autotools \
25 pkgconfig \
Jayanth Othayoth55c27902017-06-05 03:10:00 -050026 obmc-phosphor-dbus-service \
Jayanth Othayoth416458c2017-07-05 10:31:16 -050027 pythonnative \
28 phosphor-debug-collector
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050029
30require phosphor-debug-collector.inc
31
32DEPENDS += " \
33 phosphor-dbus-interfaces \
34 phosphor-dbus-interfaces-native \
35 phosphor-logging \
36 sdbusplus \
37 sdbusplus-native \
38 autoconf-archive-native \
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
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050066FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager"
67FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050068FILES_${PN}-dreport += "${bindir}/dreport"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050069FILES_${PN}-scripts += "${dreport_dir}"
Jayanth Othayoth2a5d91e2017-05-31 06:25:55 -050070
Jayanth Othayoth416458c2017-07-05 10:31:16 -050071DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
Jayanth Othayothc142e772017-09-15 10:55:35 -050072SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050073
Jayanth Othayoth771b37b2017-07-05 10:54:35 -050074EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}"
Jayanth Othayoth416458c2017-07-05 10:31:16 -050075
Jayanth Othayoth9be81b12017-05-08 09:25:05 -050076S = "${WORKDIR}/git"
Jayanth Othayothf4e66072017-07-29 22:28:44 -050077
Marri Devender Raob6e5cb02017-10-11 02:22:46 -050078# Install dreport script
79# From tools/dreport.d/dreport to /usr/bin/dreport
80install_dreport() {
81 install -d ${D}${bindir}
82 install -m 0755 ${S}/tools/dreport.d/dreport \
83 ${D}${bindir}/dreport
84}
85
86# Install dreport sample configuration file
87# From tools/dreport.d/sample.conf
88# to /usr/share/dreport.d/conf.d/dreport.conf
89install_dreport_conf_file() {
90 install -d ${D}${dreport_conf_dir}
91 install -m 0644 ${S}/tools/dreport.d/sample.conf \
92 ${D}${dreport_conf_dir}/dreport.conf
93}
94
95# Install dreport plugins
96# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
97install_dreport_plugins_scripts() {
98 install -d ${D}${dreport_plugin_dir}
99 install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
100}
101
102# Install dreport utility functions
103# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
104install_dreport_include_scripts() {
105 install -d ${D}${dreport_include_dir}
106 install -m 0755 ${S}/tools/dreport.d/include.d/* \
107 ${D}${dreport_include_dir}/
108}
109
110# Parse the scripts in base directory, read config value
111# Create user directories based on the dump type value in the config section
112# Create softlinks for the base scripts in the user directories
113python install_dreport_user_scripts() {
114 from shutil import copyfile
115 import stat
116 import re
117 import configparser
118
119 #Read the user types from the dreport.conf file
120 configure = configparser.ConfigParser()
121 conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
122 confsource = os.path.join(conf_dir, "dreport.conf")
123 configure.read(confsource)
124 section = "DumpType"
125 options = configure.options(section)
126
127 #open the script from base dir and read the config value
128 source = d.getVar('S', True)
129 source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
130 scripts = os.listdir(source_path)
131 dreport_dir= d.getVar('D', True) + d.getVar('dreport_dir', True)
132 config = ("config:")
133 for script in scripts:
134 srcname = os.path.join(source_path, script)
135 srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
136 file = open(srcname, "r")
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)
Jayanth Othayothf4e66072017-07-29 22:28:44 -0500162}
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500163
Brad Bishop8623bbe2018-03-09 00:04:00 -0500164#Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs.
165PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround"
Jayanth Othayoth5e9fff02017-10-12 01:47:31 -0500166PACKAGECONFIG[ubifs-workaround] = " \
167 --enable-ubifs-workaround, \
168 --disable-ubifs-workaround \
169"
Marri Devender Raob6e5cb02017-10-11 02:22:46 -0500170
171do_install[postfuncs] += "install_dreport"
172do_install[postfuncs] += "install_dreport_conf_file"
173do_install[postfuncs] += "install_dreport_plugins_scripts"
174do_install[postfuncs] += "install_dreport_include_scripts"
175do_install[postfuncs] += "install_dreport_user_scripts"