Re: modules not compiling properly?

Kerin Millar <[email protected]> Fri, 11 Oct 2002 14:34:17 +0100
Newsgroups gmane.linux.gentoo.newbies
Message-ID <[email protected]>
Robert Schauer wrote:
> 'modprobe' and 'make modules_install' both report errors that say the
> module files (*.o) are "not an ELF file."  i've tried completely
> recompiling the kernel several times, and i keep coming up with this
> same problem.  any suggestions?

Have a look at the manpage for modules.conf. It says:

        prune filename
               <snip>
               process wants to save  from  a  kernel  build.   To
               prevent  depmod  issuing warnings about "not an ELF
               file", these non-module files should appear in  the
               prune list.  depmod has a built in prune list which
               cannot be removed because it lists files which will
               exist  for  any  kernel build.  If you add your own
               files to the top level  modules  directory,  add  a
               prune statement for each filename.  Note: The prune
               <snip>

Maybe you have some files in your modules directory that shouldn't be 
there? Have you tried running depmod? Before you recompile your kernel 
(at least, before you make your modules), have you made sure to 
completely remove (or rename) your old module tree:

    mv /lib/modules/2.4.19 2.4.19.orig      (renames)
    rm -rf /lib/modules/2.4.19              (or just kill it)

If you don't do that, then the old tree will not be cleared out for you 
and you could end up with an unholy mish-mash of files in your modules 
tree as you continually build new kernels. I don't know what kernel you 
are using, but you could try unmerging it (you'll need to "rm -rf 
/usr/src/linux" afterwards too), and merging it again before your next 
recompile. And try issuing:

    cd /usr/src/linux
    make mrproper

Before you config the kernel and do anything further. Bear in mind that 
the above command wipes out your config options so you need to save your 
options if you don't want to configure them from scratch again.

Also, I think you should make sure the headers you have in your system 
are consistent with the kernel version you had installed at the time you 
compiled *glibc*, i.e. when you bootstrapped, not the kernel you're 
actually using or trying to use now. For example, when I build my 
Gentoo system the gentoo-sources were a patched 2.4.18 kernel. I use 
2.4.19 now, but I have made sure not to update the linux-headers 
otherwise you can have problems. In Gentoo, the headers are kept 
separately outside of the /usr/src/ directory and are handled by the 
"linux-headers" ebuild. In my case, I should never update the headers 
beyond 2.4.18 unless I recompile glibc with a newer kernel. I don't 
think this is part of your problem here, but it's worth knowing.

--kerframil