Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=bb03fafac52c5789f45cb612865ff1d8cd64ab81

commit bb03fafac52c5789f45cb612865ff1d8cd64ab81
Author: James Buren <r...@frugalware.org>
Date:   Sat Mar 17 14:15:59 2012 -0500

phc-1-1-x86_64
* new package

diff --git a/source/apps-extra/phc/FrugalBuild 
b/source/apps-extra/phc/FrugalBuild
new file mode 100644
index 0000000..eb8287d
--- /dev/null
+++ b/source/apps-extra/phc/FrugalBuild
@@ -0,0 +1,31 @@
+# Compiling Time: 0 SBU
+# Maintainer: James Buren <r...@frugalware.org>
+
+pkgname=phc
+pkgver=1
+pkgrel=1
+pkgdesc="System scripts for phc modules."
+url="http://www.frugalware.org";
+depends=('pm-utils' 'cpupower')
+groups=('apps-extra')
+archs=('i686' 'x86_64')
+up2date="$pkgver"
+source=($pkgname{,.sh,.service,.sleep} README.Frugalware)
+sha1sums=('4fcc915c7cc23d23f96965888ca9f38e50b47fa3' \
+          '8b218f834cfa75d3b8e6255212a2a1fcbcaeb020' \
+          'dff5344fd1f9072a4eb1d15fd51fc123a538dbd7' \
+          '95d9f4812a4aa44372a77a3a9756021d8e84519e' \
+          '7cc146be5c25db6f1825814143975ef5385ec94e')
+backup=('etc/sysconfig/phc')
+_F_cd_path='.'
+_F_systemd_units="phc"
+Finclude systemd
+
+build()
+{
+       Ffile /etc/sysconfig/$pkgname
+       Fexe /usr/sbin/$pkgname.sh
+       Ffile /lib/systemd/system/$pkgname.service
+       Fexe $pkgname.sleep /usr/lib/pm-utils/sleep.d/96$pkgname
+       Fgenscriptlet
+}
diff --git a/source/apps-extra/phc/README.Frugalware 
b/source/apps-extra/phc/README.Frugalware
new file mode 100644
index 0000000..f333562
--- /dev/null
+++ b/source/apps-extra/phc/README.Frugalware
@@ -0,0 +1,19 @@
+Before using this package, it is recommended that you setup the `cpupower`
+package so that you can get the maximum benefit from this package. After
+you have done this, come back to this documentation.
+
+First, it is recommended you use the `phc-optimizer` package to discover
+your unique set of VIDs to use on your hardware. Place these values in the
+file `/etc/sysconfig/phc` within the variable VIDS.
+
+Next, you will want to enable the systemd service so your VIDs will be setup
+upon each reboot. Use this command to do this and start it now.
+
+----
+systemctl enable phc.service
+systemctl start phc.service
+----
+
+And you're done. In the event of system instability, you will want to try
+tweaking the VIDs by raising them until you find the setting your system
+can remain stable at.
diff --git a/source/apps-extra/phc/phc b/source/apps-extra/phc/phc
new file mode 100644
index 0000000..07769e1
--- /dev/null
+++ b/source/apps-extra/phc/phc
@@ -0,0 +1,2 @@
+# Set this to the value of the VIDs you wish to use. Example: 44 29 19
+VIDS=""
diff --git a/source/apps-extra/phc/phc.service 
b/source/apps-extra/phc/phc.service
new file mode 100644
index 0000000..315cc51
--- /dev/null
+++ b/source/apps-extra/phc/phc.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Apply phc configuration
+After=syslog.target
+
+[Service]
+ExecStart=/usr/sbin/phc.sh set
+ExecStop=/usr/sbin/phc.sh reset
+Type=oneshot
+StandardOutput=syslog
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/source/apps-extra/phc/phc.sh b/source/apps-extra/phc/phc.sh
new file mode 100644
index 0000000..b5ee06c
--- /dev/null
+++ b/source/apps-extra/phc/phc.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. /etc/sysconfig/phc
+
+[ -z "$VIDS" -o -z "$1" ] && exit 1
+
+set_vids()
+{
+       for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do
+               if [ -f "$i" ]; then
+                       echo "$1" > "$i"
+                       [ "$?" -ne "0" ] && exit 1
+               fi
+       done
+}
+
+case $1 in
+       set)
+               set_vids "$VIDS"
+               ;;
+       reset)
+               [ -f "/sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids" ] 
|| exit 1
+               set_vids "$(< 
/sys/devices/system/cpu/cpu0/cpufreq/phc_default_vids)"
+               ;;
+esac
diff --git a/source/apps-extra/phc/phc.sleep b/source/apps-extra/phc/phc.sleep
new file mode 100644
index 0000000..e21972f
--- /dev/null
+++ b/source/apps-extra/phc/phc.sleep
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case $1 in
+       resume|thaw)
+               /usr/sbin/phc.sh set
+               ;;
+       *)
+               ;;
+esac
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to