summaryrefslogtreecommitdiffstats
path: root/runtime/probes/test4/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/probes/test4/Makefile')
-rw-r--r--runtime/probes/test4/Makefile22
1 files changed, 17 insertions, 5 deletions
diff --git a/runtime/probes/test4/Makefile b/runtime/probes/test4/Makefile
index 613eff1f..8b973baa 100644
--- a/runtime/probes/test4/Makefile
+++ b/runtime/probes/test4/Makefile
@@ -1,11 +1,23 @@
# Makefile
-#
-#
-# make -C path/to/kernel/src M=`pwd` modules STP_RUNTIME=path_to_systemtap_rt
+
+PWD := $(shell pwd)
+KVERSION := $(shell uname -r)
+KDIR := /lib/modules/$(KVERSION)/build include
+
+KALLSYMS_LOOKUP_NAME := $(firstword $(shell grep " kallsyms_lookup_name" /boot/System.map-$(KVERSION)))
+KALLSYMS_LOOKUP := $(firstword $(shell grep " kallsyms_lookup$$" /boot/System.map-$(KVERSION)))
+KTA := $(firstword $(shell grep "__kernel_text_address" /boot/System.map-$(KVERSION)))
CFLAGS += -I $(STP_RUNTIME) -I $(STP_RUNTIME)/relayfs -D KALLSYMS_LOOKUP_NAME=$(KALLSYMS_LOOKUP_NAME) \
- -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP) -D KTA=$(KTA)
-obj-m := dtr.o
+ -D KALLSYMS_LOOKUP=$(KALLSYMS_LOOKUP)
+
+obj-m := test4.o
+
+default:
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules \
+ KALLSYMS_LOOKUP_NAME=0x$(KALLSYMS_LOOKUP_NAME) \
+ KALLSYMS_LOOKUP=0x$(KALLSYMS_LOOKUP) KTA=0x$(KTA)\
+ STP_RUNTIME=$(PWD)/../..
clean:
/bin/rm -rf *.o *.ko *~ *.mod.c .*.cmd .tmp_versions