Question

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:

http://lxr.free-electrons.com/ident?i=machine_power_off

Was it helpful?

Solution

@Amir, traversed through the files in the linux kernel, w.r.t. all the architecture files where machine_power_off() is used, it is not exported so cannot be used in your module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top