~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[alpine-aports] [PATCH] testing/cpupower: Moving linux-tools to dedicated cpupower package. Update to use 4.1.15 kernel. Add cpupower initd and confd from Gentoo.

Ben Allen <bensallen@me.com>
Details
Message ID
<1452395058-20153-1-git-send-email-bensallen@me.com>
Sender timestamp
1452395058
DKIM signature
missing
Download raw message
Patch: +122 -53
- Updating version to compile from Linux 4.1.15 source.
- Adding a confd and initd from Gentoo's cpupower package, as is, except changing to #!/sbin/openrc-run in the initd.
- Removing testing/linux-tools, and creating a dedicated testing/cpupower package. Cpupower needs a doc, lang, and dev subpkg.
---
 testing/cpupower/APKBUILD       | 44 ++++++++++++++++++++++++++++++++++
 testing/cpupower/cpupower.confd | 36 ++++++++++++++++++++++++++++
 testing/cpupower/cpupower.initd | 42 ++++++++++++++++++++++++++++++++
 testing/linux-tools/APKBUILD    | 53 -----------------------------------------
 4 files changed, 122 insertions(+), 53 deletions(-)
 create mode 100644 testing/cpupower/APKBUILD
 create mode 100644 testing/cpupower/cpupower.confd
 create mode 100644 testing/cpupower/cpupower.initd
 delete mode 100644 testing/linux-tools/APKBUILD

diff --git a/testing/cpupower/APKBUILD b/testing/cpupower/APKBUILD
new file mode 100644
index 0000000..5d90d87
--- /dev/null
+++ b/testing/cpupower/APKBUILD
@@ -0,0 +1,44 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Ben Allen <bensallen@me.com>
pkgname=cpupower
pkgver=4.1.15
pkgrel=0
pkgdesc="Linux kernel tool to examine and tune power saving related features of your processor"
url="http://www.kernel.org"
arch="all"
license="GPL2"
depends_dev="pciutils-dev readline-dev gettext-dev"
makedepends="$depends_dev bash linux-headers"
subpackages="$pkgname-doc $pkgname-lang $pkgname-dev" 
replaces="linux-tools-cpupower"
source="http://ftp.kernel.org/pub/linux/kernel/v4.x/linux-$pkgver.tar.xz
	cpupower.initd
	cpupower.confd"

_builddir="$srcdir"/linux-$pkgver

build() {
	cd "$_builddir"/tools/power/cpupower
	CFLAGS="$CFLAGS -lintl" \
	make VERSION=$pkgver-$pkgrel
}

package() {
	cd "$_builddir"/tools/power/cpupower
	make DESTDIR="$pkgdir" mandir="/usr/share/man" install || return 1

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	install -Dm644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname || return 1
}

md5sums="b227333912b161c96ff3e30f5041e1c0  linux-4.1.15.tar.xz
209e4f95728bd7c7c4ba35c320683a9b  cpupower.initd
fc335236f7617b042066c6231d5c9b87  cpupower.confd"
sha256sums="472288cc966188c5d7c511c6be0f78682843c9ca2d5d6c4d67d77455680359a3  linux-4.1.15.tar.xz
bd7133303c9a0fc892267335b6fb371d6179c6f4251d7f360ae82d7d1f0b321f  cpupower.initd
9ab6f022d2b2948660decf5e383984e6ddb9e9e5e6e2761c3031378ddd87e947  cpupower.confd"
sha512sums="2e56a61764daabd967a47206b96acf598dbf04a17bf05b44ad5f76164e64f570502c2d05507bb653222b7cc88226aaf60ca92672b67f48404ee5793d6de2293b  linux-4.1.15.tar.xz
97ecfeaaaa8efca7af585316b843bf7be885e88095bbdfbf52bc9a96b14dc862435482781e205ea022ab208978aaa4aabb317354fab890ed514a5088ae5045c8  cpupower.initd
63cd12a4d8782198c71662e9205e346e064b65bae5e3e175b5bc43bdf7ec6ddf675b60349750afe3c37c8a925f9ae9a93530671821342581bd282a69e0773b8c  cpupower.confd"
diff --git a/testing/cpupower/cpupower.confd b/testing/cpupower/cpupower.confd
new file mode 100644
index 0000000..1e67ed0
--- /dev/null
+++ b/testing/cpupower/cpupower.confd
@@ -0,0 +1,36 @@
# /etc/conf.d/cpupower: config file for /etc/init.d/cpupower

