Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | # Copyright (c) 2013 LG Electronics, Inc. |
| 2 | # Copyright (C) 2014 Intel Corp. |
| 3 | |
| 4 | # This recipe creates packages for the bootchart2 system-wide profiler daemon |
| 5 | # and related utilities. Depending on the images you're building, additional |
| 6 | # configuration may be needed in order to use it. |
| 7 | # |
| 8 | # Packages: |
| 9 | # * bootchart2 - The daemon itself. |
| 10 | # * pybootchartgui - Python program to visualize and display the data |
| 11 | # collected by bootchart2 or compatible daemons such as the original |
| 12 | # bootchart. |
| 13 | # * bootchartd-stop-initscript - A SysV init script to stop data collection |
| 14 | # when booting completes (see below for details.) |
| 15 | # |
| 16 | # While bootchart2 is designed to stop collecting data roughly when the boot |
| 17 | # process completes, it is not exactly a stopwatch. It has a list of programs |
| 18 | # which are supposed signify that the boot process has completed (for example, |
| 19 | # openbox or gnome-shell,) but it waits a full 20 seconds after such a program |
| 20 | # is launched before stopping itself, to collect additional data. |
| 21 | # |
| 22 | # If you are using a window manager or GUI which isn't included in bootchart2's |
| 23 | # default configuration file, you should write bbappend file to amend |
| 24 | # bootchartd.conf and add it to EXIT_PROC. An example of this is shown in this |
| 25 | # recipe, where the Matchbox window manager (used by Sato) is added. |
| 26 | # |
| 27 | # If you want data collection to end at a certain point exactly, you should |
| 28 | # arrange for the following command to be run: |
| 29 | # bootchartd stop |
| 30 | # You might set this command to be launched by the desktop environment shipped |
| 31 | # on the image you're building after the other startup programs are complete. |
| 32 | # This will not incur the 20 second wait period and will cause bootchart2 to |
| 33 | # behave a bit more like a stopwatch. An example of this is shown in this |
| 34 | # recipe, specifically the bootchartd-stop-initscript package, which stops data |
| 35 | # collection as the last action when switching to runlevels 2 through 5. You can |
| 36 | # add bootchartd-stop-initscript to IMAGE_INSTALL if you need to use it. |
| 37 | # |
| 38 | # Unless you're doing something special, if your image does not launch an X |
| 39 | # window manager, you will need to add bootchartd-stop-initscript to your image. |
| 40 | # |
| 41 | # Bootchart2 can be started in two ways. Data collection can be initiated by |
| 42 | # running the following command: |
| 43 | # bootchartd start |
| 44 | # However, for the most complete data, the bootchart2 developers recommend |
| 45 | # running it as PID 1. This can be done by adding the following to the kernel |
| 46 | # command line parameters in the bootloader setup: |
| 47 | # init=/sbin/bootchartd |
| 48 | # When invoked this way, bootchart2 will set itself up and then automatically |
| 49 | # run /sbin/init. For example, when booting the default qemux86 image, one might |
| 50 | # use a command like this: |
| 51 | # runqemu qemux86 bootparams="initcall_debug printk.time=y quiet \ |
| 52 | # init=/sbin/bootchartd" |
| 53 | # |
| 54 | # Neither method is actually implemented here, choose what works for you. |
| 55 | # |
| 56 | # If you are building your image with systemd instead of SysV init, bootchart2 |
| 57 | # includes systemd service files to begin collection automatically at boot and |
| 58 | # end collection automatically 20 seconds after the boot process has completed. |
| 59 | # However, be aware that systemd tends to start bootchart2 relatively late into |
| 60 | # the boot process, so it's highly recommended to use bootchart2 as PID 1. If |
| 61 | # you're using systemd and you wish to use another method to stop data |
| 62 | # collection at a time of your choosing, you may do so as long as you get to it |
| 63 | # before the 20 second timeout of the systemd service files. Also, you may write |
| 64 | # a bbappend to patch bootchart2-done.timer.in to increase or decrease the |
| 65 | # timeout. Decreasing it to 0 will make it behave like |
| 66 | # bootchartd-stop-initscript. |
| 67 | # |
| 68 | # By default, when data collection is stopped, a file named bootchart.tgz will |
| 69 | # be created in /var/log. If pybootchartgui is included in your image, |
| 70 | # bootchart.png will also be created at the same time. However, this results in |
| 71 | # a noticeable hitch or pause at boot time, which may not be what you want on an |
| 72 | # embedded device. So you may prefer to omit pybootchartgui from your image. In |
| 73 | # that case, copy bootchart.tgz over to your development system and generate |
| 74 | # bootchart.png there. To get pybootchartgui on your development system, you can |
| 75 | # either install it directly from some other source, or build bootchart2-native |
| 76 | # and find pybootchartgui in the native sysroot: |
| 77 | # bitbake bootchart2-native |
| 78 | # ./tmp/sysroots/x86_64-linux/usr/bin/pybootchartgui /path/to/bootchart.tgz |
| 79 | # Note that, whether installed on your build system or on your image, the |
| 80 | # pybootchartgui provided by this recipe does not support the -i option. You |
| 81 | # will need to install pybootchartgui by other means in order to run it in |
| 82 | # interactive mode. |
| 83 | |
| 84 | SUMMARY = "Booting sequence and CPU,I/O usage monitor" |
| 85 | DESCRIPTION = "Monitors where the system spends its time at start, creating a graph of all processes, disk utilization, and wait time." |
| 86 | AUTHOR = "Wonhong Kwon <wonhong.kwon@lge.com>" |
| 87 | HOMEPAGE = "https://github.com/mmeeks/bootchart" |
| 88 | LICENSE = "GPL-3.0" |
| 89 | LIC_FILES_CHKSUM = "file://COPYING;md5=44ac4678311254db62edf8fd39cb8124" |
| 90 | |
| 91 | UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)" |
| 92 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 93 | SRC_URI = "git://github.com/xrmx/bootchart.git;branch=master;protocol=https \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 94 | file://bootchartd_stop.sh \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 95 | file://0001-collector-Allocate-space-on-heap-for-chunks.patch \ |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 96 | file://0001-bootchart2-support-usrmerge.patch \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 97 | file://0001-bootchartd.in-make-sure-only-one-bootchartd-process.patch \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 98 | " |
| 99 | |
| 100 | S = "${WORKDIR}/git" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 101 | SRCREV = "868a2afab9da34f32c007d773b77253c93104636" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 102 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 103 | # remove at next version upgrade or when output changes |
| 104 | PR = "r1" |
| 105 | HASHEQUIV_HASH_VERSION .= ".1" |
| 106 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 107 | inherit systemd update-rc.d python3native update-alternatives |
| 108 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 109 | ALTERNATIVE:${PN} = "bootchartd" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 110 | ALTERNATIVE_LINK_NAME[bootchartd] = "${base_sbindir}/bootchartd" |
| 111 | ALTERNATIVE_PRIORITY = "100" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 112 | |
| 113 | # The only reason to build bootchart2-native is for a native pybootchartgui. |
| 114 | BBCLASSEXTEND = "native" |
| 115 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 116 | SYSTEMD_SERVICE:${PN} = "bootchart2.service bootchart2-done.service bootchart2-done.timer" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 117 | |
| 118 | UPDATERCPN = "bootchartd-stop-initscript" |
| 119 | INITSCRIPT_NAME = "bootchartd_stop.sh" |
| 120 | INITSCRIPT_PARAMS = "start 99 2 3 4 5 ." |
| 121 | |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 122 | EXTRA_OEMAKE = 'BASE_SBINDIR="${base_sbindir}"' |
| 123 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 124 | do_compile:prepend () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 125 | export PY_LIBDIR="${libdir}/${PYTHON_DIR}" |
| 126 | export BINDIR="${bindir}" |
| 127 | export LIBDIR="${base_libdir}" |
| 128 | } |
| 129 | |
| 130 | do_install () { |
| 131 | install -d ${D}${sysconfdir} # needed for -native |
| 132 | export PY_LIBDIR="${libdir}/${PYTHON_DIR}" |
| 133 | export BINDIR="${bindir}" |
| 134 | export DESTDIR="${D}" |
| 135 | export LIBDIR="${base_libdir}" |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 136 | export PKGLIBDIR="${base_libdir}/bootchart" |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 137 | export SYSTEMD_UNIT_DIR="${systemd_system_unitdir}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 138 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 139 | oe_runmake install NO_PYTHON_COMPILE=1 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 140 | install -d ${D}${sysconfdir}/init.d |
| 141 | install -m 0755 ${WORKDIR}/bootchartd_stop.sh ${D}${sysconfdir}/init.d |
| 142 | |
| 143 | echo 'EXIT_PROC="$EXIT_PROC matchbox-window-manager"' >> ${D}${sysconfdir}/bootchartd.conf |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 144 | |
| 145 | # Use python 3 instead of python 2 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 146 | sed -i -e '1s,#!.*python.*,#!${USRBINPATH}/env python3,' ${D}${bindir}/pybootchartgui |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 147 | |
| 148 | # The timestamps embedded in compressed man pages is not reproducible |
| 149 | gzip -d ${D}${mandir}/man1/*.gz |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | PACKAGES =+ "pybootchartgui" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 153 | FILES:pybootchartgui += "${PYTHON_SITEPACKAGES_DIR}/pybootchartgui ${bindir}/pybootchartgui" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 154 | RDEPENDS:pybootchartgui = "python3-pycairo python3-compression python3-image python3-math python3-shell python3-compression python3-codecs" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 155 | RDEPENDS:${PN}:class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}" |
| 156 | RDEPENDS:${PN}:class-target += "lsb-release" |
| 157 | DEPENDS:append:class-native = " python3-pycairo-native" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 158 | |
| 159 | PACKAGES =+ "bootchartd-stop-initscript" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 160 | FILES:bootchartd-stop-initscript += "${sysconfdir}/init.d ${sysconfdir}/rc*.d" |
| 161 | RDEPENDS:bootchartd-stop-initscript = "${PN}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 162 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 163 | FILES:${PN} += "${base_libdir}/bootchart/bootchart-collector" |
| 164 | FILES:${PN} += "${base_libdir}/bootchart/tmpfs" |
| 165 | FILES:${PN} += "${libdir}" |
| 166 | FILES:${PN}-doc += "${datadir}/docs" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 167 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 168 | RCONFLICTS:${PN} = "bootchart" |