From 620b37cb6772217ce60f91e8a428bcfe072910b8 Mon Sep 17 00:00:00 2001 From: rmnscnce Date: May 25 2021 20:28:57 +0000 Subject: - Initial packaging --- diff --git a/rpmsrc/amdctl.conf b/rpmsrc/amdctl.conf new file mode 100644 index 0000000..3e5ee7f --- /dev/null +++ b/rpmsrc/amdctl.conf @@ -0,0 +1 @@ +msr diff --git a/rpmsrc/amdctl.spec b/rpmsrc/amdctl.spec new file mode 100644 index 0000000..e5d25d9 --- /dev/null +++ b/rpmsrc/amdctl.spec @@ -0,0 +1,71 @@ +%define _build_id_links none +%define debug_package %{nil} + +Name: amdctl +Summary: Set P-State voltages and clock speeds on recent AMD CPUs on Linux +License: GPLv3 +URL: https://github.com/kevinlekiller/amdctl + +%define gitref b0ffbad +Version: 0.2 +Release: 2.git+%{gitref} +Source0: kevinlekiller-amdctl-v0.2-2-g%{gitref}.tar.gz + +Requires: kmod(msr.ko*) modprobe systemd-udev gcc +BuildRequires: make + +%description +Tool for changing voltages and clock speeds for AMD processors with control over every power state and CPU core. + +%prep +%setup -n kevinlekiller-amdctl-%{gitref} + +%build +make %{?_smp_mflags} +strip ./amdctl + +%install +mkdir -p %{buildroot}/%{_bindir} +install -m 0755 ./amdctl %{buildroot}/%{_bindir}/ + +printf 'msr' | tee ./amdctl.conf +mkdir -p %{buildroot}/etc/modules.load.d +install -m 0644 ./amdctl.conf %{buildroot}/etc/modules.load.d/amdctl.conf + +%post + +if [[ $(printf '%s\n%s\n' "$(uname -r)" "5.9.0" | sort -V | tail -n1) == $(uname -r) ]] ; then + if [ -x /usr/sbin/grub2-mkconfig ] ; then + if [ -e /etc/grub2-efi.cfg ] ; then + GRUBCFG='/etc/grub2-efi.cfg' + elif [ -e /etc/grub2.cfg ] ; then + GRUBCFG='/etc/grub2.cfg' + fi + if [ -e /etc/default/grub ] ; then + sed "s/GRUB_CMDLINE_LINUX=\"\(.*\)\"/GRUB_CMDLINE_LINUX=\"\1 msr.allow_writes=on\"/" /etc/default/grub + else + echo -e "[amdctl:WARN] grub2-mkconfig detected but /etc/default/grub is not found." + echo -e "[amdctl:WARN] \tYou will need to modify the kernel command line manually to use amdctl" + printf '\n' + echo -e "[amdctl:INFO] To use amdctl, you will need to add this into the kernel's command line:" + echo -e "[amdctl:INFO]" + echo -e '[amdctl:INFO] \tmsr.allow_writes=on\n' + fi + grub2-mkconfig -o ${GRUBCFG} + else + echo -e "[amdctl:INFO] It looks like you're not using grub2 as the device's boot manager." + echo -e "[amdctl:INFO] To use amdctl, you will need to add this into the kernel's command line:" + echo -e "[amdctl:INFO]" + echo -e '[amdctl:INFO] \tmsr.allow_writes=on\n' + fi +fi + +%files +%license LICENSE +%doc README.md +%{_bindir}/amdctl +/etc/modules.load.d/amdctl.conf + +%changelog +* Mon May 24 2021 rmnscnce - 0.2-2.git+gb0ffbad +- Initial packaging diff --git a/rpmsrc/kevinlekiller-amdctl-v0.2-2-gb0ffbad.tar.gz b/rpmsrc/kevinlekiller-amdctl-v0.2-2-gb0ffbad.tar.gz new file mode 100644 index 0000000..b864349 Binary files /dev/null and b/rpmsrc/kevinlekiller-amdctl-v0.2-2-gb0ffbad.tar.gz differ