# Options when starting cpufreq (given to the `cpupower` program)
# Possible options are:
# -g --governor <GOV> (ie: ondemand, performance, or powersave)
# -d --min <FREQ> (ie: 1000MHz)
# -u --max <FREQ> (ie: 2000MHz)
# -f --freq <FREQ> (requires userspace governor, this *can not* be combined with
#                   with any other parameters).
# Frequencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the
# value with  the  wanted  unit name, without any space.
# (frequency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).

START_OPTS="--governor ondemand"

# Options when stopping cpufreq (given to the `cpupower` program)
# This option can be used to change governer on stop. Leaving it empty will ensure
# the governer remains on the one provided above.
STOP_OPTS=""

# Extra settings to write to sysfs cpufreq values.
#
# up_threshold: threshold for stepping up frequency, where the value represents
# the percentage of cpu load. 
#
# down_threshold: threshold for stepping down frequency, where the value
# represents the percentage of cpu load.
#
# sampling_down_factor: determines how frequently the governor polls the cpu, a
# value greater than 1 improves performance by reducing the polling when the
# load is high. This tunable has no effect on behavior at lower CPU frequencies.
#
# ignore_nice_load: when set to '1' the processes that are run with a 'nice'
# value will not count in the usage calculation.

#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=75 ondemand/sampling_down_factor=10"
diff --git a/testing/cpupower/cpupower.initd b/testing/cpupower/cpupower.initd
new file mode 100644
index 0000000..7e4584f
--- /dev/null
+++ b/testing/cpupower/cpupower.initd
@@ -0,0 +1,42 @@
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq

change() {
	local c ret=0 opts="$1"
	if [ -n "$opts" ] ; then
		ebegin "Running cpupower -c all frequency-set ${opts}"
			cpupower -c all frequency-set ${opts} >/dev/null 2>&1
			: $(( ret += $? ))
		eend ${ret}

		if [ -d ${CPUFREQ_SYSFS} ] && [ -n "${SYSFS_EXTRA}" ] ; then
			c=1
			einfo "Setting extra options: ${SYSFS_EXTRA}"
			if cd ${CPUFREQ_SYSFS} ; then
				local o v
				for o in ${SYSFS_EXTRA} ; do
					v=${o#*=}
					o=${o%%=*}
					echo ${v} > ${o} || break
				done
				c=0
			fi
			eend ${c}
			: $(( ret += c ))
		fi
	fi

	return ${ret}
}

start() {
	change "${START_OPTS}"
}

stop() {
	change "${STOP_OPTS}"
}
diff --git a/testing/linux-tools/APKBUILD b/testing/linux-tools/APKBUILD
deleted file mode 100644
index 73c25a4..0000000
--- a/testing/linux-tools/APKBUILD
@@ -1,53 +0,0 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=linux-tools
pkgver=3.14.37
pkgrel=0
pkgdesc="Linux kernel tools meta package"
url="http://www.kernel.org"
arch="noarch"
license="GPL2"
depends="$pkgname-cpupower"
depends_dev="pciutils-dev readline-dev gettext-dev"
makedepends="$depends_dev bash linux-headers"
install=""
subpackages="$pkgname-cpupower"
source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$pkgver.tar.xz"

_builddir="$srcdir"/linux-$pkgver

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
        cd "$_builddir"
	# possible tools: acpi cgroup cpupower firewire lguest perf selftests turbostat
	# usb virtio net vm x86_energy_perf_policy tmon"
	export CFLAGS="$CFLAGS -lintl"
	cd "$_builddir"/tools/power/cpupower
	make VERSION=$pkgver-$pkgrel
}

package() {
	cd "$_builddir"
	mkdir -p "$pkgdir"
}

cpupower() {
	pkgdesc="Linux kernel tool to examine and tune power saving related features of your processor"
	arch="all"
	depends=
	cd "$_builddir"/tools/power/cpupower
	make DESTDIR="$subpkgdir" install || return 1
}

md5sums="43abcb454054c53fb07296e84119edc5  linux-3.14.37.tar.xz"
sha256sums="ccaf13806075aaefc171410282281bdf27f830029a74ea11cd6868bf4f8a04df  linux-3.14.37.tar.xz"
sha512sums="4891484ef35e92072c4ee0369cc6437dda4e0b81a38331cbe0e163d82453bbc53cb8084c59ad57bbac5628b4c8e06c93ce3055203838e5d10c94d9776daa0d0e  linux-3.14.37.tar.xz"
-- 
2.7.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)