-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
33 lines (27 loc) · 1.01 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
TARGET_MODULE:=srandom
obj-m += $(TARGET_MODULE).o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
load:
insmod ./$(TARGET_MODULE).ko
unload:
rmmod $(TARGET_MODULE).ko
install:
mkdir -p /lib/modules/$(shell uname -r)/kernel/drivers/$(TARGET_MODULE)
install -m 644 ./$(TARGET_MODULE).ko /lib/modules/$(shell uname -r)/kernel/drivers/$(TARGET_MODULE)
install -m 644 ./11-$(TARGET_MODULE).rules /etc/udev/rules.d/
install -m 755 ./$(TARGET_MODULE) /usr/bin/$(TARGET_MODULE)
install -m 644 ./$(TARGET_MODULE).conf /etc/modules-load.d/
depmod
udevadm trigger
@echo "Install Success."
uninstall:
rm -f /lib/modules/$(shell uname -r)/kernel/drivers/$(TARGET_MODULE)/$(TARGET_MODULE).ko
rm -f /etc/udev/rules.d/11-$(TARGET_MODULE).rules
rm -f /etc/modules-load.d/$(TARGET_MODULE).conf
depmod
rm -f /usr/bin/$(TARGET_MODULE)
@test -c /dev/srandom|| echo "Reboot required to complete uninstall."
@echo "Uninstalled."