bootchart2_0.14.9.bb 8.0 KB

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