diff options
Diffstat (limited to 'pcr/phc-intel')
-rw-r--r-- | pcr/phc-intel/PKGBUILD | 46 | ||||
-rw-r--r-- | pcr/phc-intel/dkms.conf | 7 | ||||
-rw-r--r-- | pcr/phc-intel/phc-intel.default | 4 | ||||
-rw-r--r-- | pcr/phc-intel/phc-intel.install | 32 | ||||
-rw-r--r-- | pcr/phc-intel/phc-intel.sh | 55 | ||||
-rw-r--r-- | pcr/phc-intel/phc-intel.sleep | 7 | ||||
-rw-r--r-- | pcr/phc-intel/phc-intel.system-sleep | 5 |
7 files changed, 156 insertions, 0 deletions
diff --git a/pcr/phc-intel/PKGBUILD b/pcr/phc-intel/PKGBUILD new file mode 100644 index 000000000..1882257c3 --- /dev/null +++ b/pcr/phc-intel/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer (aur): adrien1018 <adrien.sf.wu[at]gmail[dot]com> +# Contributor: fs4000 <matthias_dienstbier[at]yahoo[dot]de> +# Contributor: trapanator <trap[at]trapanator[dot]com> +# Contributor: tomprogrammer <Thomas-Bahn[at]gmx[dot]net> +# Maintainer: Wael Karram <wael@waelk.tech> + +pkgname=phc-intel +_phcver=0.3.2 +pkgver=$_phcver.12.41 +pkgrel=1 +pkgdesc="Frequency driver for Intel CPUs with undervolting feature" +pkgdesc+=", (for Core/Core2 systems)" +url="https://gitlab.com/linux-phc/phc-intel" +arch=('any') +arch=('x86_64' 'i686') # avoid publishing to non-x86 arches +license=('GPL') +depends=('dkms') +# provides=('linux-phc') # useless - no arch, parabola, nor AUR package refers to this +backup=('etc/default/phc-intel') +_commit_hash='c0879a65d2687aaddc2b3ea630020e53ae0bc7cf' +source=("https://gitlab.com/linux-phc/phc-intel/-/archive/$_commit_hash/phc-intel-$_commit_hash.tar.gz" + phc-intel.{default,sh,sleep,system-sleep} dkms.conf) +sha256sums=('52275f7c6880a220983d9541f01e7b3f70d2cd95eadb854e7b77e4c005c3c09e' + 'ce08a5a4107be1d5723f1f169d515e67b6c77893f3994fc2d0d2ccf611307ed3' + 'b526f3e8e66f6495531f13f2e6867d3a07b2ec7a7c3b8aa061f22be1cd6e770f' + '569b85988cb38380fec85c25688b76abc24a46601aa8f58eb24eaebf863eebef' + '2e17c90d7bfae8f5070e46388e95d443188eaa7beb5ffdd418a0da090f2e7557' + '7b44882a96eeb7c79dbb7fe5b1ff8cded68c2b6a374c95bdc5e08c414cfd3549') + +prepare() { + cd $pkgname-$_commit_hash + sed -i 's,/sbin/modprobe phc-intel |,/sbin/modprobe phc-intel \&\& /usr/bin/phc-intel set |,' phc-intel.modprobe +} + +package() { + umask 022 + install -Dm644 dkms.conf "$pkgdir/usr/src/phc-intel-$_phcver/dkms.conf" + install -Dm644 phc-intel.default "$pkgdir/etc/default/phc-intel" + install -Dm755 phc-intel.sh "$pkgdir/usr/bin/phc-intel" + install -Dm755 phc-intel.sleep "$pkgdir/usr/lib/pm-utils/sleep.d/00phc-intel" + install -Dm755 phc-intel.system-sleep "$pkgdir/usr/lib/systemd/system-sleep/phc-intel" + + cd $pkgname-$_commit_hash + install -Dm644 phc-intel.modprobe "$pkgdir/usr/lib/modprobe.d/phc-intel.conf" + cp -R inc Makefile "$pkgdir/usr/src/phc-intel-$_phcver/" +} diff --git a/pcr/phc-intel/dkms.conf b/pcr/phc-intel/dkms.conf new file mode 100644 index 000000000..db660379a --- /dev/null +++ b/pcr/phc-intel/dkms.conf @@ -0,0 +1,7 @@ +PACKAGE_NAME="phc-intel" +PACKAGE_VERSION=0.3.2 +AUTOINSTALL="yes" + +BUILT_MODULE_NAME[0]="phc-intel" +DEST_MODULE_LOCATION[0]="/extra" +MAKE[0]="make KERNELSRC=$kernel_source_dir" diff --git a/pcr/phc-intel/phc-intel.default b/pcr/phc-intel/phc-intel.default new file mode 100644 index 000000000..4e390e768 --- /dev/null +++ b/pcr/phc-intel/phc-intel.default @@ -0,0 +1,4 @@ +# configuration for phc-intel + +# voltage IDs to be set for all CPUs +VIDS="" diff --git a/pcr/phc-intel/phc-intel.install b/pcr/phc-intel/phc-intel.install new file mode 100644 index 000000000..fb69a8b4a --- /dev/null +++ b/pcr/phc-intel/phc-intel.install @@ -0,0 +1,32 @@ +post_install() { + cat <<-EOF + You can enter the desired voltage IDs in /etc/default/phc-intel. + Booting with nophc kernel parameter skips setting of VIDs in case of failure. + EOF +} + +pre_upgrade() { + if (( "$(vercmp $2 0.3.2.12.19-2)" < 0 )); then + cd usr/lib/modules/ + for i in *; do + if [ -f "$i/extramodules/phc-intel.ko" ]; then + rm -f "$i/extramodules/phc-intel.ko" + [ -d "$i/kernel" ] && depmod "$i" + elif [ -f "$i/phc-intel.ko" ]; then + rm -f "$i/phc-intel.ko" + rmdir -p --ignore-fail-on-non-empty "$i" + elif [ -f "$i/extra/phc-intel.ko" ]; then + rm -f "$i/extra/phc-intel.ko" + rmdir -p --ignore-fail-on-non-empty "$i/extra" + [ -d "$i/kernel" ] && depmod "$i" + fi + done + fi +} + +post_upgrade() { + if (( "$(vercmp $2 0.3.2.12.19-2)" < 0 )); then + rm -rf usr/src/phc-intel/ + echo '===> The kernel module gets automatically built by DKMS now.' + fi +} diff --git a/pcr/phc-intel/phc-intel.sh b/pcr/phc-intel/phc-intel.sh new file mode 100644 index 000000000..cce4bf96a --- /dev/null +++ b/pcr/phc-intel/phc-intel.sh @@ -0,0 +1,55 @@ +#!/bin/bash -e +shopt -s nullglob + +case "$1" in +start) + . /etc/default/phc-intel + if [ -z "$VIDS" ]; then + echo '=> Please edit /etc/default/phc-intel' + exit 1 + fi + echo ':: Setting PHC VIDs' + for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do + echo $VIDS > "$i" + done + ;; +stop) + echo ':: Resetting default PHC VIDs' + for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do + cp "${i%vids}default_vids" "$i" + done + ;; +status) + check_off () { + for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do + [ "$(< "$i")" = "$(< "${i%vids}default_vids")" ] || return; + done + } + check_on () { + for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do + [[ "$(< "$i")" =~ "$VIDS" ]] || return; + done + } + echo -n 'PHC status: ' + . /etc/default/phc-intel + if check_off; then + echo 'inactive' + elif check_on; then + echo 'active' + else + echo 'unknown' + fi + ;; +set) + . /etc/default/phc-intel + [ -z "$VIDS" ] && exit + for i in $(< /proc/cmdline); do + [ $i = nophc ] && exit + done + for i in /sys/devices/system/cpu/cpu*/cpufreq/phc_vids; do + echo $VIDS > "$i" + done + ;; +*) + echo "usage: $0 {start|stop|status|set}" +esac diff --git a/pcr/phc-intel/phc-intel.sleep b/pcr/phc-intel/phc-intel.sleep new file mode 100644 index 000000000..342b81acf --- /dev/null +++ b/pcr/phc-intel/phc-intel.sleep @@ -0,0 +1,7 @@ +#!/bin/bash + +case $1 in + resume|thaw) + . /usr/bin/phc-intel set + ;; +esac diff --git a/pcr/phc-intel/phc-intel.system-sleep b/pcr/phc-intel/phc-intel.system-sleep new file mode 100644 index 000000000..c76ea6aaf --- /dev/null +++ b/pcr/phc-intel/phc-intel.system-sleep @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ "$1" = post ]; then + . /usr/bin/phc-intel set +fi |