summaryrefslogtreecommitdiff
path: root/pcr/phc-intel-dkms
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2023-07-15 17:14:42 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2023-07-16 01:29:09 -0400
commit1071529540c9961c34a8eed98deb4d547ee8b5b9 (patch)
treecd49b575d66905d9d4b05c08db7966770a3f8967 /pcr/phc-intel-dkms
parent2cf4d1b9f2320814deb65f5e51fb22cc12cd9df8 (diff)
[phc-intel]: rename to phc-intel-dkms - housekeeping changes (recipe upstream abandoned)
Diffstat (limited to 'pcr/phc-intel-dkms')
-rw-r--r--pcr/phc-intel-dkms/PKGBUILD65
-rw-r--r--pcr/phc-intel-dkms/dkms.conf.in7
-rw-r--r--pcr/phc-intel-dkms/phc-intel.default4
-rw-r--r--pcr/phc-intel-dkms/phc-intel.install32
-rw-r--r--pcr/phc-intel-dkms/phc-intel.sh55
-rw-r--r--pcr/phc-intel-dkms/phc-intel.sleep7
-rw-r--r--pcr/phc-intel-dkms/phc-intel.system-sleep5
7 files changed, 175 insertions, 0 deletions
diff --git a/pcr/phc-intel-dkms/PKGBUILD b/pcr/phc-intel-dkms/PKGBUILD
new file mode 100644
index 000000000..2e747f801
--- /dev/null
+++ b/pcr/phc-intel-dkms/PKGBUILD
@@ -0,0 +1,65 @@
+# Contributor: 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>
+
+
+# parabola changes and rationale:
+# - use VCS tag instead of arbitrary commit
+# - use upstream revision as $pkgver - upstream version is hyper-stable
+
+
+pkgname=phc-intel-dkms
+_upstream_name=phc-intel
+_upstream_ver=0.3.2
+_upstream_rev=rev45 # use tag revNN (see https://gitlab.com/linux-phc/phc-intel/-/tags)
+pkgver=$_upstream_ver.$_upstream_rev
+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=('x86_64' 'i686') # could be 'any'; but avoid publishing to non-x86 repos
+license=('GPL')
+depends=('dkms')
+replaces=('phc-intel')
+backup=('etc/default/phc-intel')
+source=("https://gitlab.com/linux-phc/phc-intel/-/archive/$_upstream_rev/$_upstream_name-$_upstream_rev.tar.gz"
+ dkms.conf.in
+ phc-intel.default
+ phc-intel.sh
+ phc-intel.sleep
+ phc-intel.system-sleep)
+sha256sums=('f27fa7dece7c3ca7c81d08500878cac803f412dc1d6e76a05621ab72c82dfa17'
+ '2a5a6df46556687125f2082bff2f98c5941ebe98928c491458348c1174622e04'
+ 'ce08a5a4107be1d5723f1f169d515e67b6c77893f3994fc2d0d2ccf611307ed3'
+ 'b526f3e8e66f6495531f13f2e6867d3a07b2ec7a7c3b8aa061f22be1cd6e770f'
+ '569b85988cb38380fec85c25688b76abc24a46601aa8f58eb24eaebf863eebef'
+ '2e17c90d7bfae8f5070e46388e95d443188eaa7beb5ffdd418a0da090f2e7557')
+
+
+prepare()
+{
+ # inject version into dkms.conf
+ sed "s|@VERSION@|$pkgver|" dkms.conf.in > dkms.conf
+
+ cd $_upstream_name-$_upstream_rev
+
+ # initialize upon load?
+ # TODO: what does this do?
+ sed -i 's|/sbin/modprobe phc-intel |&\&\& /usr/bin/phc-intel set |' phc-intel.modprobe
+}
+
+package()
+{
+ umask 022
+ install -Dm644 dkms.conf "$pkgdir/usr/src/phc-intel-$_upstream_ver/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 $_upstream_name-$_upstream_rev
+ install -Dm644 phc-intel.modprobe "$pkgdir/usr/lib/modprobe.d/phc-intel.conf"
+ cp -R inc Makefile "$pkgdir/usr/src/phc-intel-$_upstream_ver/"
+}
diff --git a/pcr/phc-intel-dkms/dkms.conf.in b/pcr/phc-intel-dkms/dkms.conf.in
new file mode 100644
index 000000000..a97befb04
--- /dev/null
+++ b/pcr/phc-intel-dkms/dkms.conf.in
@@ -0,0 +1,7 @@
+PACKAGE_NAME="phc-intel"
+PACKAGE_VERSION=@VERSION@
+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-dkms/phc-intel.default b/pcr/phc-intel-dkms/phc-intel.default
new file mode 100644
index 000000000..4e390e768
--- /dev/null
+++ b/pcr/phc-intel-dkms/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-dkms/phc-intel.install b/pcr/phc-intel-dkms/phc-intel.install
new file mode 100644
index 000000000..fb69a8b4a
--- /dev/null
+++ b/pcr/phc-intel-dkms/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-dkms/phc-intel.sh b/pcr/phc-intel-dkms/phc-intel.sh
new file mode 100644
index 000000000..cce4bf96a
--- /dev/null
+++ b/pcr/phc-intel-dkms/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-dkms/phc-intel.sleep b/pcr/phc-intel-dkms/phc-intel.sleep
new file mode 100644
index 000000000..342b81acf
--- /dev/null
+++ b/pcr/phc-intel-dkms/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-dkms/phc-intel.system-sleep b/pcr/phc-intel-dkms/phc-intel.system-sleep
new file mode 100644
index 000000000..c76ea6aaf
--- /dev/null
+++ b/pcr/phc-intel-dkms/phc-intel.system-sleep
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+if [ "$1" = post ]; then
+ . /usr/bin/phc-intel set
+fi