I cross-compile gator on host use
make -C /home/emel/arm-project/linux-kernel/kernel M=`pwd` ARCH=arm64 CROSS_COMPILE=/opt/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- GATOR_WITH_MALI_SUPPORT=MALI_MIDGARD MALI_DIR_MIDGARD=/home/emel/arm-project/linux-kernel/kernel/drivers/gpu/arm/midgard/ modules
the errors follow:
make: Entering directory '/home/emel/arm-project/linux-kernel/kernel' CC [M] /home/emel/arm-project/gator/driver/gator_main.oIn file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'report_trace':/home/emel/arm-project/gator/driver/gator_backtrace.c:64:33: error: 'struct module' has no member named 'module_core' (unsigned long)mod->module_core;
In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'report_trace':/home/emel/arm-project/gator/driver/gator_backtrace.c:64:33: error: 'struct module' has no member named 'module_core' (unsigned long)mod->module_core; ^/home/emel/arm-project/gator/driver/gator_backtrace.c: In function 'kernel_backtrace':/home/emel/arm-project/gator/driver/gator_backtrace.c:105:21: warning: passing argument 1 of 'walk_stackframe' from incompatible pointer typeerror, forbidden warning:gator_backtrace.c:105 walk_stackframe(&frame, report_trace, &depth); ^In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0, from /home/emel/arm-project/gator/driver/gator_main.c:270:./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'struct task_struct *' but argument is of type 'struct stackframe *' extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame, ^In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:/home/emel/arm-project/gator/driver/gator_backtrace.c:105:29: warning: passing argument 2 of 'walk_stackframe' from incompatible pointer typeerror, forbidden warning:gator_backtrace.c:105 walk_stackframe(&frame, report_trace, &depth); ^In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0, from /home/emel/arm-project/gator/driver/gator_main.c:270:./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'struct stackframe *' but argument is of type 'int (*)(struct stackframe *, void *)' extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame, ^In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:/home/emel/arm-project/gator/driver/gator_backtrace.c:105:43: warning: passing argument 3 of 'walk_stackframe' from incompatible pointer typeerror, forbidden warning:gator_backtrace.c:105 walk_stackframe(&frame, report_trace, &depth); ^In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0, from /home/emel/arm-project/gator/driver/gator_main.c:270:./arch/arm64/include/asm/stacktrace.h:31:13: note: expected 'int (*)(struct stackframe *, void *)' but argument is of type 'int *' extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame, ^In file included from /home/emel/arm-project/gator/driver/gator_main.c:270:0:/home/emel/arm-project/gator/driver/gator_backtrace.c:105:5: error: too few arguments to function 'walk_stackframe' walk_stackframe(&frame, report_trace, &depth); ^In file included from /home/emel/arm-project/gator/driver/gator_backtrace.c:34:0, from /home/emel/arm-project/gator/driver/gator_main.c:270:./arch/arm64/include/asm/stacktrace.h:31:13: note: declared here extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame, ^scripts/Makefile.build:277: recipe for target '/home/emel/arm-project/gator/driver/gator_main.o' failedmake[1]: *** [/home/emel/arm-project/gator/driver/gator_main.o] Error 1Makefile:1474: recipe for target '_module_/home/emel/arm-project/gator/driver' failedmake: *** [_module_/home/emel/arm-project/gator/driver] Error 2make: Leaving directory '/home/emel/arm-project/linux-kernel/kernel'
I read source code gator_backtrace.c:
60 if (mod) { 61 cookie = get_cookie(cpu, current, mod->name, false); 62 addr = addr - 63 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) 64 (unsigned long)mod->module_core; 65 #else 66 (unsigned long)mod->core_layout.base; 67 #endif 68 } 69 else { 70 cookie = NO_COOKIE; 71 } 72 #endif
...
102 #if defined(__aarch64__) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)103 walk_stackframe(current, &frame, report_trace, &depth);104 #else105 walk_stackframe(&frame, report_trace, &depth);106 #endif
so is it because linux kernel version not match ?
so I change KERNEL_VERSION(4, 5, 0) instead of KERNEL_VERSION(4, 4, 0)
It can make successfully.
after that i copy gator.ko to rk3399 and insmod .but fail.
unknown symbol in module .
dmesg: unknown symbol walk_stackframe(err 0)
so do I make some mistake with my operation above ? shold I change KERNEL_VERSION(4, 5, 0) ? or where is walk_stackframe ?
thanks very much!
Hi
It looks like you are using a kernel with changes backported from a later version. To start with changing the version macros from KERNEL_VERSION(4, 5, 0) to KERNEL_VERSION(4, 4, 0) is correct.
Given that your build compiles I would suggest checking the kernel you are using matches the one you are compiling against and that it exports walk_stackframe (which is defined https://elixir.bootlin.com/linux/v4.4.154/source/arch/arm64/kernel/stacktrace.c ).