[clug] Building modules

Daniel Pittman daniel at rimspace.net
Tue Jul 13 08:10:23 MDT 2010

"Brett Wheeler" <Brett.Wheeler at daramalan.act.edu.au> writes:

> First thing... I'm a noob, please be gentle with me.
> I have been given the task of compiling a module (network driver) for our
> imaging software.

Wow.  Your boss is kind of mean, doing that.  This is a reasonably advanced
task, with lots of sharp corners.

> The version of Linux that runs under PXE is a cutdown version of SLES (or so
> I'm told) and I can't compile it there.  I have a couple of questions that
> may help me.
> I've been told that I must use the *exact* same version of the kernel,
> should it matter which distro I have running?

Not as such, but: it *does* matter that you have a matching kernel
configuration file, and it does matter that yo have the same version of the
gcc C compiler, linker, and other tools that were used to build the original.

> Could I use openSuse to build the module?

Yes.  The best case is that you can grab an SDK for the imaging tool and just
do it that way; worst case, compile the tools you need from source and you are

> Are there any tricks to back-reving the kernel?

You need the right kernel source, plus any vendor patches.  What you *don't*
need is anything but a copy of those files on disk: you don't need, for
example, to be running the same kernel, or anything like that.

> I tried to go from back to using a file from
> www.kernel.org. It look to be working, the module compiled without error,
> but when I went to load it, with modprobe, I received an error "FATAL: Error
> inserting atl1e (/lib/modules/
> invalid module format". I've read that is most likely due to having the
> incorrect source on the system.

...hmmmm.  Certainly, something is mismatched there.

Anyway, get the right kernel config file[1], the sources to the *exact* kernel
version, and information on which compiler was used, and start with that lot...


[1]  Check /boot inside the imager software, and /proc/kconfig*, to see if you
     can get at it easily.  Otherwise chase the vendor for the sources under
     the GPL, as they are obliged to give 'em to you, along with the tools to
     compile the stuff.

✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons

More information about the linux mailing list