Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while building memguard module for arm based processors #3

Closed
moshah opened this issue Apr 17, 2017 · 5 comments
Closed

Issue while building memguard module for arm based processors #3

moshah opened this issue Apr 17, 2017 · 5 comments

Comments

@moshah
Copy link

moshah commented Apr 17, 2017

Hi,

I am trying to test the memguard module for arm based board like Raspberry Pi 3 board and i.MX6QP board, but while compiling the module I get an error file "asm/idle.h" not found. I searched it in the respective directory, I found that it was not there, What procedure or what changes I must make in memguard.c file so that I can get a kernel module for arm based processors.

Kernel Version I am using is 4.4.35
Its really very important for me, kindly help me out regarding this issue.

Thanks in advance.

@systempanda200
Copy link

asm/idle.h is likely a header in Linux source code.
You may like to check if the kernel you are using has been installed successfully and the kernel headers includes this file.

@moshah
Copy link
Author

moshah commented Apr 17, 2017

Hi,
I have installed the kernel successfully but it is not present in arch/arm/include/asm/ directory it is present in arch/x86/include/asm/ directory, I think it is architecture based file.

@moshah
Copy link
Author

moshah commented Apr 18, 2017

Hi,
The error I am getting is like this:
make -C /lib/modules/4.4.35-rt43/build M=/home/root/memguard-release modules
make[1]: Entering directory '/usr/src/kernel'
make[1]: Warning: File 'scripts/Makefile.extrawarn' has modification time 6455574 s in the future
make[2]: Warning: File 'scripts/Makefile.lib' has modification time 6455573 s in the future
CC [M] /home/root/memguard-release/memguard.o
/home/root/memguard-release/memguard.c:210:22: error: expected '=', ',', ';', 'asm' or 'attribute' before 'memguard_cpu_callback'
static int __cpuinit memguard_cpu_callback(struct notifier_block *nfb,
^
/home/root/memguard-release/memguard.c:228:44: error: expected '=', ',', ';', 'asm' or 'attribute' before 'memguard_cpu_notifier'
static struct notifier_block __cpuinitdata memguard_cpu_notifier =
^
/home/root/memguard-release/memguard.c: In function 'memguard_control_show':
/home/root/memguard-release/memguard.c:961:7: warning: unused variable 'buf' [-Wunused-variable]
char buf[64];
^
In file included from ./arch/arm/include/asm/cpu.h:14:0,
from ./arch/arm/include/asm/smp_plat.h:11,
from ./arch/arm/include/asm/irq_work.h:4,
from include/linux/irq_work.h:46,
from /home/root/memguard-release/memguard.c:28:
/home/root/memguard-release/memguard.c: In function 'init_module':
/home/root/memguard-release/memguard.c:1468:28: error: 'memguard_cpu_notifier' undeclared (first use in this function)
register_hotcpu_notifier(&memguard_cpu_notifier);
^
include/linux/cpu.h:258:48: note: in definition of macro 'register_hotcpu_notifier'
#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
^
/home/root/memguard-release/memguard.c:1468:28: note: each undeclared identifier is reported only once for each function it appears in
register_hotcpu_notifier(&memguard_cpu_notifier);
^
include/linux/cpu.h:258:48: note: in definition of macro 'register_hotcpu_notifier'
#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
^
/home/root/memguard-release/memguard.c: In function 'cleanup_module':
/home/root/memguard-release/memguard.c:1529:30: error: 'memguard_cpu_notifier' undeclared (first use in this function)
unregister_hotcpu_notifier(&memguard_cpu_notifier);
^
include/linux/cpu.h:260:50: note: in definition of macro 'unregister_hotcpu_notifier'
#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
^
/home/root/memguard-release/memguard.c: At top level:
/home/root/memguard-release/memguard.c:1381:30: warning: 'memguard_idle_nb' defined but not used [-Wunused-variable]
static struct notifier_block memguard_idle_nb = {
^
scripts/Makefile.build:264: recipe for target '/home/root/memguard-release/memguard.o' failed
make[2]: *** [/home/root/memguard-release/memguard.o] Error 1
Makefile:1405: recipe for target 'module/home/root/memguard-release' failed
make[1]: *** [module/home/root/memguard-release] Error 2
make[1]: Leaving directory '/usr/src/kernel'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

Please help me out regarding this.
Thank in advance.

@heechul
Copy link
Owner

heechul commented Apr 19, 2017

I pushed a small change (removing __cpuinit and __cpuinitdata), which should fix the compilation problem.

@heechul heechul closed this as completed Apr 19, 2017
@moshah
Copy link
Author

moshah commented Apr 19, 2017

Respected Mr. Heechul Yun,

The compilation of the module was successful, but it shows warning as follows:

make -C /lib/modules/4.4.35-rt43/build M=/home/root/memguard-release modules
make[1]: Entering directory '/usr/src/kernel'
make[1]: Warning: File 'scripts/Makefile.extrawarn' has modification time 6455816 s in the future
make[2]: Warning: File 'scripts/Makefile.lib' has modification time 6455816 s in the future
CC [M] /home/root/memguard-release/memguard.o
make[2]: warning: Clock skew detected. Your build may be incomplete.
Building modules, stage 2.
make[2]: Warning: File 'scripts/Makefile.lib' has modification time 6455813 s in the future
MODPOST 1 modules

WARNING: "idle_notifier_unregister" [/home/root/memguard-release/memguard.ko] undefined!
WARNING: "idle_notifier_register" [/home/root/memguard-release/memguard.ko] undefined!

CC /home/root/memguard-release/memguard.mod.o
LD [M] /home/root/memguard-release/memguard.ko
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[1]: warning: Clock skew detected. Your build may be incomplete.
make[1]: Leaving directory '/usr/src/kernel'

When I tried to load the module it shows
root@raspberrypi3:~/memguard-release# insmod memguard.ko
insmod: ERROR: could not insert module memguard.ko: Unknown symbol in module

dmeg shows:
[ 703.782738] memguard: Unknown symbol idle_notifier_register (err 0)
[ 703.783098] memguard: Unknown symbol idle_notifier_unregister (err 0)

Kindly help me out regarding this issue, Thanks a lot in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants