LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-12-2009, 02:38 PM   #1
pvpnguyen
Member
 
Registered: Mar 2006
Posts: 38

Rep: Reputation: 15
Kernel export symbol problem on Suse Enterprise Server 11.


Hello all,

I have 2 simple modules. The first one exports 2 functions and the second one uses those exported functions. These work perfectly on Redhat 5.0 or Suse Enterprise Server10 but not on Suse Enterprise Server 11.

In order to be able to compile the modules on Suse Enterprise Server 11, I do "make cloneconfig" then "make modules_prepare" in /usr/src/linux.

At first the kernel of Suse Enterprise 11 complains "invalid module format" when I insert the first module in using "insmod mod1.ko". so I recompile the modules using modversions (copy Module.symvers from /usr/src/linux-2.6.27.19-5-obj/i386/pae to /usr/src/linux and do "make" again). This time the first module loads OK but the second module does not load. The kernel displays these error messages:
"insmod: error inserting 'mod2.ko': -1 Unknown symbol in module"
"mod2: no symbol version for export1"
"mod2: Unknown symbol export1"

My questions are: does the way to export symbol change in kernel version 2.6.26 and later (SuSe Enterprise server has kernel 2.6.27)? Is there an extra step to prepare for compiling kernel module (usually I do "make cloneconfig" then "make modules_prepare" in /usr/src/linux)? Is there anyone out there that ran into this problem before? Is there a solution for this? The source files are shown below.

Your help is greatly appreciated. Thank you.

/***********/
/* module1.c */
/***********/

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE ("Proprietary");

void export1(void);
void export2(void);

static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}

void export1(void)
{
printk(KERN_ALERT "Hello, there\n");
}

void export2(void)
{
printk(KERN_ALERT "Poor you, goodbye\n");
}

EXPORT_SYMBOL(export1);
EXPORT_SYMBOL(export2);

module_init(hello_init);
module_exit(hello_exit);

/********************/
/* Makefile of module1.c */
/********************/
EXTRA_CFLAGS += -DMODVERSIONS

KVERSION = $(shell uname -r)
KDIR = /usr/src/linux

obj-m += mod1.o
mod1-objs := module1.o

all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean

/***********/
/* module2.c */
/***********/
#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE ("Proprietary");

extern void export1(void);
extern void export2(void);


static int hello_init(void)
{
export1();
return 0;
}
static void hello_exit(void)
{
export2();
}

module_init(hello_init);
module_exit(hello_exit);

/********************/
/* Makefile of module2.c */
/********************/
EXTRA_CFLAGS += -DMODVERSIONS

KVERSION = $(shell uname -r)
KDIR = /usr/src/linux

obj-m += mod2.o
mod2-objs := module2.o

all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean

Last edited by pvpnguyen; 08-14-2009 at 02:39 PM.
 
Old 08-18-2009, 10:42 AM   #2
pvpnguyen
Member
 
Registered: Mar 2006
Posts: 38

Original Poster
Rep: Reputation: 15
Hello all, when I copy the Module.symvers(contains the info of exported symbols), generated when building the first module, to the directory of the second module and build the second module again. Then the second module can load into the kernel of Suse Enterprise Server 11. Am I doing the right thing? Is this a new way of exporting the symbols from a module? Thanks.

Last edited by pvpnguyen; 08-18-2009 at 10:45 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How does one export a symbol from a module built outside the kernel source tree? opsimath Linux - Kernel 3 09-15-2011 10:56 AM
export symbol problem in 2.6.27 sucheta Linux - Kernel 0 01-15-2009 09:19 AM
Xen-suse enterprise server problem 1wfycoas SUSE / openSUSE 4 05-08-2007 08:03 PM
Need kernel for Suse 9.0 Enterprise Server +Yan SUSE / openSUSE 4 09-14-2006 08:28 PM
export symbol from module to kernel dogalmity Programming 0 06-05-2006 04:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration