Reputation: 1337
I edited some parts of the 2.6.32.65 linux kernel and compiled it. the kernel compiles just fine and produces the bzImage as normal. however the make then continues as follows:
Kernel: arch/x86/boot/bzImage is ready. (#170)
Building modules, stage 2.
MODPOST 2414 modules.
ERROR: "external_page_start" [fs/cachefiles/cachefiles.ko] undefined!
ERROR: "variable_hash_start" [fs/cachefiles/cachefiles.ko] undefined!
There are two problem with that though.
first, these variables are defined in the header file include/linux/stthash.h
as follows:
extern unsigned long fixed_hash_start;
extern unsigned long variable_hash_start;
extern unsigned long external_page_start;
extern unsigned long command_space_start;
and in mm/page_alloc.c
they are defined as follows:
unsigned long fixed_hash_start;
unsigned long variable_hash_start;
unsigned long external_page_start;
unsigned long command_space_start;
and then they are assigned variables as needed. and they do pass compilation and create the bzImage
so I don't know what is wrong with that.
the second issue is that variable_hash_start
is not being used in any file in fs/cachefiles
, only external_page_start
is accessed (read from, not written to) in fs/cachefiles/rdrw.c
.
I don't know what is causing this error, I'm guessing the variables are not linked properly in cachefiles.ko
but I don't know how to fix that. any help?
Upvotes: 1
Views: 1072
Reputation: 1539
Dynamic Modules of Linux Kernel do not have access to the global variables and functions in kernel by default (except the functions in the headers). You need to specifically export it for modules.
EXPORT_SYMBOL
macro is the most used one. Also you can limit only GPL modules to access your variables and functions by exporting it with EXPORT_SYMBOL_GPL
.
For details: http://tuxthink.blogspot.in/2011/07/exporting-symbols-from-module.html
Upvotes: 3
Reputation: 1
Firstly, the error is encountered when building the kernel modules, which are generated independently of the main kernel image, thus an error in the modules will stop the compile but will still give you the bzImage.
Also, casual browsing of kernel 2.6.32.65 indicates the variables external_page_start and command_space_start don't exist in mm/page_alloc.c
However, you haven't told us what you modified, were those variables added by you?
In any case, including the right header file where you defined those variables will stop the undefined variable errors.
Upvotes: 0