summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Maisonnas2019-06-20 20:46:47 +0200
committerBenjamin Maisonnas2019-06-20 20:46:47 +0200
commita8d2a3fda9e30c5d635d533bd4be771f65701b1f (patch)
tree684e39589a3d0fa6ec5f6700f6ae346248e68047
downloadaur-a8d2a3fda9e30c5d635d533bd4be771f65701b1f.tar.gz
initial commit
-rw-r--r--.SRCINFO26
-rw-r--r--.gitignore7
-rw-r--r--Makefile105
-rw-r--r--PKGBUILD49
-rw-r--r--dkms.conf7
-rw-r--r--zenpower.conf5
6 files changed, 199 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..8dd4a525b0f
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = zenpower-dkms-git
+ pkgdesc = Linux kernel driver for reading sensors for AMD Zen family CPUs
+ pkgver = 6.56daa91
+ pkgrel = 1
+ url = https://github.com/ocerman/zenpower
+ arch = x86_64
+ arch = i686
+ license = GPL
+ makedepends = git
+ makedepends = linux-headers
+ depends = make
+ depends = gcc
+ depends = linux
+ depends = dkms
+ provides = zenpower
+ source = zenpower::git+https://github.com/ocerman/zenpower.git
+ source = Makefile
+ source = dkms.conf
+ source = zenpower.conf
+ sha256sums = SKIP
+ sha256sums = f7f2c87bfed0d4a921d196948b77f9c9d75357b6c3396b72ad9eac9db1720580
+ sha256sums = 9eb35ca8dcff02744dd3256238f22bfe6ebaf1636867aabed4c40a31073c4e1e
+ sha256sums = 92c26ef5cd6f8a632f2d8cb12e9da8c4452cb0432ffe543733f13e67d6531d04
+
+pkgname = zenpower-dkms-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..180f88a1b2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+*.[oa]
+*.zip
+*.gz
+*.pkg.*
+zenpower/
+pkg/
+src/
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000000..9191439fe07
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,105 @@
+# For building for the current running version of Linux
+ifndef TARGET
+TARGET := $(shell uname -r)
+endif
+# Or specific version
+#TARGET := 2.6.33.5
+
+KERNEL_MODULES := /lib/modules/$(TARGET)
+
+ifneq ("","$(wildcard /usr/src/linux-headers-$(TARGET)/*)")
+# Ubuntu
+KERNEL_BUILD := /usr/src/linux-headers-$(TARGET)
+else
+ifneq ("","$(wildcard /usr/src/kernels/$(TARGET)/*)")
+# Fedora
+KERNEL_BUILD := /usr/src/kernels/$(TARGET)
+else
+KERNEL_BUILD := $(KERNEL_MODULES)/build
+endif
+endif
+
+#SYSTEM_MAP := $(KERNEL_BUILD)/System.map
+ifneq ("","$(wildcard /boot/System.map-$(TARGET))")
+SYSTEM_MAP := /boot/System.map-$(TARGET)
+else
+# Arch
+SYSTEM_MAP := /proc/kallsyms
+endif
+
+DRIVER := zenpower
+ifneq ("","$(wildcard .git/*)")
+DRIVER_VERSION := $(shell git describe --long)
+else
+ifneq ("", "$(wildcard VERSION)")
+DRIVER_VERSION := $(shell cat VERSION)
+else
+DRIVER_VERSION := unknown
+endif
+endif
+
+# DKMS
+DKMS_ROOT_PATH=/usr/src/$(DRIVER)-$(DRIVER_VERSION)
+MODPROBE_OUTPUT=$(shell lsmod | grep zenpower)
+
+# Directory below /lib/modules/$(TARGET)/kernel into which to install
+# the module:
+MOD_SUBDIR = drivers/hwmon
+MODDESTDIR=$(KERNEL_MODULES)/kernel/$(MOD_SUBDIR)
+
+obj-m := $(patsubst %,%.o,$(DRIVER))
+obj-ko := $(patsubst %,%.ko,$(DRIVER))
+
+MAKEFLAGS += --no-print-directory
+
+ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.gz)")
+COMPRESS_GZIP := y
+endif
+ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.xz)")
+COMPRESS_XZ := y
+endif
+
+.PHONY: all install modules modules_install clean dkms dkms_clean
+
+all: modules
+
+# Targets for running make directly in the external module directory:
+
+modules:
+ @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
+
+clean:
+ @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@
+
+install: modules_install
+
+modules_install:
+ mkdir -p $(MODDESTDIR)
+ cp $(DRIVER).ko $(MODDESTDIR)/
+ifeq ($(COMPRESS_GZIP), y)
+ @gzip -f $(MODDESTDIR)/$(DRIVER).ko
+endif
+ifeq ($(COMPRESS_XZ), y)
+ @xz -f $(MODDESTDIR)/$(DRIVER).ko
+endif
+ depmod -a -F $(SYSTEM_MAP) $(TARGET)
+
+dkms:
+ @sed -i -e '/^PACKAGE_VERSION=/ s/=.*/=\"$(DRIVER_VERSION)\"/' dkms.conf
+ @echo "$(DRIVER_VERSION)" >VERSION
+ @mkdir $(DKMS_ROOT_PATH)
+ @cp `pwd`/dkms.conf $(DKMS_ROOT_PATH)
+ @cp `pwd`/VERSION $(DKMS_ROOT_PATH)
+ @cp `pwd`/Makefile $(DKMS_ROOT_PATH)
+ @cp `pwd`/zenpower.c $(DKMS_ROOT_PATH)
+ @dkms add -m $(DRIVER) -v $(DRIVER_VERSION)
+ @dkms build -m $(DRIVER) -v $(DRIVER_VERSION)
+ @dkms install --force -m $(DRIVER) -v $(DRIVER_VERSION)
+ @modprobe $(DRIVER)
+
+dkms_clean:
+ @if [ ! -z "$(MODPROBE_OUTPUT)" ]; then \
+ rmmod $(DRIVER);\
+ fi
+ @dkms remove -m $(DRIVER) -v $(DRIVER_VERSION) --all
+ @rm -rf $(DKMS_ROOT_PATH)
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..dd75180c7bf
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Benjamin Maisonnas <ben at wainei dot net>
+# Author: Ondrej ńĆerman
+
+_pkgbase=zenpower
+pkgname=zenpower-dkms-git
+pkgver=6.56daa91
+pkgrel=1
+pkgdesc="Linux kernel driver for reading sensors for AMD Zen family CPUs"
+arch=('x86_64' 'i686')
+url="https://github.com/ocerman/zenpower"
+license=('GPL')
+depends=('make' 'gcc' 'linux' 'dkms')
+makedepends=('git' 'linux-headers')
+provides=('zenpower')
+
+source=("$_pkgbase::git+$url.git"
+ "Makefile"
+ "dkms.conf"
+ "$_pkgbase.conf")
+
+sha256sums=('SKIP'
+ 'f7f2c87bfed0d4a921d196948b77f9c9d75357b6c3396b72ad9eac9db1720580'
+ '9eb35ca8dcff02744dd3256238f22bfe6ebaf1636867aabed4c40a31073c4e1e'
+ '92c26ef5cd6f8a632f2d8cb12e9da8c4452cb0432ffe543733f13e67d6531d04')
+
+pkgver() {
+ cd "$srcdir/$_pkgbase"
+ printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ cd "$srcdir/$_pkgbase"
+}
+
+package() {
+ cd "$srcdir/$_pkgbase"
+
+ install -d "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/
+ cp -r ${srcdir}/${_pkgbase}/* "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/
+
+ install -Dm644 ${srcdir}/Makefile "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/Makefile
+ install -Dm644 ${srcdir}/dkms.conf "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf
+
+ sed -e "s/@_PKGBASE@/${_pkgbase}/" \
+ -e "s/@PKGVER@/${pkgver}/" \
+ -i "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf
+
+ install -Dm644 ${srcdir}/${_pkgbase}.conf "${pkgdir}"/usr/lib/depmod.d/${_pkgbase}.conf
+}
diff --git a/dkms.conf b/dkms.conf
new file mode 100644
index 00000000000..6200bb28dae
--- /dev/null
+++ b/dkms.conf
@@ -0,0 +1,7 @@
+PACKAGE_NAME="@_PKGBASE@"
+PACKAGE_VERSION="@PKGVER@"
+MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build modules"
+CLEAN="make clean"
+BUILT_MODULE_NAME[0]="@_PKGBASE@"
+DEST_MODULE_LOCATION[0]="/extramodules/kernel/drivers/hwmon"
+AUTOINSTALL="yes"
diff --git a/zenpower.conf b/zenpower.conf
new file mode 100644
index 00000000000..cba22a7ffc7
--- /dev/null
+++ b/zenpower.conf
@@ -0,0 +1,5 @@
+#
+# /usr/lib/depmod.d/zenpower.conf
+#
+
+search updates extramodules built-in