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