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