Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 1 | SUMMARY = "Phosphor Debug Collector" |
| 2 | DESCRIPTION = "Phosphor Debug Collector provides mechanisms \ |
Gunnar Mills | 2867a48 | 2017-08-08 10:53:28 -0500 | [diff] [blame] | 3 | to collect various log files and system parameters. \ |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 4 | This will be helpful for troubleshooting the problems in OpenBMC \ |
| 5 | based systems." |
| 6 | |
| 7 | PR = "r1" |
Patrick Venture | 32f8423 | 2018-10-21 08:25:47 -0700 | [diff] [blame] | 8 | PV = "1.0+git${SRCPV}" |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 9 | |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 10 | DEBUG_COLLECTOR_PKGS = " \ |
| 11 | ${PN}-manager \ |
| 12 | ${PN}-monitor \ |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 13 | ${PN}-dreport \ |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 14 | ${PN}-scripts \ |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 15 | " |
Brad Bishop | be45c3f | 2018-04-11 10:53:06 -0400 | [diff] [blame] | 16 | PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}" |
| 17 | ALLOW_EMPTY_${PN} = "1" |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 18 | |
| 19 | DBUS_PACKAGES = "${PN}-manager" |
| 20 | |
| 21 | SYSTEMD_PACKAGES = "${PN}-monitor" |
| 22 | |
Ramesh Iyyar | b5f0cdd | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 23 | inherit meson \ |
Jayanth Othayoth | aae91e3 | 2017-06-05 03:10:00 -0500 | [diff] [blame] | 24 | obmc-phosphor-dbus-service \ |
Jayanth Othayoth | f9cd1c6 | 2020-02-20 00:14:29 -0600 | [diff] [blame] | 25 | python3native \ |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 26 | phosphor-debug-collector |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 27 | |
| 28 | require phosphor-debug-collector.inc |
| 29 | |
| 30 | DEPENDS += " \ |
| 31 | phosphor-dbus-interfaces \ |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 32 | phosphor-logging \ |
| 33 | sdbusplus \ |
Patrick Williams | 2bebd12 | 2020-03-31 16:43:15 -0500 | [diff] [blame] | 34 | ${PYTHON_PN}-sdbus++-native \ |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 35 | autoconf-archive-native \ |
Marri Devender Rao | ae62254 | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 36 | virtual/phosphor-debug-errors \ |
Jayanth Othayoth | 5216d11 | 2020-03-17 07:44:21 -0500 | [diff] [blame] | 37 | ${PYTHON_PN}-native \ |
| 38 | ${PYTHON_PN}-pyyaml-native \ |
| 39 | ${PYTHON_PN}-setuptools-native \ |
| 40 | ${PYTHON_PN}-mako-native \ |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 41 | " |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 42 | |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 43 | RDEPENDS_${PN}-manager += " \ |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 44 | ${PN}-dreport \ |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 45 | " |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 46 | RDEPENDS_${PN}-dreport += " \ |
| 47 | systemd \ |
| 48 | ${VIRTUAL-RUNTIME_base-utils} \ |
| 49 | bash \ |
Jayanth Othayoth | 947c07b | 2017-07-25 09:29:37 -0500 | [diff] [blame] | 50 | xz \ |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 51 | " |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 52 | RDEPENDS_${PN}-scripts += " \ |
| 53 | bash \ |
| 54 | " |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 55 | |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 56 | MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service" |
| 57 | |
| 58 | SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}" |
| 59 | |
Marri Devender Rao | ae62254 | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 60 | FILES_${PN}-manager += " \ |
Andrew Geissler | f09b8a8 | 2019-06-19 04:22:12 +0000 | [diff] [blame] | 61 | ${bindir}/phosphor-dump-manager \ |
Marri Devender Rao | ae62254 | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 62 | ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \ |
| 63 | ${datadir}/dump/ \ |
| 64 | " |
Andrew Geissler | f09b8a8 | 2019-06-19 04:22:12 +0000 | [diff] [blame] | 65 | FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor" |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 66 | FILES_${PN}-dreport += "${bindir}/dreport" |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 67 | FILES_${PN}-scripts += "${dreport_dir}" |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 68 | |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 69 | DBUS_SERVICE_${PN}-manager += "${MGR_SVC}" |
Jayanth Othayoth | ce4dfa0 | 2017-09-15 10:55:35 -0500 | [diff] [blame] | 70 | SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service" |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 71 | |
Ramesh Iyyar | b5f0cdd | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 72 | EXTRA_OEMESON = " \ |
| 73 | -DBMC_DUMP_PATH=${bmc_dump_path} \ |
| 74 | -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \ |
Marri Devender Rao | ae62254 | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 75 | " |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 76 | |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 77 | S = "${WORKDIR}/git" |
Manojkiran Eda | 9fe03c6 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 78 | SRC_URI += "file://coretemp.conf" |
| 79 | |
| 80 | do_install_append() { |
| 81 | install -d ${D}${exec_prefix}/lib/tmpfiles.d |
| 82 | install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/ |
| 83 | } |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 84 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 85 | # Install dreport script |
| 86 | # From tools/dreport.d/dreport to /usr/bin/dreport |
| 87 | install_dreport() { |
| 88 | install -d ${D}${bindir} |
| 89 | install -m 0755 ${S}/tools/dreport.d/dreport \ |
| 90 | ${D}${bindir}/dreport |
| 91 | } |
| 92 | |
| 93 | # Install dreport sample configuration file |
| 94 | # From tools/dreport.d/sample.conf |
| 95 | # to /usr/share/dreport.d/conf.d/dreport.conf |
| 96 | install_dreport_conf_file() { |
| 97 | install -d ${D}${dreport_conf_dir} |
| 98 | install -m 0644 ${S}/tools/dreport.d/sample.conf \ |
| 99 | ${D}${dreport_conf_dir}/dreport.conf |
| 100 | } |
| 101 | |
| 102 | # Install dreport plugins |
| 103 | # From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d |
| 104 | install_dreport_plugins_scripts() { |
| 105 | install -d ${D}${dreport_plugin_dir} |
| 106 | install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/ |
| 107 | } |
| 108 | |
| 109 | # Install dreport utility functions |
| 110 | # From tools/dreport.d/include.d to /usr/share/dreport.d/include.d |
| 111 | install_dreport_include_scripts() { |
| 112 | install -d ${D}${dreport_include_dir} |
| 113 | install -m 0755 ${S}/tools/dreport.d/include.d/* \ |
| 114 | ${D}${dreport_include_dir}/ |
| 115 | } |
| 116 | |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 117 | # Make the links for a single user plugin script |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 118 | # Create user directories based on the dump type value in the config section |
| 119 | # Create softlinks for the base scripts in the user directories |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 120 | def install_dreport_user_script(script_path, d): |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 121 | import re |
| 122 | import configparser |
| 123 | |
| 124 | #Read the user types from the dreport.conf file |
| 125 | configure = configparser.ConfigParser() |
| 126 | conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True) |
| 127 | confsource = os.path.join(conf_dir, "dreport.conf") |
| 128 | configure.read(confsource) |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 129 | |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 130 | config = ("config:") |
| 131 | section = "DumpType" |
| 132 | dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True) |
| 133 | |
| 134 | script = os.path.basename(script_path) |
| 135 | srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script) |
| 136 | |
| 137 | file = open(script_path, "r") |
| 138 | |
| 139 | for line in file: |
| 140 | if not config in line: |
| 141 | continue |
| 142 | revalue = re.search('[0-9]+.[0-9]+', line) |
| 143 | if not revalue: |
| 144 | bb.warn("Invalid format for config value =%s" % line) |
| 145 | continue |
| 146 | parse_value = revalue.group(0) |
| 147 | config_values = re.split('\W+', parse_value, 1) |
| 148 | if(len(config_values) != 2): |
| 149 | bb.warn("Invalid config value=%s" % parse_value) |
| 150 | break; |
| 151 | priority = config_values[1] |
| 152 | types = [int(d) for d in str(config_values[0])] |
| 153 | for type in types: |
| 154 | if not configure.has_option(section, str(type)): |
| 155 | bb.warn("Invalid dump type id =%s" % (str(type))) |
| 156 | continue |
| 157 | typestr = configure.get(section, str(type)) |
| 158 | destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d")) |
| 159 | if not os.path.exists(destdir): |
| 160 | os.makedirs(destdir) |
| 161 | linkname = "E" + priority + script |
| 162 | destlink = os.path.join(destdir, linkname) |
| 163 | os.symlink(srclink, destlink) |
| 164 | |
| 165 | #Make the links for all the plugins |
| 166 | python install_dreport_user_scripts() { |
| 167 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 168 | source = d.getVar('S', True) |
| 169 | source_path = os.path.join(source, "tools", "dreport.d", "plugins.d") |
| 170 | scripts = os.listdir(source_path) |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 171 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 172 | for script in scripts: |
| 173 | srcname = os.path.join(source_path, script) |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 174 | install_dreport_user_script(srcname, d) |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 175 | } |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 176 | |
Brad Bishop | 811eeec | 2018-03-09 00:04:00 -0500 | [diff] [blame] | 177 | #Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs. |
| 178 | PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround" |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 179 | PACKAGECONFIG[ubifs-workaround] = " \ |
Ramesh Iyyar | b5f0cdd | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 180 | -Dubifs-workaround=enabled, \ |
| 181 | -Dubifs-workaround=disabled \ |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 182 | " |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 183 | |
Dhruvaraj Subhashchandran | 0402743 | 2020-03-20 08:17:16 -0500 | [diff] [blame] | 184 | PACKAGECONFIG[host-dump-offload-pldm] = " \ |
Ramesh Iyyar | b5f0cdd | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 185 | -Dhost-dump-offload-transport=pldm,, \ |
Dhruvaraj Subhashchandran | 0402743 | 2020-03-20 08:17:16 -0500 | [diff] [blame] | 186 | pldm \ |
| 187 | " |
| 188 | |
Dhruvaraj Subhashchandran | 9cc0e41 | 2020-10-06 23:13:01 -0500 | [diff] [blame] | 189 | PACKAGECONFIG[openpower-dumps-extension] = " \ |
| 190 | -Dopenpower-dumps-extension=enabled, \ |
| 191 | -Dopenpower-dumps-extension=disabled \ |
| 192 | " |
| 193 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 194 | do_install[postfuncs] += "install_dreport" |
| 195 | do_install[postfuncs] += "install_dreport_conf_file" |
| 196 | do_install[postfuncs] += "install_dreport_plugins_scripts" |
| 197 | do_install[postfuncs] += "install_dreport_include_scripts" |
| 198 | do_install[postfuncs] += "install_dreport_user_scripts" |