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