-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·62 lines (48 loc) · 1.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
MOD := ryzen_smu
VERSION := 0.1.5
TARGET := $(shell uname -r)
DKMS_ROOT_PATH := /usr/src/$(MOD)-$(VERSION)
KERNEL_MODULES := /lib/modules/$(TARGET)
ifneq ("","$(wildcard /usr/src/linux-headers-$(TARGET)/*)")
KERNEL_BUILD := /usr/src/linux-headers-$(TARGET)
else
ifneq ("","$(wildcard /usr/src/kernels/$(TARGET)/*)")
KERNEL_BUILD := /usr/src/kernels/$(TARGET)
else
KERNEL_BUILD := $(KERNEL_MODULES)/build
endif
endif
obj-m := $(MOD).o
$(MOD)-objs := drv.o smu.o
.PHONY: all modules clean dkms-install dkms-uninstall insmod checkmod
all: modules
debug:
@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) ccflags-y+=-DDEBUG modules
modules:
@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) modules
clean:
@$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) clean
rm -rf *.o
dkms-install:
mkdir -p $(DKMS_ROOT_PATH)
cp $(CURDIR)/dkms.conf $(DKMS_ROOT_PATH)
cp $(CURDIR)/Makefile $(DKMS_ROOT_PATH)
cp $(CURDIR)/*.c $(DKMS_ROOT_PATH)
cp $(CURDIR)/*.h $(DKMS_ROOT_PATH)
sed -e "s/@CFLGS@/${MCFLAGS}/" \
-e "s/@VERSION@/$(VERSION)/" \
-i $(DKMS_ROOT_PATH)/dkms.conf
dkms add ryzen_smu/$(VERSION)
dkms build ryzen_smu/$(VERSION)
dkms install ryzen_smu/$(VERSION)
dkms-uninstall:
dkms remove ryzen_smu/$(VERSION) --all
rm -rf $(DKMS_ROOT_PATH)
insmod:
sudo rmmod $(MOD).ko; true
sudo insmod $(MOD).ko
checkmod:
lsmod | grep $(MOD)
cat /proc/modules | grep $(MOD)
cat /sys/kernel/$(MOD)_drv/drv_version
modinfo $(MOD)