Skip to content

Commit 90adfce

Browse files
committed
linux-utils: combine cpupower and turbostat into a split pkg
Merge separate Makefiles into a single split package following the pattern used by Arch Linux and other distributions. This reduces code duplication, simplifies maintenance, and makes it easier to add more kernel tools in the future. Both packages remain independently installable with no functional changes. Closes PR#28272 Signed-off-by: John Audia <therealgraysky@proton.me>
1 parent ab7fbfd commit 90adfce

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed
Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include $(TOPDIR)/rules.mk
22
include $(INCLUDE_DIR)/kernel.mk
33

4-
PKG_NAME:=cpupower
4+
PKG_NAME:=linux-utils
55
PKG_VERSION:=$(LINUX_VERSION)
66
PKG_RELEASE:=1
77

@@ -10,31 +10,55 @@ PKG_LICENSE:=GPL-2.0-only
1010

1111
include $(INCLUDE_DIR)/package.mk
1212

13-
define Package/cpupower
13+
define Package/linux-utils/Default
1414
SECTION:=utils
1515
CATEGORY:=Utilities
16-
TITLE:=Shows and sets processor power related values
1716
URL:=https://www.kernel.org
17+
endef
18+
19+
define Package/cpupower
20+
$(call Package/linux-utils/Default)
21+
TITLE:=Shows and sets processor power related values
1822
DEPENDS:=+libpci
1923
endef
2024

2125
define Package/cpupower/description
2226
Linux kernel tool to examine and to tune power saving related features of the processor
2327
endef
2428

29+
define Package/turbostat
30+
$(call Package/linux-utils/Default)
31+
TITLE:=Report processor frequency and idle statistics
32+
DEPENDS:=@(TARGET_x86_64||TARGET_x86) +libpci +libcap
33+
endef
34+
35+
define Package/turbostat/description
36+
Turbostat reports processor topology, frequency, idle power-state statistics,
37+
temperature and power on X86 processors.
38+
endef
39+
2540
MAKE_FLAGS = \
2641
ARCH="$(LINUX_KARCH)" \
2742
CROSS_COMPILE="$(TARGET_CROSS)" \
2843
CC="$(TARGET_CC)" \
2944
CFLAGS="$(TARGET_CFLAGS/ -fhonour-copts/) $(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include" \
30-
LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
31-
CPUFREQ_BENCH=false \
32-
NLS=false
45+
LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib"
3346

3447
define Build/Compile
48+
# Build cpupower
3549
sed -i '/^CROSS/d' $(LINUX_DIR)/tools/power/cpupower/Makefile
3650
-$(MAKE) clean -C $(LINUX_DIR)/tools/power/cpupower
37-
+$(MAKE) -C $(LINUX_DIR)/tools/power/cpupower $(MAKE_FLAGS)
51+
+$(MAKE) -C $(LINUX_DIR)/tools/power/cpupower \
52+
$(MAKE_FLAGS) \
53+
CPUFREQ_BENCH=false \
54+
NLS=false
55+
56+
ifdef CONFIG_PACKAGE_turbostat
57+
#Build turbostat
58+
sed -i '/^CROSS/d' $(LINUX_DIR)/tools/power/x86/turbostat/Makefile
59+
-$(MAKE) clean -C $(LINUX_DIR)/tools/power/x86/turbostat
60+
+$(MAKE) -C $(LINUX_DIR)/tools/power/x86/turbostat $(MAKE_FLAGS)
61+
endif
3862
endef
3963

4064
define Package/cpupower/install
@@ -44,4 +68,10 @@ define Package/cpupower/install
4468
$(CP) $(LINUX_DIR)/tools/power/cpupower/libcpu* $(1)/usr/lib
4569
endef
4670

71+
define Package/turbostat/install
72+
$(INSTALL_DIR) $(1)/usr/bin
73+
$(INSTALL_BIN) $(LINUX_DIR)/tools/power/x86/turbostat/turbostat $(1)/usr/bin/
74+
endef
75+
4776
$(eval $(call BuildPackage,cpupower))
77+
$(eval $(call BuildPackage,turbostat))

0 commit comments

Comments
 (0)