I wrote a simple Linux kernel module:
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/reboot.h>
static int my_init(void)
{
machine_power_off();
return 0;
}
static void my_exit(void)
{
return;
}
module_init(my_init);
module_exit(my_exit);
Source compiled successfully but after installing the module ( insmod
) the following error occurred:
Error: could not insert module my_module.ko: Unknown symbol in module
System log error:
Jun 25 21:50:00 my-virtual-machine kernel: [31625.207827] my_module: Unknown symbol machine_power_off (err 0)
How do I solve this error?
machine_power_off:
@Amir遍历linux内核中的文件,其中使用了machine_power_off()的所有体系结构文件均未导出,因此无法在您的模块中使用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.