On Mon, Mar 23, 2020 at 11:27:50AM +0100, Tomek The Messenger wrote:
Hi When I insert external kernel module which is compiled out of tree I got error:
root:/run# insmod ./my_module.ko [ 137.443823] my_module: Unknown symbol reboot_mode (err 0)
I investigated that I have attached in my my_module.c file: #include <linux/reboot.h> and in this file we have: extern enum reboot_mode reboot_mode; However reboot_mode symbol is not exported with macro EXPORT_SYMBOL_GPL. Probably this is the reason why symbol is not seen in my module.
That is correct.
Then why the same issue doesn't occur here: /arch/arm/kernel/setup.c /arch/arm64/kernel/process.c Those linux files also use global variable reboot_mode.
Because those files are not built as a kernel module, but rather directly into the kernel image. hope this helps, greg k-h