-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (33 loc) · 933 Bytes
/
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
TARGET := selective_drop_caches
obj-m += $(TARGET).o
CFLAGS_$(TARGET).o = -O0
KERNEL_SRC ?= ~/src/linux-2.6
SSH = ssh -p2222 root@localhost
all:
make -C $(KERNEL_SRC) M=$(PWD) modules
clean:
make -C $(KERNEL_SRC) M=$(PWD) clean
deliver:
scp -P2222 selective_drop_caches.ko root@localhost:~/
kernel_deliver:
scp -P2222 $(KERNEL_SRC)/arch/x86_64/boot/bzImage root@localhost:/boot/vmlinuz-3.16-amd64
qemu:
kvm -s -m 512 -hda ../debian.img -redir tcp:2222::22 &
ssh:
$(SSH)
RMMOD = $(SSH) rmmod $(TARGET).ko
INSMOD = $(SSH) insmod $(TARGET).ko
insmod:
$(INSMOD)
rmmod:
$(RMMOD)
COMMAND = $(SSH) cat /sys/module/selective_drop_caches/sections/
TEXT := $(COMMAND).text
DATA := $(COMMAND).data
BSS := $(COMMAND).bss
gdb: insmod
gdb $(KERNEL_SRC)/vmlinux -ex "target remote localhost:1234" -ex \
"add-symbol-file ./$(TARGET).ko $$($(TEXT)) -s .data $$($(DATA)) -s .bss $$($(BSS))"
$(RMMOD)
reboot:
$(SSH) reboot