Welcome! Log In Create A New Profile

Advanced

Simple module doesn't compile in FC9 anymore

Posted by bruno 
After having installed FC9 (2.6.25.14) and installing the kernel tree I can't compile even the simplest of modules anymore
(I did this before in FC7 without any problems).
Basically I get an ... Module.symvers is missing ... error.
I tried to reinstall and re-prepare the kernel source tree, but to no avail.
See details below: 1) = compiling the module, 2) = installing + preparing kernel source tree, 3) = content of hello.c, 4) = content of Makefile

Can anybody help me, this would be greatly appreciated ... !

1) Compiling the module

[root@cosmos dev]# ls -l
total 12
drwxr-xr-x 2 root root 4096 2008-09-11 20:29 data
-rw-r--r-- 1 root root 339 2008-09-11 21:10 hello.c
-rw-r--r-- 1 root root 18 2008-09-11 21:11 Makefile
[root@cosmos dev]# make -C /usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686 M=`pwd` modules
make: Entering directory `/usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686'

WARNING: Symbol version dump /usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686/Module.symvers
is missing
; modules will have no dependencies and modversions.

CC [M] /root/dev/hello.o
Building modules, stage 2.
MODPOST 1 modules
/bin/sh: scripts/mod/modpost: No such file or directory
make[1]: *** [__modpost] Error 127
make: *** [modules] Error 2
make: Leaving directory `/usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686'
[root@cosmos dev]

2) Installing kernel source tree

Before compiling, I installed the kernel tree as described in the FC9 personal documentation manual:

[root@cosmos data]# rpm -ivh kernel-2.6.25-14.fc9.src.rpm
[root@cosmos linux-2.6.25.i686]# rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel.spec
[root@cosmos linux-2.6.25.i686]# make oldconfig && make prepare

..........
.config:53:warning: trying to assign nonexistent symbol PREEMPT_BKL
.config:79:warning: trying to assign nonexistent symbol PCIEASPM
.config:80:warning: trying to assign nonexistent symbol PCIEASPM_DEBUG
.config:205:warning: trying to assign nonexistent symbol MTD_PNC2000
.config:332:warning: trying to assign nonexistent symbol BLK_DEV_RAM_BLOCKSIZE
.config:372:warning: trying to assign nonexistent symbol IDEPCI_SHARE_IRQ
.config:396:warning: trying to assign nonexistent symbol PDC202XX_BURST
.config:590:warning: trying to assign nonexistent symbol SCSI_SEAGATE
..........

[root@cosmos dev]

3) hello.c content

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

static int __init hello_init(void)
{
printk(KERN_WARN "Hello world\n"winking smiley;
return 0;
}

static void __exit hello_exit(void)
{
printk(KERN_WARN "Goodbye\n"winking smiley;
}

module_init(hello_init);
module_exit(hello_exit);

4) Makefile content
obj-m += hello.o
Re: Simple module doesn't compile in FC9 anymore
September 15, 2008 05:11AM
Hello,

Missed Module.symvers is not actually a problem. The real "problem" is "scripts/mod/modpost: No such file or directory ".
In order to fix the issue, go to your kernel source directory and run:
make scripts
This could generate scripts/mod/modpost file in the result. Then try to build your module once again.
Hi Astarta,

First of all thanks for your reply.

1) I ran : make scripts and recompiled the module.
Now the hello.ko was generated but I still had a warning concerning a missing Module.symvers file.

2) Now I ran plain "make".
After this, recompiling the module didn't produce any Module.symvers errors.
(and the Module.symvers file was actually generated in <rootdir>winking smiley.

So, no compiling errors anymore but now I run into the following after inserting the module:
[root@cosmos dev]# make -C /usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686 M=`pwd` modules
make: Entering directory `/usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686'
CC [M] /root/dev/hello.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] /root/dev/hello.ko
make: Leaving directory `/usr/src/redhat/BUILD/kernel-2.6.25/linux-2.6.25.i686'
[root@cosmos dev]# insmod hello.ko
insmod: error inserting 'hello.ko': -1 Invalid module format
[root@cosmos dev]#


Strange because the version of the kernel source tree used matches the installed kernel version.

Any advice ?
Re: Simple module doesn't compile in FC9 anymore
September 17, 2008 11:34AM
can you show me your output from the below command right after you try to load the module and it fails:
dmesg | tail

dmesg should show you the reason why insmod cant load the module. possible reasons could be kernel config/kernel sources/gcc version mismatch or smth like. dmesg will give us a clue smiling smiley
Hi Astarta,
Last night the problem was solved after recompiling and booting with the new kernel.
Apparently things changed between FC7 and FC9, in FC7 I never recompiled the kernel before being able to compile/install kernel modules
(I just made sure the kernel source tree was installed).

Anyway, thanks for your attention and your replies !
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 2 plus 8?
Message: