turbostat_3.4.bb 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #
  2. # Copyright (C) 2013 Wind River Systems, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License version 2 as
  6. # published by the Free Software Foundation.
  7. #
  8. SUMMARY = "Frequency and Idle power monitoring tools for Linux"
  9. DESCRIPTION = "The turbostat tool allows you to determine the actual \
  10. processor frequency and idle power saving state residency on supported \
  11. processors."
  12. LICENSE = "GPLv2"
  13. LIC_FILES_CHKSUM = "file://../COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
  14. COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'
  15. COMPATIBLE_HOST_libc-musl = "null"
  16. SRC_URI += "\
  17. file://COPYING \
  18. "
  19. PACKAGE_ARCH = "${MACHINE_ARCH}"
  20. DEPENDS = "libcap"
  21. # This looks in S, so we better make sure there's
  22. # something in the directory.
  23. #
  24. do_populate_lic[depends] = "${PN}:do_configure"
  25. EXTRA_OEMAKE = '\
  26. CC="${CC}" 'CFLAGS=-Wall ${LDFLAGS}' \
  27. '
  28. # If we build under STAGING_KERNEL_DIR, source will not be put
  29. # into the dbg rpm. STAGING_KERNEL_DIR will exist by the time
  30. # do_configure() is invoked so we can safely copy from it.
  31. #
  32. do_configure[depends] += "virtual/kernel:do_shared_workdir"
  33. do_configure_prepend() {
  34. mkdir -p ${S}
  35. cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/msr-index.h ${S}
  36. cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/intel-family.h ${S}
  37. if [ -f "${STAGING_KERNEL_DIR}/include/vdso/bits.h" ]; then
  38. cp -r ${STAGING_KERNEL_DIR}/include/vdso/bits.h ${S}
  39. cp -r ${STAGING_KERNEL_DIR}/include/vdso/const.h ${S}
  40. else
  41. cp -r ${STAGING_KERNEL_DIR}/include/linux/bits.h ${S}
  42. cp -r ${STAGING_KERNEL_DIR}/include/linux/const.h ${S}
  43. fi
  44. cp -r ${STAGING_KERNEL_DIR}/tools/power/x86/turbostat/* ${S}
  45. cp -r ${WORKDIR}/COPYING ${S}
  46. }
  47. do_compile() {
  48. sed -i 's#<linux/bits.h>#"bits.h"#' msr-index.h
  49. 'TMPCHECK='grep "<vdso/const.h>" bits.h'' || true
  50. if [ -n $TMPCHECK ]; then
  51. sed -i 's#<vdso/const.h>#"const.h"#' bits.h
  52. sed -i 's#<uapi/linux/const.h>#<linux/const.h>#' const.h
  53. else
  54. sed -i 's#<linux/const.h>#"const.h"#' bits.h
  55. sed -i -e 's#<uapi/linux/const.h>#<linux/const.h>#' -e 's#_LINUX_CONST_H#_LINUX_CONST_H_KERNEL#' const.h
  56. fi
  57. sed -i 's#MSRHEADER#"msr-index.h"#' turbostat.c
  58. sed -i 's#INTEL_FAMILY_HEADER#"intel-family.h"#' turbostat.c
  59. sed -i 's#\$(CC) \$(CFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#\$(CC) \$(CFLAGS) \$(LDFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#' Makefile
  60. oe_runmake STAGING_KERNEL_DIR=${STAGING_KERNEL_DIR}
  61. }
  62. do_install() {
  63. oe_runmake DESTDIR="${D}" install
  64. }