-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (33 loc) · 758 Bytes
/
Makefile
File metadata and controls
46 lines (33 loc) · 758 Bytes
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
CONFIG_MODULE_SIG=n
BINARY := test_ramdisk
KERNEL := /lib/modules/$(shell uname -r)/build
ARCH := ${uname -m}
C_FLAGS := -Wall
KMOD_DIR := $(shell pwd)
TARGET_PATH := /lib/modules/$(shell uname -r)/kernel/drivers/char
OBJECTS := ramdisk.o
ccflags-y += $(C_FLAGS)
obj-m += $(BINARY).o
$(BINARY)-y := $(OBJECTS)
$(BINARY).ko:
make -C $(KERNEL) M=$(KMOD_DIR) modules
install:
cp $(BINARY).ko $(TARGET_PATH)
load:
modprobe $(BINARY)
remove:
rm $(TARGET_PATH)/$(BINARY).ko
unload:
rmmod -fv $(BINARY)
log:
echo "7 7" > /proc/sys/kernel/printk
dmesg -r | grep ramdisk
reset: clean remove unload
clean:
rm -f *.ko
rm -f *.o
rm -f *.test_*
rm -f .*.cmd
rm -f ramdisk.mod*
rm -f Module.symvers
rm -f modules.order