Skip to contentSkip to conversation

package/cpupower: new package

PATCH New James Knight 3 participants 5 messages May 21, 2015 – Jul 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/cpupower: new package

---
 package/Config.in            |  1 +
 package/cpupower/Config.in   | 10 ++++++++++
 package/cpupower/cpupower.mk | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 package/cpupower/Config.in
 create mode 100644 package/cpupower/cpupower.mk
package/Config.in +1 -0
index e0c2e2a..0bd6eb6 100644
@@ -1378,6 +1378,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/coreutils/Config.in"
 endif
 	source "package/cpuload/Config.in"
+	source "package/cpupower/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
package/cpupower/Config.in new file +10 -0
new file mode 100644
index 0000000..745dd2b
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_CPUPOWER
+	bool "cpupower"
+	depends on BR2_LINUX_KERNEL
+	select BR2_PACKAGE_PCIUTILS
+	help
+	  cpupower is a collection of tools to examine and tune power 
+	  saving related features of your processor.
+
+comment "cpupower needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
package/cpupower/cpupower.mk new file +37 -0
new file mode 100644
index 0000000..cb1f938
@@ -0,0 +1,37 @@
+################################################################################
+#
+# cpupower
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+CPUPOWER_SOURCE =
+CPUPOWER_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+CPUPOWER_DEPENDENCIES = linux pciutils
+
+define CPUPOWER_BUILD_CMDS
+	$(Q)if test ! -f $(LINUX_DIR)/tools/power/cpupower/Makefile ; then \
+		echo "Your kernel version is too old and does not have the cpupower tool." ; \
+		echo "At least kernel 3.4 must be used." ; \
+		exit 1 ; \
+	fi
+	
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		CROSS=$(TARGET_CROSS) \
+		CPUFREQ_BENCH=false \
+		DEBUG=false \
+		cpupower
+endef
+
+define CPUPOWER_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(LINUX_DIR)/tools/power/cpupower/cpupower \
+		$(TARGET_DIR)/usr/bin/cpupower
+
+	$(INSTALL) -D -m 0755 $(LINUX_DIR)/tools/power/cpupower/libcpupower.so.0.0.0 \
+		$(TARGET_DIR)/lib/libcpupower.so.0.0.0
+	ln -snf libcpupower.so.0.0.0 $(TARGET_DIR)/lib/libcpupower.so
+	ln -snf libcpupower.so.0.0.0 $(TARGET_DIR)/lib/libcpupower.so.0
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.9.5.msysgit.1
#1 lore raw

PATCH 1/1 package/cpupower: new package

James,

Quoted 27 lines · James Knight
---
 package/Config.in            |  1 +
 package/cpupower/Config.in   | 10 ++++++++++
 package/cpupower/cpupower.mk | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 package/cpupower/Config.in
 create mode 100644 package/cpupower/cpupower.mk
package/Config.in +1 -0
index e0c2e2a..0bd6eb6 100644
@@ -1378,6 +1378,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
        source "package/coreutils/Config.in"
 endif
        source "package/cpuload/Config.in"
+       source "package/cpupower/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
        source "package/dcron/Config.in"
        source "package/debianutils/Config.in"
package/cpupower/Config.in new file +0 -0
new file mode 100644
index 0000000..745dd2b

package/cpupower/Config.in line 6

Quoted 6 lines
package/cpupower/Config.in new file +6 -0
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_CPUPOWER
+       bool "cpupower"
+       depends on BR2_LINUX_KERNEL
+       select BR2_PACKAGE_PCIUTILS
+       help
+         cpupower is a collection of tools to examine and tune power

Extra space at end of the above line.

Quoted 11 lines
package/cpupower/Config.in new file +4 -0
+         saving related features of your processor.
+
+comment "cpupower needs a Linux kernel to be built"
+       depends on !BR2_LINUX_KERNEL
package/cpupower/cpupower.mk new file +1 -0
new file mode 100644
index 0000000..cb1f938
@@ -0,0 +1,37 @@
+################################################################################

package/cpupower/cpupower.mk line 11

Quoted 10 lines
package/cpupower/cpupower.mk new file +10 -0
+#
+# cpupower
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+CPUPOWER_SOURCE =
+CPUPOWER_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+CPUPOWER_DEPENDENCIES = linux pciutils

Add license file and type... In this case, probably just a duplication of the kernel, but needed for license manifest generation. The file has to be in your source folder, so maybe the _SOURCE needs to be set to the LINUX_DIR.... Would have to think about this one. Maybe look at the spidev-test which is also build from Linux kernel source.
http://git.buildroot.net/buildroot/tree/package/spidev_test/spidev_test.mk

