-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (27 loc) · 1.22 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
GET_PID_INFO_SOURCES = get_pid_info.c
TEST_PID_INFO_OBJS = test_pid_info.c
LINUX_SRC ?= /usr/src/linux
all: test-pid-info setup-kernel
setup-kernel:
mkdir -p $(LINUX_SRC)/get_pid_info
cp $(GET_PID_INFO_SOURCES) $(LINUX_SRC)/get_pid_info/get_pid_info.c
echo "obj-y := get_pid_info.o" > $(LINUX_SRC)/get_pid_info/Makefile
grep "get_pid_info" $(LINUX_SRC)/arch/x86/entry/syscalls/syscall_64.tbl || echo "350 common get_pid_info sys_get_pid_info" >> $(LINUX_SRC)/arch/x86/entry/syscalls/syscall_64.tbl
grep "get_pid_info" $(LINUX_SRC)/Makefile || sed -i "/^core-y\s*+=/ s/$$/ get_pid_info\//" $(LINUX_SRC)/Makefile
#zcat /proc/config.gz > $(LINUX_SRC)/.config
make -j8 -C $(LINUX_SRC)
cp $(LINUX_SRC)/arch/x86_64/boot/bzImage /boot/vmlinuz-process_and_memory
cp $(LINUX_SRC)/System.map /boot/System.map-process_and_memory
reboot
test-pid-info: $(TEST_PID_INFO_OBJS)
$(CC) -o test-pid-info $(TEST_PID_INFO_OBJS)
clean:
sed -i "s/ get_pid_info\///g" $(LINUX_SRC)/Makefile
sed -i '/get_pid_info/ d' $(LINUX_SRC)/arch/x86/entry/syscalls/syscall_64.tbl
rm -rf $(LINUX_SRC)/get_pid_info
rm -f test-pid-info.o
fclean: clean
rm test-pid-info
make -C $(LINUX_SRC) mrproper
re: fclean all
.PHONY: all setup-kernel-module clean fclean re