diff mbox

[1/1] package/cpupower: new package

Message ID 1432249380-5920-1-git-send-email-james.knight@rockwellcollins.com
State Superseded
Headers show

Commit Message

James Knight May 21, 2015, 11:03 p.m. UTC
Signed-off-by: James Knight <james.knight@rockwellcollins.com>
---
 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

Comments

Matt Weber May 22, 2015, 3:38 p.m. UTC | #1
James,

On Thu, May 21, 2015 at 6:03 PM, James Knight
<james.knight@rockwellcollins.com> wrote:
> Signed-off-by: James Knight <james.knight@rockwellcollins.com>
> ---
>  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
>
> diff --git a/package/Config.in b/package/Config.in
> index e0c2e2a..0bd6eb6 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/cpupower/Config.in b/package/cpupower/Config.in
> new file mode 100644
> index 0000000..745dd2b
> --- /dev/null
> +++ b/package/cpupower/Config.in
> @@ -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.

> +         saving related features of your processor.
> +
> +comment "cpupower needs a Linux kernel to be built"
> +       depends on !BR2_LINUX_KERNEL
> diff --git a/package/cpupower/cpupower.mk b/package/cpupower/cpupower.mk
> new file mode 100644
> index 0000000..cb1f938
> --- /dev/null
> +++ b/package/cpupower/cpupower.mk
> @@ -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

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!
James Knight May 22, 2015, 4:09 p.m. UTC | #2
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.

On Friday, May 22, 2015, Matthew Weber <matthew.weber@rockwellcollins.com>
wrote:

> James,
>
> On Thu, May 21, 2015 at 6:03 PM, James Knight
> <james.knight@rockwellcollins.com <javascript:;>> wrote:
> > Signed-off-by: James Knight <james.knight@rockwellcollins.com
> <javascript:;>>
> > ---
> >  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
> >
> > diff --git a/package/Config.in b/package/Config.in
> > index e0c2e2a..0bd6eb6 100644
> > --- a/package/Config.in
> > +++ b/package/Config.in
> > @@ -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"
> > diff --git a/package/cpupower/Config.in b/package/cpupower/Config.in
> > new file mode 100644
> > index 0000000..745dd2b
> > --- /dev/null
> > +++ b/package/cpupower/Config.in
> > @@ -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.
>
> > +         saving related features of your processor.
> > +
> > +comment "cpupower needs a Linux kernel to be built"
> > +       depends on !BR2_LINUX_KERNEL
> > diff --git a/package/cpupower/cpupower.mk b/package/cpupower/cpupower.mk
> > new file mode 100644
> > index 0000000..cb1f938
> > --- /dev/null
> > +++ b/package/cpupower/cpupower.mk
> > @@ -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
>
> 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
>
> Note: Any Export License Required Information and License Restricted
> Third Party Intellectual Property (TPIP) content must be encrypted and
> sent to matthew.weber@corp.rockwellcollins.com <javascript:;>.
>
Matt Weber May 22, 2015, 4:18 p.m. UTC | #3
James,


On Fri, May 22, 2015 at 11:09 AM, James Knight
<james.knight@rockwellcollins.com> wrote:
> Thanks Matthew.
>
Please don't top post.

> 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,
Romain Naour July 12, 2015, 10:37 a.m. UTC | #4
Hi James,

Le 22/05/2015 01:03, James Knight a écrit :
> Signed-off-by: James Knight <james.knight@rockwellcollins.com>
> ---
>  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
> 
> diff --git a/package/Config.in b/package/Config.in
> index e0c2e2a..0bd6eb6 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/cpupower/Config.in b/package/cpupower/Config.in
> new file mode 100644
> index 0000000..745dd2b
> --- /dev/null
> +++ b/package/cpupower/Config.in
> @@ -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.

> +	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
> diff --git a/package/cpupower/cpupower.mk b/package/cpupower/cpupower.mk
> new file mode 100644
> index 0000000..cb1f938
> --- /dev/null
> +++ b/package/cpupower/cpupower.mk
> @@ -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

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

> +
> +$(eval $(generic-package))
>
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index e0c2e2a..0bd6eb6 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/cpupower/Config.in b/package/cpupower/Config.in
new file mode 100644
index 0000000..745dd2b
--- /dev/null
+++ b/package/cpupower/Config.in
@@ -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
diff --git a/package/cpupower/cpupower.mk b/package/cpupower/cpupower.mk
new file mode 100644
index 0000000..cb1f938
--- /dev/null
+++ b/package/cpupower/cpupower.mk
@@ -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))