summaryrefslogtreecommitdiff
path: root/libre/linux-libre-tools
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
commit8185891e28635bdb83fdf4ba4391030912dae596 (patch)
tree66a946535bdd228514750233b2cc99dd1866ff64 /libre/linux-libre-tools
parent60a11f87366fdfbd114cdc91ff813518858e5f8d (diff)
Tue Feb 18 01:56:27 UTC 2014
Diffstat (limited to 'libre/linux-libre-tools')
-rw-r--r--libre/linux-libre-tools/cpupower.default29
-rw-r--r--libre/linux-libre-tools/cpupower.install13
-rw-r--r--libre/linux-libre-tools/cpupower.service10
-rw-r--r--libre/linux-libre-tools/cpupower.systemd32
-rw-r--r--libre/linux-libre-tools/usbipd.service9
5 files changed, 93 insertions, 0 deletions
diff --git a/libre/linux-libre-tools/cpupower.default b/libre/linux-libre-tools/cpupower.default
new file mode 100644
index 000000000..b5c522ea1
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.default
@@ -0,0 +1,29 @@
+# Define CPUs governor
+# valid governors: ondemand, performance, powersave, conservative, userspace.
+#governor='ondemand'
+
+# Limit frequency range
+# Valid suffixes: Hz, kHz (default), MHz, GHz, THz
+#min_freq="2.25GHz"
+#max_freq="3GHz"
+
+# Specific frequency to be set.
+# Requires userspace governor to be available.
+# Do not set governor field if you use this one.
+#freq=
+
+# Utilizes cores in one processor package/socket first before processes are
+# scheduled to other processor packages/sockets.
+# See man (1) CPUPOWER-SET for additional details.
+#mc_scheduler=
+
+# Utilizes thread siblings of one processor core first before processes are
+# scheduled to other cores. See man (1) CPUPOWER-SET for additional details.
+#smp_scheduler=
+
+# Sets a register on supported Intel processore which allows software to convey
+# its policy for the relative importance of performance versus energy savings to
+# the processor. See man (1) CPUPOWER-SET for additional details.
+#perf_bias=
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/libre/linux-libre-tools/cpupower.install b/libre/linux-libre-tools/cpupower.install
new file mode 100644
index 000000000..10e07ae52
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.install
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ if [ "$(vercmp $2 3.7-4)" -le 0 ]; then
+ cat << EOF
+===> cpupower startup config file moved to /etc/default/cpupower
+EOF
+ fi
+}
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/libre/linux-libre-tools/cpupower.service b/libre/linux-libre-tools/cpupower.service
new file mode 100644
index 000000000..aaeba2b08
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Apply cpupower configuration
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/systemd/scripts/cpupower
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/libre/linux-libre-tools/cpupower.systemd b/libre/linux-libre-tools/cpupower.systemd
new file mode 100644
index 000000000..51c645415
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.systemd
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. /etc/default/cpupower
+
+declare -i fail=0
+
+# parse frequency options
+declare -a params=()
+params+=(${governor:+-g $governor})
+params+=(${min_freq:+-d $min_freq})
+params+=(${max_freq:+-u $max_freq})
+params+=(${freq:+-f $freq})
+
+# apply frequency options
+if ((${#params[@]} > 0)); then
+ cpupower frequency-set "${params[@]}" >/dev/null || fail=1
+fi
+
+# parse cpu options
+declare -a params=()
+params+=(${mc_scheduler:+-m $mc_scheduler})
+params+=(${smp_scheduler:+-s $smp_scheduler})
+params+=(${perf_bias:+-b $perf_bias})
+
+# apply cpu options
+if ((${#params[@]} > 0)); then
+ cpupower set "${params[@]}" >/dev/null || fail=1
+fi
+
+exit $fail
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/libre/linux-libre-tools/usbipd.service b/libre/linux-libre-tools/usbipd.service
new file mode 100644
index 000000000..1807e94b1
--- /dev/null
+++ b/libre/linux-libre-tools/usbipd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=USB/IP server
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/usbipd
+
+[Install]
+WantedBy=multi-user.target