Skip to contentSkip to conversation

Newbie: added function not visible

DISCUSSION Genadz Batsyan 3 participants 3 messages Jun 29, 2005

lore
Share & tools
lore
#0 lore raw

I'm desperate, please help, if I'm missing something obvious.

I am trying to add a function to the file drivers/char/keyboard.c and then be able to call this function from my kernel module

adding the function to keyboard.c, recompiling and booting with kernel results /proc/kallsyms telling me that my function exists with the tag 'T', which I think is ok

In my module I simply declare the function's prototype and use it.

When trying to compile the module, modpost tells that the function's symbol is not found. (insmodding results in error too)

I don't get it, WHY tha heck can it find all the other stuff and what makes this new function different? I have read that 2.6 kernel exports any non-static symbols.

Regards!

#1 lore raw
Quoted 3 lines · Genadz Batsyan

adding the function to keyboard.c, recompiling and booting with kernel results /proc/kallsyms telling me that my function exists with the tag 'T', which I think is ok

You need to EXPORT_SYMBOL your new function.

For example,

	/* My pet dog is an idiot */
	void beat_dog(struct dog *d)
	{
		/* ... */
	}
	EXPORT_SYMBOL(beat_dog);

Good luck,

Robert Love

#2 lore raw
In reply to Genadz Batsyan

On Wed, 29 Jun 2005 18:59:04 +0200 Genadz Batsyan wrote:

| I'm desperate, please help, if I'm missing something obvious.
| 
| I am trying to add a function to the file drivers/char/keyboard.c
| and then be able to call this function from my kernel module
| 
| adding the function to keyboard.c, recompiling and booting with kernel
| results  /proc/kallsyms telling me that my function exists with the tag 'T',
| which I think is ok

also add:
EXPORT_SYMBOL(new_symbol); /* whatever the new entry point is */

That makes it visible to modules.

| In my module I simply declare the function's prototype and use it.
| 
| When trying to compile the module, modpost tells that the function's symbol
| is not found. (insmodding results in error too)
| 
| I don't get it, WHY tha heck can it find all the other stuff and 
| what makes this new function different? I have read that 2.6 kernel exports
| any non-static symbols.

---
~Randy