diff options
Diffstat (limited to 'meta-oe/recipes-kernel/turbostat/turbostat.bb')
| -rw-r--r-- | meta-oe/recipes-kernel/turbostat/turbostat.bb | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/turbostat/turbostat.bb b/meta-oe/recipes-kernel/turbostat/turbostat.bb new file mode 100644 index 0000000000..8ac15164d4 --- /dev/null +++ b/meta-oe/recipes-kernel/turbostat/turbostat.bb | |||
| @@ -0,0 +1,100 @@ | |||
| 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 | |||
| 10 | DESCRIPTION = "The turbostat tool allows you to determine the actual \ | ||
| 11 | processor frequency and idle power saving state residency on supported \ | ||
| 12 | processors." | ||
| 13 | |||
| 14 | LICENSE = "GPL-2.0-only" | ||
| 15 | LIC_FILES_CHKSUM = "file://${UNPACKDIR}/COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" | ||
| 16 | COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux' | ||
| 17 | COMPATIBLE_HOST:libc-musl = "null" | ||
| 18 | |||
| 19 | KERNEL_VERSION = "${@get_kernelversion_file("${STAGING_KERNEL_BUILDDIR}")}" | ||
| 20 | inherit linux-kernel-base | ||
| 21 | |||
| 22 | SRC_URI += "\ | ||
| 23 | file://COPYING \ | ||
| 24 | " | ||
| 25 | |||
| 26 | S = "${WORKDIR}/sources" | ||
| 27 | UNPACKDIR = "${S}" | ||
| 28 | |||
| 29 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 30 | DEPENDS = "libcap" | ||
| 31 | |||
| 32 | # This looks in S, so we better make sure there's | ||
| 33 | # something in the directory. | ||
| 34 | # | ||
| 35 | do_populate_lic[depends] = "${PN}:do_configure" | ||
| 36 | |||
| 37 | |||
| 38 | EXTRA_OEMAKE = '\ | ||
| 39 | CC="${CC}" 'CFLAGS=-Wall ${LDFLAGS}' \ | ||
| 40 | ' | ||
| 41 | |||
| 42 | # If we build under STAGING_KERNEL_DIR, source will not be put | ||
| 43 | # into the dbg rpm. STAGING_KERNEL_DIR will exist by the time | ||
| 44 | # do_configure() is invoked so we can safely copy from it. | ||
| 45 | # | ||
| 46 | do_configure[depends] += "virtual/kernel:do_shared_workdir" | ||
| 47 | do_configure:prepend() { | ||
| 48 | mkdir -p ${S} | ||
| 49 | cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/msr-index.h ${S} | ||
| 50 | cp -r ${STAGING_KERNEL_DIR}/arch/x86/include/asm/intel-family.h ${S} | ||
| 51 | if [ -f "${STAGING_KERNEL_DIR}/include/vdso/bits.h" ]; then | ||
| 52 | cp -r ${STAGING_KERNEL_DIR}/include/vdso/bits.h ${S} | ||
| 53 | cp -r ${STAGING_KERNEL_DIR}/include/vdso/const.h ${S} | ||
| 54 | else | ||
| 55 | cp -r ${STAGING_KERNEL_DIR}/include/linux/bits.h ${S} | ||
| 56 | cp -r ${STAGING_KERNEL_DIR}/include/linux/const.h ${S} | ||
| 57 | fi | ||
| 58 | if [ -f "${STAGING_KERNEL_DIR}/tools/include/linux/build_bug.h" ]; then | ||
| 59 | cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/build_bug.h ${S} | ||
| 60 | fi | ||
| 61 | cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler.h ${S} | ||
| 62 | cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler_types.h ${S} | ||
| 63 | cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler-gcc.h ${S} | ||
| 64 | cp -r ${STAGING_KERNEL_DIR}/tools/power/x86/turbostat/* ${S} | ||
| 65 | } | ||
| 66 | |||
| 67 | |||
| 68 | do_compile() { | ||
| 69 | sed -i 's#<linux/bits.h>#"bits.h"#' msr-index.h | ||
| 70 | sed -i 's#<linux/compiler.h>#"compiler.h"#' build_bug.h | ||
| 71 | sed -i 's#<linux/compiler_types.h>#"compiler_types.h"#' compiler.h | ||
| 72 | sed -i 's#<linux/compiler-gcc.h>#"compiler-gcc.h"#' compiler_types.h | ||
| 73 | 'TMPCHECK='grep "<vdso/const.h>" bits.h'' || true | ||
| 74 | if [ -n $TMPCHECK ]; then | ||
| 75 | sed -i 's#<vdso/const.h>#"const.h"#' bits.h | ||
| 76 | sed -i 's#<uapi/linux/const.h>#<linux/const.h>#' const.h | ||
| 77 | else | ||
| 78 | sed -i 's#<linux/const.h>#"const.h"#' bits.h | ||
| 79 | sed -i -e 's#<uapi/linux/const.h>#<linux/const.h>#' -e 's#_LINUX_CONST_H#_LINUX_CONST_H_KERNEL#' const.h | ||
| 80 | fi | ||
| 81 | echo '#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))' >> msr-index.h | ||
| 82 | echo "#define BIT(x) (1 << (x))" > bits.h | ||
| 83 | echo "#define BIT_ULL(nr) (1ULL << (nr))" >> bits.h | ||
| 84 | echo "#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))" >> bits.h | ||
| 85 | echo "#define GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))" >> bits.h | ||
| 86 | |||
| 87 | sed -i 's#MSRHEADER#"msr-index.h"#' turbostat.c | ||
| 88 | sed -i 's#INTEL_FAMILY_HEADER#"intel-family.h"#' turbostat.c | ||
| 89 | sed -i 's#BUILD_BUG_HEADER#"build_bug.h"#' turbostat.c | ||
| 90 | sed -i 's#\$(CC) \$(CFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#\$(CC) \$(CFLAGS) \$(LDFLAGS) \$< -o \$(BUILD_OUTPUT)/\$@#' Makefile | ||
| 91 | oe_runmake STAGING_KERNEL_DIR=${STAGING_KERNEL_DIR} | ||
| 92 | } | ||
| 93 | |||
| 94 | do_install() { | ||
| 95 | oe_runmake DESTDIR="${D}" install | ||
| 96 | } | ||
| 97 | |||
| 98 | python do_package:prepend() { | ||
| 99 | d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) | ||
| 100 | } | ||
