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 | |
Manojkiran Eda | 9fe03c6 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 64 | 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] | 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" |
Manojkiran Eda | 9fe03c6 | 2018-05-26 10:37:52 +0530 | [diff] [blame] | 75 | SRC_URI += "file://coretemp.conf" |
| 76 | |
| 77 | do_install_append() { |
| 78 | install -d ${D}${exec_prefix}/lib/tmpfiles.d |
| 79 | install -m 644 ${WORKDIR}/coretemp.conf ${D}${exec_prefix}/lib/tmpfiles.d/ |
| 80 | } |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 81 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 82 | # Install dreport script |
| 83 | # From tools/dreport.d/dreport to /usr/bin/dreport |
| 84 | install_dreport() { |
| 85 | install -d ${D}${bindir} |
| 86 | install -m 0755 ${S}/tools/dreport.d/dreport \ |
| 87 | ${D}${bindir}/dreport |
| 88 | } |
| 89 | |
| 90 | # Install dreport sample configuration file |
| 91 | # From tools/dreport.d/sample.conf |
| 92 | # to /usr/share/dreport.d/conf.d/dreport.conf |
| 93 | install_dreport_conf_file() { |
| 94 | install -d ${D}${dreport_conf_dir} |
| 95 | install -m 0644 ${S}/tools/dreport.d/sample.conf \ |
| 96 | ${D}${dreport_conf_dir}/dreport.conf |
| 97 | } |
| 98 | |
| 99 | # Install dreport plugins |
| 100 | # From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d |
| 101 | install_dreport_plugins_scripts() { |
| 102 | install -d ${D}${dreport_plugin_dir} |
| 103 | install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/ |
| 104 | } |
| 105 | |
| 106 | # Install dreport utility functions |
| 107 | # From tools/dreport.d/include.d to /usr/share/dreport.d/include.d |
| 108 | install_dreport_include_scripts() { |
| 109 | install -d ${D}${dreport_include_dir} |
| 110 | install -m 0755 ${S}/tools/dreport.d/include.d/* \ |
| 111 | ${D}${dreport_include_dir}/ |
| 112 | } |
| 113 | |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 114 | # Make the links for a single user plugin script |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 115 | # Create user directories based on the dump type value in the config section |
| 116 | # Create softlinks for the base scripts in the user directories |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 117 | def install_dreport_user_script(script_path, d): |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 118 | import re |
| 119 | import configparser |
| 120 | |
| 121 | #Read the user types from the dreport.conf file |
| 122 | configure = configparser.ConfigParser() |
| 123 | conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True) |
| 124 | confsource = os.path.join(conf_dir, "dreport.conf") |
| 125 | configure.read(confsource) |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 126 | |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 127 | config = ("config:") |
| 128 | section = "DumpType" |
| 129 | dreport_dir = d.getVar('D', True) + d.getVar('dreport_dir', True) |
| 130 | |
| 131 | script = os.path.basename(script_path) |
| 132 | srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script) |
| 133 | |
| 134 | file = open(script_path, "r") |
| 135 | |
| 136 | for line in file: |
| 137 | if not config in line: |
| 138 | continue |
| 139 | revalue = re.search('[0-9]+.[0-9]+', line) |
| 140 | if not revalue: |
| 141 | bb.warn("Invalid format for config value =%s" % line) |
| 142 | continue |
| 143 | parse_value = revalue.group(0) |
| 144 | config_values = re.split('\W+', parse_value, 1) |
| 145 | if(len(config_values) != 2): |
| 146 | bb.warn("Invalid config value=%s" % parse_value) |
| 147 | break; |
| 148 | priority = config_values[1] |
| 149 | types = [int(d) for d in str(config_values[0])] |
| 150 | for type in types: |
| 151 | if not configure.has_option(section, str(type)): |
| 152 | bb.warn("Invalid dump type id =%s" % (str(type))) |
| 153 | continue |
| 154 | typestr = configure.get(section, str(type)) |
| 155 | destdir = os.path.join(dreport_dir, ("pl_" + typestr + ".d")) |
| 156 | if not os.path.exists(destdir): |
| 157 | os.makedirs(destdir) |
| 158 | linkname = "E" + priority + script |
| 159 | destlink = os.path.join(destdir, linkname) |
| 160 | os.symlink(srclink, destlink) |
| 161 | |
| 162 | #Make the links for all the plugins |
| 163 | python install_dreport_user_scripts() { |
| 164 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 165 | source = d.getVar('S', True) |
| 166 | source_path = os.path.join(source, "tools", "dreport.d", "plugins.d") |
| 167 | scripts = os.listdir(source_path) |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 168 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 169 | for script in scripts: |
| 170 | srcname = os.path.join(source_path, script) |
Matt Spinler | 015f6b1 | 2018-03-29 16:18:02 -0500 | [diff] [blame] | 171 | install_dreport_user_script(srcname, d) |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 172 | } |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 173 | |
Brad Bishop | 811eeec | 2018-03-09 00:04:00 -0500 | [diff] [blame] | 174 | #Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs. |
| 175 | PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround" |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 176 | PACKAGECONFIG[ubifs-workaround] = " \ |
| 177 | --enable-ubifs-workaround, \ |
| 178 | --disable-ubifs-workaround \ |
| 179 | " |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 180 | |
| 181 | do_install[postfuncs] += "install_dreport" |
| 182 | do_install[postfuncs] += "install_dreport_conf_file" |
| 183 | do_install[postfuncs] += "install_dreport_plugins_scripts" |
| 184 | do_install[postfuncs] += "install_dreport_include_scripts" |
| 185 | do_install[postfuncs] += "install_dreport_user_scripts" |