Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- From: Janaka <janakas@xxxxxxxxxxxx>
- Date: Wed, 26 Sep 2007 17:31:15 -0700
lovecreatesbea...@xxxxxxxxx wrote:
Hello experts,
I fail again at catching the concept of Linux 'kernel source tree' and
compiling a 'hello world' module successfully. Can you please help me
again? Thank you for your time.
I'm running a debian-40r1 (kernel 2.6.18) and got a copy of kernel
source linux-2.6.22.6.tar.bz2 from kernel.org. The version numbers of
the running kernel and the kernel source aren't exact the same, and
I'm aware of the minor difference. Will this be a problem if I don't
boot with the newly compiled kernel of 2.6.22.6.
After built the kernel source and a `hello world' module, I really
encountered a problem of `error inserting 'hellomod.ko': -1 Invalid
module format' when executed insmod.
The followings are main steps of kernel source building:
1. untar kernel source linux-2.6.22.6.tar.bz2 in my home directory.
And nothing added at /usr/src/linux. Will this be a problem?
2. su root -c 'make defconfig'
3. su root -c 'make'
4. su root -c 'make modules_install install'
Now the object files of the kernel source are all generated, those
object files are what customized kernel module programming needed, so
I just stopped here.
Do the above steps build a kernel source tree hierarchy properly,
since I didn't do the following steps '5*'.
[
5* I didn't do 'make bzImage' and didn't add corresponding entries
for the newly built kernel in GRUB or LILO.
]
First of all it is highly recommended that you use your current kernel
configuration as the basis for your new kernel configuration, if you
have a running linux system that you are happy with. It still will
work (in most cases) if the kernel you are compiling is newer than the
one that you are running. Most Debian based distributions have the
kernel configuration file in the /boot directory (eg:
config-2.6.15-26-386). Using "menuconfig" (or any other graphical
config) you can load an old configuration as the basis and change the
kernel config as need be. Then save on exit. Now you have a
configuration that closely resemble your current running linux box.
Secondly If you are using a Debian based distribution (eg:
Ubuntu, ...) use the Debian kernel compile helper tool "make-kpkg" to
create a debian package, and install that package. That is the safest
method. There is a good tutorial in
http://www.falkotimme.com/howtos/debian_kernel2.6_compile/
Thirdly kernel you are running must be the same version as your module
is compiled for.
.
- Follow-Ups:
- Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- From: lovecreatesbea...@xxxxxxxxx
- Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- References:
- 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- From: lovecreatesbea...@xxxxxxxxx
- 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- Prev by Date: Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- Next by Date: Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- Previous by thread: Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- Next by thread: Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?
- Index(es):
Relevant Pages
|
|