Skip to content

Commit 58a4337

Browse files
Pehrsonsrocallahan
authored andcommitted
Add DKMS support to zen_workaround kernel module Makefile
1 parent 95b6860 commit 58a4337

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
KERNELRELEASE ?= $(shell uname -r)
2+
KDIR := /lib/modules/$(KERNELRELEASE)/build
3+
4+
DKMS_NAME := zen_workaround
5+
DKMS_VERSION := 0.1
6+
DKMS_SOURCES := Makefile dkms.conf zen_workaround.c README
7+
18
obj-m = zen_workaround.o
29

310
all:
4-
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
11+
$(MAKE) -C $(KDIR) M=$(CURDIR) modules
512

613
signed: all
7-
sudo /lib/modules/$(shell uname -r)/build/scripts/sign-file sha512 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der zen_workaround.ko
14+
sudo $(KDIR)/scripts/sign-file sha512 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der zen_workaround.ko
815

916
clean:
10-
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
17+
$(MAKE) -C $(KDIR) M=$(CURDIR) clean
18+
19+
dkms-install:
20+
install -d /usr/src/$(DKMS_NAME)-$(DKMS_VERSION)
21+
install -m 0644 -t /usr/src/$(DKMS_NAME)-$(DKMS_VERSION) $(DKMS_SOURCES)
22+
-dkms add -m $(DKMS_NAME) -v $(DKMS_VERSION)
23+
dkms build $(DKMS_NAME)/$(DKMS_VERSION) --force
24+
dkms install $(DKMS_NAME)/$(DKMS_VERSION) --force
25+
26+
dkms-uninstall:
27+
-dkms remove $(DKMS_NAME)/$(DKMS_VERSION) --all
28+
rm -rf /usr/src/$(DKMS_NAME)-$(DKMS_VERSION)

third-party/zen-pmu-workaround/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ This has the same effect as `scripts/zen_workaround.py`, but persists after resu
55
There is no upstream, but we put it in third-party because it's technically a derived work of the Linux kernel. The license is GPL 2.0. See LICENSE at the root of this repo.
66

77
If you rely on Secure Boot, assuming you have properly enrolled a new MOK key, you can issue `make signed` to build and sign the kernel module (signature will trigger sudo prompt). It will use the default path of `/var/lib/shim-signed/mok/` for the key.
8+
9+
For a self-maintaining install that rebuilds across kernel upgrades, use DKMS: `sudo make dkms-install` (and `sudo make dkms-uninstall` to remove).
10+
11+
DKMS signing is a one-time system-wide setup. With a MOK key in place, configure DKMS by creating `/etc/dkms/framework.conf.d/mok-signing.conf` with:
12+
mok_signing_key="/var/lib/shim-signed/mok/MOK.priv"
13+
mok_certificate="/var/lib/shim-signed/mok/MOK.der"
14+
15+
Once configured, every DKMS module on the system (not just this one) will be signed with the enrolled MOK automatically.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MAKE="make"
2+
CLEAN="make clean"
3+
BUILT_MODULE_NAME=zen_workaround
4+
BUILT_MODULE_LOCATION=./
5+
PACKAGE_NAME=zen_workaround
6+
PACKAGE_VERSION=0.1
7+
DEST_MODULE_LOCATION=/kernel/drivers/misc
8+
AUTOINSTALL=yes

0 commit comments

Comments
 (0)