Re: 'insmod error Invalid module format' upon an improper kernel source tree hierarchy?



On Sep 27, 7:51 pm, Doug Mitton <doug_mit...@xxxxxxxxxxxxx> wrote:
"lovecreatesbea...@xxxxxxxxx" <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.
]

You are getting lots of help here. This topic has been discussed in
the past as well. Here is a link to a thread where I posted a
skeleton 2.6.x module that I have been updating through several
different kernel versions.

Thank you.

I ever updated kernel successfully from 2.4 to 2.6 on Debian, but I
didn't realize that setting up kernel source tree for kernel module
programming needs to upgrade the existing running kernel to the
version of the new kernel source and boot using the new kernel.

.



Relevant Pages

  • Getting no sound from ALSA under 2.6.7
    ... I finally decided it was time to upgrade to the 2.6 kernel. ... Has anybody got ALSA working with the alsa-base and alsa-utils currently ... First I tried compiling most stuff into the kernel, ... hear a lot of noise on the speakers. ...
    (Debian-User)
  • Re: FreeBSD 5.1-Release freezes
    ... if I run with this kernel the ... > make installkernel KERNCONF=SOCKETD) ... Try compiling options MAC_DEBUG into your ... If you have DDB compiled into the kernel (which you probably will ...
    (freebsd-current)
  • Re: kernel prbs w/ext USB equip
    ... I guess I'll have to roll my own kernel, ... I don't do any compiling on Ubuntu so I don't know the package ... turn yet one more medium into a coaster. ... alan at linuxholdings dot co dot za ...
    (Ubuntu)
  • Re: [FreeBSD 5.3 STABLE/RC2] SMP crashes
    ... While compiling ATLAS library and working with some other applications, ... With SMP disabled, the box was now stable for over 7 days, also under heavy load. ... > I was in good luck taking the panic kernel report. ... > resetting SCSI bus! ...
    (comp.unix.bsd.freebsd.misc)
  • Crash with new bind/host cmds on -CURRENT (poss. runq_remove?)
    ... although I'm still compiling it for pentium by ... but the kernel I compiled on 21st ... I haven't included the config file ... but it's a fairly standard SMP ...
    (freebsd-current)