Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 1 | SUMMARY = "Phosphor Debug Collector" |
| 2 | DESCRIPTION = "Phosphor Debug Collector provides mechanisms \ |
Gunnar Mills | dc81cf1 | 2017-08-08 10:53:28 -0500 | [diff] [blame] | 3 | to collect various log files and system parameters. \ |
Jayanth Othayoth | 9be81b1 | 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 | d29807a | 2018-10-21 08:25:47 -0700 | [diff] [blame] | 8 | PV = "1.0+git${SRCPV}" |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 9 | |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 10 | DEBUG_COLLECTOR_PKGS = " \ |
| 11 | ${PN}-manager \ |
| 12 | ${PN}-monitor \ |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 13 | ${PN}-dreport \ |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 14 | ${PN}-scripts \ |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 15 | " |
Brad Bishop | 19a30ad | 2018-04-11 10:53:06 -0400 | [diff] [blame] | 16 | PACKAGE_BEFORE_PN += "${DEBUG_COLLECTOR_PKGS}" |
| 17 | ALLOW_EMPTY_${PN} = "1" |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 18 | |
| 19 | DBUS_PACKAGES = "${PN}-manager" |
| 20 | |
| 21 | SYSTEMD_PACKAGES = "${PN}-monitor" |
| 22 | |
Ramesh Iyyar | 42e76b3 | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 23 | inherit meson \ |
Jayanth Othayoth | 55c2790 | 2017-06-05 03:10:00 -0500 | [diff] [blame] | 24 | obmc-phosphor-dbus-service \ |
Jayanth Othayoth | 6d7788f | 2020-02-20 00:14:29 -0600 | [diff] [blame] | 25 | python3native \ |
Jayanth Othayoth | 416458c | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 26 | phosphor-debug-collector |
Jayanth Othayoth | 9be81b1 | 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 | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 32 | phosphor-logging \ |
| 33 | sdbusplus \ |
Patrick Williams | 4b32c9a | 2020-03-31 16:43:15 -0500 | [diff] [blame] | 34 | ${PYTHON_PN}-sdbus++-native \ |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 35 | autoconf-archive-native \ |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 36 | virtual/phosphor-debug-errors \ |
Jayanth Othayoth | 39f5a6b | 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 \ |
George Liu | 970dc7e | 2021-07-12 16:53:19 +0800 | [diff] [blame^] | 41 | fmt \ |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 42 | " |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 43 | |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 44 | RDEPENDS_${PN}-manager += " \ |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 45 | ${PN}-dreport \ |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 46 | " |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 47 | RDEPENDS_${PN}-dreport += " \ |
| 48 | systemd \ |
| 49 | ${VIRTUAL-RUNTIME_base-utils} \ |
| 50 | bash \ |
Jayanth Othayoth | d3e04c6 | 2017-07-25 09:29:37 -0500 | [diff] [blame] | 51 | xz \ |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 52 | " |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 53 | RDEPENDS_${PN}-scripts += " \ |
| 54 | bash \ |
| 55 | " |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 56 | |
Jayanth Othayoth | 416458c | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 57 | MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service" |
| 58 | |
| 59 | SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}" |
| 60 | |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 61 | FILES_${PN}-manager += " \ |
Andrew Geissler | 74b8a09 | 2019-06-19 04:22:12 +0000 | [diff] [blame] | 62 | ${bindir}/phosphor-dump-manager \ |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 63 | ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \ |
| 64 | ${datadir}/dump/ \ |
| 65 | " |
Andrew Geissler | 74b8a09 | 2019-06-19 04:22:12 +0000 | [diff] [blame] | 66 | FILES_${PN}-monitor += "${bindir}/phosphor-dump-monitor" |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 67 | FILES_${PN}-dreport += "${bindir}/dreport" |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 68 | FILES_${PN}-scripts += "${dreport_dir}" |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 69 | |
Jayanth Othayoth | 416458c | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 70 | DBUS_SERVICE_${PN}-manager += "${MGR_SVC}" |
Jayanth Othayoth | c142e77 | 2017-09-15 10:55:35 -0500 | [diff] [blame] | 71 | SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service" |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 72 | |
Ramesh Iyyar | 42e76b3 | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 73 | EXTRA_OEMESON = " \ |
| 74 | -DBMC_DUMP_PATH=${bmc_dump_path} \ |
| 75 | -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \ |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 76 | " |
Jayanth Othayoth | 416458c | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 77 | |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 78 | S = "${WORKDIR}/git" |
Manojkiran Eda | b36f314 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 79 | SRC_URI += "file://coretemp.conf" |
| 80 | |
| 81 | do_install_append() { |
| 82 | install -d ${D}${exec_prefix}/lib/tmpfiles.d |
| 83 | install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/ |
| 84 | } |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 85 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 86 | # Install dreport script |
| 87 | # From tools/dreport.d/dreport to /usr/bin/dreport |
| 88 | install_dreport() { |
| 89 | install -d ${D}${bindir} |
| 90 | install -m 0755 ${S}/tools/dreport.d/dreport \ |
| 91 | ${D}${bindir}/dreport |
| 92 | } |
| 93 | |
| 94 | # Install dreport sample configuration file |
| 95 | # From tools/dreport.d/sample.conf |
| 96 | # to /usr/share/dreport.d/conf.d/dreport.conf |
| 97 | install_dreport_conf_file() { |
| 98 | install -d ${D}${dreport_conf_dir} |
| 99 | install -m 0644 ${S}/tools/dreport.d/sample.conf \ |
| 100 | ${D}${dreport_conf_dir}/dreport.conf |
| 101 | } |
| 102 | |
| 103 | # Install dreport plugins |
| 104 | # From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d |
| 105 | install_dreport_plugins_scripts() { |
| 106 | install -d ${D}${dreport_plugin_dir} |
| 107 | install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/ |
| 108 | } |
| 109 | |
| 110 | # Install dreport utility functions |
| 111 | # From tools/dreport.d/include.d to /usr/share/dreport.d/include.d |
| 112 | install_dreport_include_scripts() { |
| 113 | install -d ${D}${dreport_include_dir} |
| 114 | install -m 0755 ${S}/tools/dreport.d/include.d/* \ |
| 115 | ${D}${dreport_include_dir}/ |
| 116 | } |
| 117 | |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 118 | # Make the links for a single user plugin script |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 119 | # Create user directories based on the dump type value in the config section |
| 120 | # Create softlinks for the base scripts in the user directories |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 121 | def install_dreport_user_script(script_path, d): |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 122 | import re |
| 123 | import configparser |
| 124 | |
| 125 | #Read the user types from the dreport.conf file |
| 126 | configure = configparser.ConfigParser() |
| 127 | conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True) |
| 128 | confsource = os.path.join(conf_dir, "dreport.conf") |
| 129 | configure.read(confsource) |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 130 | |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 131 | config = ("config:") |
| 132 | section = "DumpType" |
| 133 | dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True) |
| 134 | |
| 135 | script = os.path.basename(script_path) |
| 136 | srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script) |
| 137 | |
| 138 | file = open(script_path, "r") |
| 139 | |
| 140 | for line in file: |
| 141 | if not config in line: |
| 142 | continue |
| 143 | revalue = re.search('[0-9]+.[0-9]+', line) |
| 144 | if not revalue: |
| 145 | bb.warn("Invalid format for config value =%s" % line) |
| 146 | continue |
| 147 | parse_value = revalue.group(0) |
| 148 | config_values = re.split('\W+', parse_value, 1) |
| 149 | if(len(config_values) != 2): |
| 150 | bb.warn("Invalid config value=%s" % parse_value) |
| 151 | break; |
| 152 | priority = config_values[1] |
| 153 | types = [int(d) for d in str(config_values[0])] |
| 154 | for type in types: |
| 155 | if not configure.has_option(section, str(type)): |
| 156 | bb.warn("Invalid dump type id =%s" % (str(type))) |
| 157 | continue |
| 158 | typestr = configure.get(section, str(type)) |
| 159 | destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d")) |
| 160 | if not os.path.exists(destdir): |
| 161 | os.makedirs(destdir) |
| 162 | linkname = "E" + priority + script |
| 163 | destlink = os.path.join(destdir, linkname) |
| 164 | os.symlink(srclink, destlink) |
George Liu | 3b3898d | 2021-05-02 10:03:08 +0800 | [diff] [blame] | 165 | file.close() |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 166 | |
| 167 | #Make the links for all the plugins |
| 168 | python install_dreport_user_scripts() { |
| 169 | |
Marri Devender Rao | b6e5cb0 | 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 | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 173 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 174 | for script in scripts: |
| 175 | srcname = os.path.join(source_path, script) |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 176 | install_dreport_user_script(srcname, d) |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 177 | } |
Jayanth Othayoth | 5e9fff0 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 178 | |
Chirag Sharma | b1e568e | 2021-02-08 01:23:47 -0600 | [diff] [blame] | 179 | PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \ |
| 180 | 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}" |
| 181 | PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \ |
| 182 | -Djffs-workaround=disabled" |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 183 | |
Ramesh Iyyar | b5c2fac | 2020-12-07 06:46:45 -0600 | [diff] [blame] | 184 | PACKAGECONFIG[host-dump-transport-pldm] = " \ |
| 185 | -Dhost-transport=pldm,, \ |
Dhruvaraj Subhashchandran | cb29228 | 2020-03-20 08:17:16 -0500 | [diff] [blame] | 186 | pldm \ |
| 187 | " |
| 188 | |
Dhruvaraj Subhashchandran | f7d4b71 | 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 | b6e5cb0 | 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" |