Link to home
Start Free TrialLog in
Avatar of cliffhanger121599
cliffhanger121599

asked on

Kernel 2.6.5 and gcc-3.3.1

I've successfully compiled and run a 2.6.5 kernel built with GCC 2.95.3.  Now I need the same kernel compiled with GCC-3.0x   So, I've built the 2.6.5 kernel using GCC-3.3.1.    It boots
okay until module loading and then:
 
modprobe:FATAL:Error inserting unix.ko  Invalid module format  and so on..................
 
This seems to point to the modules being built with a different gcc, which is impossible.
I know 2.95.3 is recommended for 2.6, but threr are many instances of successful building with gcc-3.0x.  What's going on here?   I have the correct module loader for 2.6.

MAC    
Avatar of jlevie
jlevie

Have you verified that the module in question in /lib/modules is the version built by Gcc 3.x? Compare the checksum of the file in /lib/modules with that of the file in the kernel source tree.
Avatar of cliffhanger121599

ASKER

<Have you verified that the module in question in /lib/modules is the version built by Gcc 3.x?>

I have now.  They're identical.  

Another error message I'm getting is:

unix: ver magic 2.6.5 Pentium III gcc-3.3 should be 2..6.5 Pentium III gcc-2.95
I've just built a non-modulized 2.6.5 with 3.3.1 and it works fine, just to verify it's a module problem.

I wasn't aware the /lib/modules dir. was necessary with a non-modulized kernel?

Could just carry on unless you fell like tracking this problem down?

MAC
As far as I know, Gcc 3.x should build any kernel from kernel.org since 2.4. And since you've verified that the module in question is valid I'd supect the modprobe version. Was this Linux one that shipped with a 2.6 kernel?

I think the problem lies in the kernel version being reported by the system, i.e. by uname -r.    I have just upgraded the kernel again to 2.6.9(non-modulized) and built it with 3.3.1, but 'uname -r' is reporting I'm still using a 2.6.5 kernel.   And it is reporting the kernel as being bulit with gcc-2.95.3 when I know it isn't.

Therefore when modprobe tries to load modules, it seems to be trying to do it from the previous kernel, hence the error messages.

Does any of this make any sense and is it possible?

MAC
That would explain it. In that case it would be trying to load a module from /lib/modules/2.6.5.

What does /boot contain?
file:/boot/System.map
file:/boot/boot-bmp.b
file:/boot/boot-menu.b
file:/boot/boot-text.b
file:/boot/boot.0300
file:/boot/boot.b
file:/boot/bzImage
file:/boot/chain.b
file:/boot/logo64a.bmp
file:/boot/map
file:/boot/mbr.b
file:/boot/os2_d.b
What Linux is this?

When you copied the latest kernel to /boot (I assume it is in bzimage) did you also copy the new System.map to /boot?
I was afraid you would ask that - LFS

I have been running the system for many years without problems and have compiled many kernels.   Never had these problems before.

Absolutely, got the new System.map.

I understand the kernel version that uname uses  in the Makefile under the kernel source?
> I understand the kernel version that uname uses  in the Makefile under the kernel source?

That version information would be compiled into the kernel. uname gets the version info vi a kernel function call. You can do an strace on uname and see that it doesn't open any file directly realated to the kernel, Makefile, etc.

Are you booting via lilo or Grub? And if lilo did you execute 'lilo' to update the MBR after the kernel update?
>Are you booting via lilo or Grub? And if lilo did you execute 'lilo' to update the MBR after the kernel update?

Lilo

I always run lilo after a kernel update.   The kernel wouldn't boot otherwise aad this one does. It just refuses to load modules correctly hence the error messages.
 
Since the kernel version is pulled via a syscall from the running kernel the only way I can see for you to get the wrong kernel reported via uname is if the old kernel is booted. That would explain the module load error and is why I asked about lilo. If you had not run 'lilo', or it failed to update the MBR, the old kernel would have booted.

I'd suggest verifying that /boot/bzImage is the correct kernel and run 'lilo -v' to see what's happening.
This is driving me to distraction.

I know I'm booting the correct kernel - I am backing up the old kernel and system.map and copying the new kernel and system.map into /boot and then running lilo to update the MBR.

I know I'm compiling with gcc-3.3.1 because that is the only compiler present.   Despite this when I run either uname -r or cat /proc/version I'm getting not only showing the wrong kernel, but the WRONG compiler used.

For example I compile and install a 2.6.9 kernel with 3.3.1.   I reboot and cat /proc/version says:

Linux version 2.6.5 (root@Cliffhangers) (gcc version 2.95.3 20010315 (release)) #1 Sat Nov 6 21:48:38 Europe/London
 2004

uname -r says: 2.6.5

What's going on?  

Another thing

I run depmod 2.6.9 after installing the new kernel, then depmod -a and

WARNING: Couldn't open directory /lib/modules/2.6.5: No such file or directory
FATAL: Could not open /lib/modules/2.6.5/modules.dep.temp for writing: No such file or directory
All of that tells me that the reboot is still booting from the old kernel. And that means that when you execute lilo it isn't doing "the right thing". The depmod error is understandable when you realize that it will look at the running kernel to figure out which modules dir to use.
Stupid question maybe.  

How am I booting from the old kernel if it no longer exists, i.e. if I have either backed it up or moved it elsewhere?
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The problems solved, many thanks.

I have a duel boot system and I believe, or now know, that there is a problem with the FAT in windoze.   I have now taken windoze out of the lilo.

Prior to your suggestion about a boot choice I had already set
the the source of the new
kernelto '/usr/src/linux/arch/i386/boot/bzImage' but it made no difference UNTIL I removed windoze from the boot choice.

Everything has now come good inc. uname -r etc.

thanks again

MAC