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}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 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 | |
Andrew Geissler | ec34cc6 | 2021-11-03 09:57:52 -0500 | [diff] [blame] | 23 | inherit pkgconfig 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 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -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 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 47 | RDEPENDS:${PN}-dreport += " \ |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 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 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 53 | RDEPENDS:${PN}-scripts += " \ |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 61 | FILES:${PN}-manager += " \ |
Andrew Geissler | 74b8a09 | 2019-06-19 04:22:12 +0000 | [diff] [blame] | 62 | ${bindir}/phosphor-dump-manager \ |
Dhruvaraj Subhashchandran | 6bec723 | 2022-02-28 09:11:43 -0600 | [diff] [blame] | 63 | ${bindir}/phosphor-offload-handler \ |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 64 | ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \ |
| 65 | ${datadir}/dump/ \ |
| 66 | " |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 67 | FILES:${PN}-monitor += "${bindir}/phosphor-dump-monitor" |
| 68 | FILES:${PN}-monitor += "${bindir}/phosphor-ramoops-monitor" |
| 69 | FILES:${PN}-dreport += "${bindir}/dreport" |
| 70 | FILES:${PN}-scripts += "${dreport_dir}" |
Jayanth Othayoth | 2a5d91e | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 71 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 72 | DBUS_SERVICE:${PN}-manager += "${MGR_SVC}" |
| 73 | SYSTEMD_SERVICE:${PN}-monitor += "obmc-dump-monitor.service" |
| 74 | SYSTEMD_SERVICE:${PN}-monitor += "ramoops-monitor.service" |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 75 | |
Ramesh Iyyar | 42e76b3 | 2020-08-21 03:57:44 -0500 | [diff] [blame] | 76 | EXTRA_OEMESON = " \ |
| 77 | -DBMC_DUMP_PATH=${bmc_dump_path} \ |
| 78 | -DERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \ |
Marri Devender Rao | 5035fcf | 2018-11-21 06:30:36 -0600 | [diff] [blame] | 79 | " |
Jayanth Othayoth | 416458c | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 80 | |
Jayanth Othayoth | 9be81b1 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 81 | S = "${WORKDIR}/git" |
Manojkiran Eda | b36f314 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 82 | SRC_URI += "file://coretemp.conf" |
| 83 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 84 | do_install:append() { |
Manojkiran Eda | b36f314 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 85 | install -d ${D}${exec_prefix}/lib/tmpfiles.d |
| 86 | install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/ |
| 87 | } |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 88 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 89 | # Install dreport script |
| 90 | # From tools/dreport.d/dreport to /usr/bin/dreport |
| 91 | install_dreport() { |
| 92 | install -d ${D}${bindir} |
| 93 | install -m 0755 ${S}/tools/dreport.d/dreport \ |
| 94 | ${D}${bindir}/dreport |
| 95 | } |
| 96 | |
| 97 | # Install dreport sample configuration file |
| 98 | # From tools/dreport.d/sample.conf |
| 99 | # to /usr/share/dreport.d/conf.d/dreport.conf |
| 100 | install_dreport_conf_file() { |
| 101 | install -d ${D}${dreport_conf_dir} |
| 102 | install -m 0644 ${S}/tools/dreport.d/sample.conf \ |
| 103 | ${D}${dreport_conf_dir}/dreport.conf |
| 104 | } |
| 105 | |
| 106 | # Install dreport plugins |
| 107 | # From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d |
| 108 | install_dreport_plugins_scripts() { |
| 109 | install -d ${D}${dreport_plugin_dir} |
| 110 | install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/ |
| 111 | } |
| 112 | |
| 113 | # Install dreport utility functions |
| 114 | # From tools/dreport.d/include.d to /usr/share/dreport.d/include.d |
| 115 | install_dreport_include_scripts() { |
| 116 | install -d ${D}${dreport_include_dir} |
| 117 | install -m 0755 ${S}/tools/dreport.d/include.d/* \ |
| 118 | ${D}${dreport_include_dir}/ |
| 119 | } |
| 120 | |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 121 | # Make the links for a single user plugin script |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 122 | # Create user directories based on the dump type value in the config section |
| 123 | # Create softlinks for the base scripts in the user directories |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 124 | def install_dreport_user_script(script_path, d): |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 125 | import re |
| 126 | import configparser |
| 127 | |
| 128 | #Read the user types from the dreport.conf file |
| 129 | configure = configparser.ConfigParser() |
| 130 | conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True) |
| 131 | confsource = os.path.join(conf_dir, "dreport.conf") |
| 132 | configure.read(confsource) |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 133 | |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 134 | config = ("config:") |
| 135 | section = "DumpType" |
| 136 | dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True) |
| 137 | |
| 138 | script = os.path.basename(script_path) |
| 139 | srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script) |
| 140 | |
| 141 | file = open(script_path, "r") |
| 142 | |
| 143 | for line in file: |
| 144 | if not config in line: |
| 145 | continue |
| 146 | revalue = re.search('[0-9]+.[0-9]+', line) |
| 147 | if not revalue: |
| 148 | bb.warn("Invalid format for config value =%s" % line) |
| 149 | continue |
| 150 | parse_value = revalue.group(0) |
George Liu | aad4f3d | 2021-10-13 15:47:46 +0800 | [diff] [blame] | 151 | config_values = re.split(r'\W+', parse_value, 1) |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 152 | if(len(config_values) != 2): |
| 153 | bb.warn("Invalid config value=%s" % parse_value) |
| 154 | break; |
| 155 | priority = config_values[1] |
| 156 | types = [int(d) for d in str(config_values[0])] |
| 157 | for type in types: |
| 158 | if not configure.has_option(section, str(type)): |
| 159 | bb.warn("Invalid dump type id =%s" % (str(type))) |
| 160 | continue |
| 161 | typestr = configure.get(section, str(type)) |
| 162 | destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d")) |
| 163 | if not os.path.exists(destdir): |
| 164 | os.makedirs(destdir) |
| 165 | linkname = "E" + priority + script |
| 166 | destlink = os.path.join(destdir, linkname) |
| 167 | os.symlink(srclink, destlink) |
George Liu | 3b3898d | 2021-05-02 10:03:08 +0800 | [diff] [blame] | 168 | file.close() |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 169 | |
| 170 | #Make the links for all the plugins |
| 171 | python install_dreport_user_scripts() { |
| 172 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 173 | source = d.getVar('S', True) |
| 174 | source_path = os.path.join(source, "tools", "dreport.d", "plugins.d") |
| 175 | scripts = os.listdir(source_path) |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 176 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 177 | for script in scripts: |
| 178 | srcname = os.path.join(source_path, script) |
Matt Spinler | 26ffa12 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 179 | install_dreport_user_script(srcname, d) |
Jayanth Othayoth | f4e6607 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 180 | } |
Jayanth Othayoth | 5e9fff0 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 181 | |
Chirag Sharma | b1e568e | 2021-02-08 01:23:47 -0600 | [diff] [blame] | 182 | PACKAGECONFIG ??= "${@bb.utils.contains_any('DISTRO_FEATURES', \ |
| 183 | 'obmc-ubi-fs phosphor-mmc', '', 'jffs-workaround', d)}" |
| 184 | PACKAGECONFIG[jffs-workaround] = "-Djffs-workaround=enabled, \ |
| 185 | -Djffs-workaround=disabled" |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 186 | |
Ramesh Iyyar | b5c2fac | 2020-12-07 06:46:45 -0600 | [diff] [blame] | 187 | PACKAGECONFIG[host-dump-transport-pldm] = " \ |
| 188 | -Dhost-transport=pldm,, \ |
Dhruvaraj Subhashchandran | cb29228 | 2020-03-20 08:17:16 -0500 | [diff] [blame] | 189 | pldm \ |
| 190 | " |
| 191 | |
Dhruvaraj Subhashchandran | f7d4b71 | 2020-10-06 23:13:01 -0500 | [diff] [blame] | 192 | PACKAGECONFIG[openpower-dumps-extension] = " \ |
| 193 | -Dopenpower-dumps-extension=enabled, \ |
| 194 | -Dopenpower-dumps-extension=disabled \ |
| 195 | " |
| 196 | |
Marri Devender Rao | b6e5cb0 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 197 | do_install[postfuncs] += "install_dreport" |
| 198 | do_install[postfuncs] += "install_dreport_conf_file" |
| 199 | do_install[postfuncs] += "install_dreport_plugins_scripts" |
| 200 | do_install[postfuncs] += "install_dreport_include_scripts" |
| 201 | do_install[postfuncs] += "install_dreport_user_scripts" |