I'm trying to use dump_stack() so I tried a few hours to make dump_stack.ko but I could not make properly.
kesl@kesl-1080Ti:~/Downloads/trace$ make
Makefile:6: *** commands commence before first target. Stop.
watching this error all day... How can I fix it?
Ubuntu 20.04, Kernel 5.18.0-rc6, make 3.81
I have changed my make version 4.2.1 to 3.81 but the same problem happened. I also tried hello.c and same style Makefile but had same problem.
Here is my dump_stack.c and Makefile
1 #include <linux/module.h>
2 #include <linux/kernel.h>
3
4 static int myinit(void)
5 {
6 pr_info("dump_stack myinit\n");
7 dump_stack();
8 pr_info("dump_stack after\n");
9 return 0;
10 }
11
12 static void myexit(void)
13 {
14 pr_info("panic myexit\n");
15 }
16
17 module_init(myinit)
18 module_exit(myexit)
19 MODULE_LICENSE("GPL");
dump_stack.c
1 obj-m+= dump_stack.o
2
3 KERNEL_DIR = /lib/modules/$(shell uname -r)/build
4 PWD = $(shell pwd)
5
6 all:
7 $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
8
9 clean:
10 $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) clean
Makefile