To test the license gathering, remove your build/cpupower folder and then make legal-info.

LIBFOO has a good example here for how those variables are set (also look at any other package).
http://buildroot.uclibc.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

FYI, here's some background
http://buildroot.uclibc.org/downloads/manual/manual.html#legal-info

<snip>

The spidev_test might also shed light on another approach to adding cpupower.

Thanks, James for the submission!

Signature · 8 lines
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.
#2 lore raw

PATCH 1/1 package/cpupower: new package

Thanks Matthew.

I was attempting to follow the perf package style for this new package:

http://git.buildroot.net/buildroot/tree/package/perf/perf.mk

My main reason for following this was to prevent having the process from re-downloading the kernel/etc. again. I don't mind adding license information as well but I don't know the correct way in doing this since this package is based off the selected kernel option (although I can just copy the license value set by LINUX_LICENSE). Is the perf package out-of-date? I don't mind following the spidev_test package; I just want to make sure I'm doing it right.

Quoted 97 lines · Matthew Weber

James,

Quoted 1 line · On Thu, May 21, 2015 at 6:03 PM, James Knight…

<javascript:;>>

Quoted 26 lines
---
 package/Config.in            |  1 +
 package/cpupower/Config.in   | 10 ++++++++++
 package/cpupower/cpupower.mk | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 package/cpupower/Config.in
 create mode 100644 package/cpupower/cpupower.mk
package/Config.in +1 -0
index e0c2e2a..0bd6eb6 100644
@@ -1378,6 +1378,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
        source "package/coreutils/Config.in"
 endif
        source "package/cpuload/Config.in"
+       source "package/cpupower/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
        source "package/dcron/Config.in"
        source "package/debianutils/Config.in"
package/cpupower/Config.in new file +0 -0
new file mode 100644
index 0000000..745dd2b

package/cpupower/Config.in line 6

Quoted 6 lines
package/cpupower/Config.in new file +6 -0
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_CPUPOWER
+       bool "cpupower"
+       depends on BR2_LINUX_KERNEL
+       select BR2_PACKAGE_PCIUTILS
+       help
+         cpupower is a collection of tools to examine and tune power

Extra space at end of the above line.

package/cpupower/cpupower.mk

Quoted 11 lines
package/cpupower/Config.in new file +4 -0
+         saving related features of your processor.
+
+comment "cpupower needs a Linux kernel to be built"
+       depends on !BR2_LINUX_KERNEL
package/cpupower/cpupower.mk new file +0 -0
new file mode 100644
index 0000000..cb1f938
@@ -0,0 +1,37 @@

+################################################################################

package/cpupower/cpupower.mk line 4

Quoted 4 lines
package/cpupower/cpupower.mk new file +3 -0
+#
+# cpupower
+#

+################################################################################

package/cpupower/cpupower.mk line 11

Quoted 6 lines
package/cpupower/cpupower.mk new file +6 -0
+
+# Source taken from the Linux kernel tree
+CPUPOWER_SOURCE =
+CPUPOWER_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+CPUPOWER_DEPENDENCIES = linux pciutils

Add license file and type... In this case, probably just a duplication of the kernel, but needed for license manifest generation. The file has to be in your source folder, so maybe the _SOURCE needs to be set to the LINUX_DIR.... Would have to think about this one. Maybe look at the spidev-test which is also build from Linux kernel source.
http://git.buildroot.net/buildroot/tree/package/spidev_test/spidev_test.mk

To test the license gathering, remove your build/cpupower folder and then make legal-info.

LIBFOO has a good example here for how those variables are set (also look at any other package).

http://buildroot.uclibc.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

FYI, here's some background
http://buildroot.uclibc.org/downloads/manual/manual.html#legal-info

<snip>

The spidev_test might also shed light on another approach to adding cpupower.

Thanks, James for the submission!

--
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA www.rockwellcollins.com

Quoted 4 lines

Note: Any Export License Required Information and License Restricted Third Party Intellectual Property (TPIP) content must be encrypted and sent to matthew.weber at corp.rockwellcollins.com <javascript:;>.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150522/f82bfff9/attachment.html>

#3 lore raw

PATCH 1/1 package/cpupower: new package

James,

Quoted 2 lines · James Knight

Thanks Matthew.

Please don't top post.

Quoted 11 lines

I was attempting to follow the perf package style for this new package:

