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    
cliffhanger121599Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jlevieCommented:
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.
0
cliffhanger121599Author Commented:
<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
0
cliffhanger121599Author Commented:
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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jlevieCommented:
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?
0
cliffhanger121599Author Commented:

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
0
jlevieCommented:
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?
0
cliffhanger121599Author Commented:
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
0
jlevieCommented:
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?
0
cliffhanger121599Author Commented:
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?
0
jlevieCommented:
> 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?
0
cliffhanger121599Author Commented:
>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.
 
0
jlevieCommented:
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.
0
cliffhanger121599Author Commented:
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?  

0
cliffhanger121599Author Commented:
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
0
jlevieCommented:
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.
0
cliffhanger121599Author Commented:
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?
0
jlevieCommented:
I'll confess to having never looked in the Lilo code to see exactly how it works, so what follows is conjecture.

I don't believe that lilo embeds any sort of file name reference in the MBR, by rather it uses some sort of direct disk addressing to find the kernel. If that is the case it could still boot the old kernel because that data could still exist at its original disk location, even though you've deleted the file or moved it elsewhere. A delete or move within a single file system only operates on the inode of the file, not the actual file data. A move across file systems is copy & delete so again only an inode change occurs on the original file.

What I'd suggest that you try is to set up lilo with a boot choice. The old kernel and the new as separate boot choices, which is good practice when building kernels.  This means that you'll want to name your kernels something other than just vmlinuz, perhaps vmlinux-2.6.9, etc.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cliffhanger121599Author Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.