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