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 | " |
| 15 | PACKAGES =+ "${DEBUG_COLLECTOR_PKGS}" |
| 16 | PACKAGES_remove = "${PN}" |
| 17 | RDEPENDS_${PN}-dev = "${DEBUG_COLLECTOR_PKGS}" |
| 18 | RDEPENDS_${PN}-staticdev = "${DEBUG_COLLECTOR_PKGS}" |
| 19 | |
| 20 | DBUS_PACKAGES = "${PN}-manager" |
| 21 | |
| 22 | SYSTEMD_PACKAGES = "${PN}-monitor" |
| 23 | |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 24 | inherit autotools \ |
| 25 | pkgconfig \ |
Jayanth Othayoth | aae91e3 | 2017-06-05 03:10:00 -0500 | [diff] [blame] | 26 | obmc-phosphor-dbus-service \ |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 27 | pythonnative \ |
| 28 | phosphor-debug-collector |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 29 | |
| 30 | require phosphor-debug-collector.inc |
| 31 | |
| 32 | DEPENDS += " \ |
| 33 | phosphor-dbus-interfaces \ |
| 34 | phosphor-dbus-interfaces-native \ |
| 35 | phosphor-logging \ |
| 36 | sdbusplus \ |
| 37 | sdbusplus-native \ |
| 38 | autoconf-archive-native \ |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 39 | " |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 40 | |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 41 | RDEPENDS_${PN}-manager += " \ |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 42 | sdbusplus \ |
| 43 | phosphor-dbus-interfaces \ |
| 44 | phosphor-logging \ |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 45 | ${PN}-dreport \ |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 46 | " |
| 47 | RDEPENDS_${PN}-monitor += " \ |
| 48 | sdbusplus \ |
| 49 | phosphor-dbus-interfaces \ |
| 50 | phosphor-logging \ |
| 51 | " |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 52 | RDEPENDS_${PN}-dreport += " \ |
| 53 | systemd \ |
| 54 | ${VIRTUAL-RUNTIME_base-utils} \ |
| 55 | bash \ |
Jayanth Othayoth | 947c07b | 2017-07-25 09:29:37 -0500 | [diff] [blame] | 56 | xz \ |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 57 | " |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 58 | RDEPENDS_${PN}-scripts += " \ |
| 59 | bash \ |
| 60 | " |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 61 | |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 62 | MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service" |
| 63 | |
| 64 | SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}" |
| 65 | |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 66 | FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager" |
| 67 | FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor" |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 68 | FILES_${PN}-dreport += "${bindir}/dreport" |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 69 | FILES_${PN}-scripts += "${dreport_dir}" |
Jayanth Othayoth | 9d21d6c | 2017-05-31 06:25:55 -0500 | [diff] [blame] | 70 | |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 71 | DBUS_SERVICE_${PN}-manager += "${MGR_SVC}" |
Jayanth Othayoth | ce4dfa0 | 2017-09-15 10:55:35 -0500 | [diff] [blame] | 72 | SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service" |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 73 | |
Jayanth Othayoth | f1b8517 | 2017-07-05 10:54:35 -0500 | [diff] [blame] | 74 | EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}" |
Jayanth Othayoth | 5f6d885 | 2017-07-05 10:31:16 -0500 | [diff] [blame] | 75 | |
Jayanth Othayoth | 9963d17 | 2017-05-08 09:25:05 -0500 | [diff] [blame] | 76 | S = "${WORKDIR}/git" |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 77 | |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 78 | # Install dreport script |
| 79 | # From tools/dreport.d/dreport to /usr/bin/dreport |
| 80 | install_dreport() { |
| 81 | install -d ${D}${bindir} |
| 82 | install -m 0755 ${S}/tools/dreport.d/dreport \ |
| 83 | ${D}${bindir}/dreport |
| 84 | } |
| 85 | |
| 86 | # Install dreport sample configuration file |
| 87 | # From tools/dreport.d/sample.conf |
| 88 | # to /usr/share/dreport.d/conf.d/dreport.conf |
| 89 | install_dreport_conf_file() { |
| 90 | install -d ${D}${dreport_conf_dir} |
| 91 | install -m 0644 ${S}/tools/dreport.d/sample.conf \ |
| 92 | ${D}${dreport_conf_dir}/dreport.conf |
| 93 | } |
| 94 | |
| 95 | # Install dreport plugins |
| 96 | # From tools/dreport.d/plugins.d to /usr/share/dreport.d/plugins.d |
| 97 | install_dreport_plugins_scripts() { |
| 98 | install -d ${D}${dreport_plugin_dir} |
| 99 | install -m 0755 ${S}/tools/dreport.d/plugins.d/* ${D}${dreport_plugin_dir}/ |
| 100 | } |
| 101 | |
| 102 | # Install dreport utility functions |
| 103 | # From tools/dreport.d/include.d to /usr/share/dreport.d/include.d |
| 104 | install_dreport_include_scripts() { |
| 105 | install -d ${D}${dreport_include_dir} |
| 106 | install -m 0755 ${S}/tools/dreport.d/include.d/* \ |
| 107 | ${D}${dreport_include_dir}/ |
| 108 | } |
| 109 | |
| 110 | # Parse the scripts in base directory, read config value |
| 111 | # Create user directories based on the dump type value in the config section |
| 112 | # Create softlinks for the base scripts in the user directories |
| 113 | python install_dreport_user_scripts() { |
| 114 | from shutil import copyfile |
| 115 | import stat |
| 116 | import re |
| 117 | import configparser |
| 118 | |
| 119 | #Read the user types from the dreport.conf file |
| 120 | configure = configparser.ConfigParser() |
| 121 | conf_dir = d.getVar('D', True) + d.getVar('dreport_conf_dir', True) |
| 122 | confsource = os.path.join(conf_dir, "dreport.conf") |
| 123 | configure.read(confsource) |
| 124 | section = "DumpType" |
| 125 | options = configure.options(section) |
| 126 | |
| 127 | #open the script from base dir and read the config value |
| 128 | source = d.getVar('S', True) |
| 129 | source_path = os.path.join(source, "tools", "dreport.d", "plugins.d") |
| 130 | scripts = os.listdir(source_path) |
| 131 | dreport_dir= d.getVar('D', True) + d.getVar('dreport_dir', True) |
| 132 | config = ("config:") |
| 133 | for script in scripts: |
| 134 | srcname = os.path.join(source_path, script) |
| 135 | srclink = os.path.join(d.getVar('dreport_plugin_dir', True), script) |
| 136 | file = open(srcname, "r") |
| 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) |
Jayanth Othayoth | d259249 | 2017-07-29 22:28:44 -0500 | [diff] [blame] | 162 | } |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 163 | |
Brad Bishop | 811eeec | 2018-03-09 00:04:00 -0500 | [diff] [blame] | 164 | #Enable ubifs-workaround by DISTRO_FEATURE obmc-ubi-fs. |
| 165 | PACKAGECONFIG_append_df-obmc-ubi-fs = " ubifs-workaround" |
Jayanth Othayoth | b6a69b5 | 2017-10-12 01:47:31 -0500 | [diff] [blame] | 166 | PACKAGECONFIG[ubifs-workaround] = " \ |
| 167 | --enable-ubifs-workaround, \ |
| 168 | --disable-ubifs-workaround \ |
| 169 | " |
Marri Devender Rao | 3360392 | 2017-10-11 02:22:46 -0500 | [diff] [blame] | 170 | |
| 171 | do_install[postfuncs] += "install_dreport" |
| 172 | do_install[postfuncs] += "install_dreport_conf_file" |
| 173 | do_install[postfuncs] += "install_dreport_plugins_scripts" |
| 174 | do_install[postfuncs] += "install_dreport_include_scripts" |
| 175 | do_install[postfuncs] += "install_dreport_user_scripts" |