-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (36 loc) · 1.62 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
# For Kbuild to include header files
# https://unix.stackexchange.com/questions/18143/how-to-include-local-header-files-in-linux-kernel-module
# EXTRA_CFLAGS := -I$(src)/src/inc
# EXTRA_CFLAGS= -Wvla
# Define output module
obj-m += virgin_kernel_module.o
obj-m += normie_kernel_module.o
obj-m += gigachad_kernel_module.o
PWD := $(CURDIR)
# Build modules
all:
@echo "====== BUILD MODULES BEGIN ====="
@make -C /lib/modules/$$(uname -r)/build M=$(PWD) modules
@echo "======= BUILD MODULES END ======"
# Install built modules with sudo
install:
@echo "====== LOAD MODULES BEGIN ====="
cat /proc/modules | grep virgin_kernel_module || sudo insmod virgin_kernel_module.ko
cat /proc/modules | grep normie_kernel_module || sudo insmod normie_kernel_module.ko chad_level=1
cat /proc/modules | grep gigachad_kernel_module || sudo insmod gigachad_kernel_module.ko chad_level=69 sha256_length=32
@echo "======= LOAD MODULES END ======"
@echo "====== LOADED MODULES SHOW BEGIN ====="
@cat /proc/kallsyms | grep --color -E "(virgin|normie|gigachad)_kernel_module"
@echo "======= LOADED MODULES SHOW END ======"
# Uninstall modules with sudo
uninstall:
@echo "====== UNLOAD MODULES BEGIN ====="
cat /proc/modules | grep virgin_kernel_module && sudo rmmod virgin_kernel_module.ko
cat /proc/modules | grep normie_kernel_module && sudo rmmod normie_kernel_module.ko
cat /proc/modules | grep gigachad_kernel_module && sudo rmmod gigachad_kernel_module.ko
@echo "======= UNLOAD MODULES END ======"
# Clean built modules
clean:
@echo "====== CLEAN BEGIN ====="
@make -C /lib/modules/$$(uname -r)/build M=$(PWD) clean
@echo "======= CLEAN END ======"