http://git.buildroot.net/buildroot/tree/package/perf/perf.mk

My main reason for following this was to prevent having the process from re-downloading the kernel/etc. again. I don't mind adding license information as well but I don't know the correct way in doing this since this package is based off the selected kernel option (although I can just copy the license value set by LINUX_LICENSE). Is the perf package out-of-date? I don't mind following the spidev_test package; I just want to make sure I'm doing it right.

Yep, completely understand that approach. Ah perf, that doesn't have license info..... I'll leave that as an open question (I'm not sure)

Thanks,

Signature · 8 lines
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.
#4 lore raw

PATCH 1/1 package/cpupower: new package

In reply to James Knight

Hi James,

Le 22/05/2015 01:03, James Knight a ?crit :

Quoted 27 lines
---
 package/Config.in            |  1 +
 package/cpupower/Config.in   | 10 ++++++++++
 package/cpupower/cpupower.mk | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 package/cpupower/Config.in
 create mode 100644 package/cpupower/cpupower.mk
package/Config.in +1 -0
index e0c2e2a..0bd6eb6 100644
@@ -1378,6 +1378,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/coreutils/Config.in"
 endif
 	source "package/cpuload/Config.in"
+	source "package/cpupower/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/dcron/Config.in"
 	source "package/debianutils/Config.in"
package/cpupower/Config.in new file +0 -0
new file mode 100644
index 0000000..745dd2b

package/cpupower/Config.in line 4

Quoted 4 lines
package/cpupower/Config.in new file +4 -0
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_CPUPOWER
+	bool "cpupower"
+	depends on BR2_LINUX_KERNEL
+	select BR2_PACKAGE_PCIUTILS

pciutils depends on !BR2_bfin, so cpupower shouldn't be selected with bfin target.

Quoted 37 lines
package/cpupower/Config.in new file +6 -0
+	help
+	  cpupower is a collection of tools to examine and tune power 
+	  saving related features of your processor.
+
+comment "cpupower needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
package/cpupower/cpupower.mk new file +25 -0
new file mode 100644
index 0000000..cb1f938
@@ -0,0 +1,37 @@
+################################################################################
+#
+# cpupower
+#
+################################################################################
+
+# Source taken from the Linux kernel tree
+CPUPOWER_SOURCE =
+CPUPOWER_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+
+CPUPOWER_DEPENDENCIES = linux pciutils
+
+define CPUPOWER_BUILD_CMDS
+	$(Q)if test ! -f $(LINUX_DIR)/tools/power/cpupower/Makefile ; then \
+		echo "Your kernel version is too old and does not have the cpupower tool." ; \
+		echo "At least kernel 3.4 must be used." ; \
+		exit 1 ; \
+	fi
+	
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		CROSS=$(TARGET_CROSS) \
+		CPUFREQ_BENCH=false \
+		DEBUG=false \
+		cpupower
+endef

package/cpupower/cpupower.mk line 35

Quoted 10 lines
package/cpupower/cpupower.mk new file +10 -0
+
+define CPUPOWER_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(LINUX_DIR)/tools/power/cpupower/cpupower \
+		$(TARGET_DIR)/usr/bin/cpupower
+
+	$(INSTALL) -D -m 0755 $(LINUX_DIR)/tools/power/cpupower/libcpupower.so.0.0.0 \
+		$(TARGET_DIR)/lib/libcpupower.so.0.0.0
+	ln -snf libcpupower.so.0.0.0 $(TARGET_DIR)/lib/libcpupower.so
+	ln -snf libcpupower.so.0.0.0 $(TARGET_DIR)/lib/libcpupower.so.0
+endef

It would be better to use cpupower_install target available in cpupower's Makefile instead:

define CPUPOWER_INSTALL_TARGET_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
		CROSS=$(TARGET_CROSS) \
		CPUFREQ_BENCH=false \
		DEBUG=false \
		DESTDIR=$(TARGET_DIR) \
		cpupower_install

endef

Since cpupower install a shared library, it should be also available in staging. So you should also add:

CPUPOWER_INSTALL_STAGING = YES

define CPUPOWER_INSTALL_STAGING_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
		CROSS=$(TARGET_CROSS) \
		CPUFREQ_BENCH=false \
		DEBUG=false \
		DESTDIR=$(STAGING_DIR) \
		cpupower_install

endef

By the way, do you know a tool that can link against libcpupower.so ?

Best regards,
Romain Naour

Quoted 3 lines
package/cpupower/cpupower.mk new file +2 -0
+
+$(eval $(generic-package))