1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
SUMMARY = "Phosphor Debug Collector"
DESCRIPTION = "Phosphor Debug Collector provides mechanisms \
to collect various log files and system parameters. \
This will be helpful for troubleshooting the problems in OpenBMC \
based systems."
PR = "r1"
DEBUG_COLLECTOR_PKGS = " \
${PN}-manager \
${PN}-monitor \
${PN}-dreport \
${PN}-scripts \
"
PACKAGES =+ "${DEBUG_COLLECTOR_PKGS}"
PACKAGES_remove = "${PN}"
RDEPENDS_${PN}-dev = "${DEBUG_COLLECTOR_PKGS}"
RDEPENDS_${PN}-staticdev = "${DEBUG_COLLECTOR_PKGS}"
DBUS_PACKAGES = "${PN}-manager"
SYSTEMD_PACKAGES = "${PN}-monitor"
inherit autotools \
pkgconfig \
obmc-phosphor-dbus-service \
pythonnative \
phosphor-debug-collector
require phosphor-debug-collector.inc
DEPENDS += " \
phosphor-dbus-interfaces \
phosphor-dbus-interfaces-native \
phosphor-logging \
sdbusplus \
sdbusplus-native \
autoconf-archive-native \
"
RDEPENDS_${PN}-manager += " \
sdbusplus \
phosphor-dbus-interfaces \
phosphor-logging \
${PN}-dreport \
"
RDEPENDS_${PN}-monitor += " \
sdbusplus \
phosphor-dbus-interfaces \
phosphor-logging \
"
RDEPENDS_${PN}-dreport += " \
systemd \
${VIRTUAL-RUNTIME_base-utils} \
bash \
xz \
"
RDEPENDS_${PN}-scripts += " \
bash \
"
MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager"
FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
FILES_${PN}-dreport += "${bindir}/dreport"
FILES_${PN}-scripts += "${dreport_dir}"
DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}"
S = "${WORKDIR}/git"
# Install dreport script
# From tools/dreport.d/dreport to /usr/bin/dreport
install_dreport() {
install -d ${D}${bindir}
install -m 0755 ${S}/tools/dreport.d/dreport \
${D}${bindir}/dreport
}
# Install dreport sample configuration file
# From tools/dreport.d/sample.conf
# to /usr/share/dreport.d/conf.d/dreport.conf
install_dreport_conf_file() {
install -d ${D}${dreport_conf_dir}
install -m 0644 ${S}/tools/dreport.d/sample.conf \
${D}${dreport_conf_dir}/dreport.conf
}
# Install dreport plugins
# From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d
install_dreport_plugins_scripts() {
install -d ${D}${dreport_plugin_dir}
install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/
}
# Install dreport utility functions
# From tools/dreport.d/include.d to /usr/share/dreport.d/include.d
install_dreport_include_scripts() {
install -d ${D}${dreport_include_dir}
install -m 0755 ${S}/tools/dreport.d/include.d/* \
${D}${dreport_include_dir}/
}
# Parse the scripts in base directory, read config value
# Create user directories based on the dump type value in the config section
# Create softlinks for the base scripts in the user directories
python install_dreport_user_scripts() {
from shutil import copyfile
import stat
import re
import configparser
#Read the user types from the dreport.conf file
configure = configparser.ConfigParser()
conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True)
confsource = os.path.join(conf_dir, "dreport.conf")
configure.read(confsource)
section = "DumpType"
options = configure.options(section)
#open the script from base dir and read the config value
source = d.getVar('S', True)
source_path = os.path.join(source, "tools", "dreport.d", "plugins.d")
scripts = os.listdir(source_path)
dreport_dir= d.getVar('D', True) + d.getVar('dreport_dir', True)
config = ("config:")
for script in scripts:
srcname = os.path.join(source_path, script)
srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script)
file = open(srcname, "r")
for line in file:
if not config in line:
continue
revalue = re.search('[0-9]+.[0-9]+', line)
if not revalue:
bb.warn("Invalid format for config value =%s" % line)
continue
parse_value = revalue.group(0)
config_values = re.split('\W+', parse_value, 1)
if(len(config_values) != 2):
bb.warn("Invalid config value=%s" % parse_value)
break;
priority = config_values[1]
types = [int(d) for d in str(config_values[0])]
for type in types:
if not configure.has_option(section, str(type)):
bb.warn("Invalid dump type id =%s" % (str(type)))
continue
typestr = configure.get(section, str(type))
destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d"))
if not os.path.exists(destdir):
os.makedirs(destdir)
linkname = "E" + priority + script
destlink = os.path.join(destdir, linkname)
os.symlink(srclink, destlink)
}
#Enable ubifs-workaround by MACHINE_FEATURE obmc-ubi-fs.
PACKAGECONFIG_append = "${@mf_enabled(d, 'obmc-ubi-fs', 'ubifs-workaround')}"
PACKAGECONFIG[ubifs-workaround] = " \
--enable-ubifs-workaround, \
--disable-ubifs-workaround \
"
do_install[postfuncs] += "install_dreport"
do_install[postfuncs] += "install_dreport_conf_file"
do_install[postfuncs] += "install_dreport_plugins_scripts"
do_install[postfuncs] += "install_dreport_include_scripts"
do_install[postfuncs] += "install_dreport_user_scripts"
|