0

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

haccks
  • 104,019
  • 25
  • 176
  • 264
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137

1 Answers1

1

@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.

Gautham Kantharaju
  • 1,735
  • 1
  • 21
  • 24