Skip to contentSkip to conversation

any hints using gcc 3.4.3 for 2.4.25 kernel?

DISCUSSION Wojciech Kromer 4 participants 5 messages Feb 21, 2005 – Feb 23, 2005

lore
Share & tools
lore
#0 lore raw

a)first i have:
- 2.4.25 kernel (from denx cvs)
- eldk with 2.95.4 compiler
this one set works fine :)

b)then, i've tried to same sources with:
gcc-3.4.3 , self build from uClibc buildroot
new hernel hangs just after decompressing :(

any tricks?

#1 lore raw
Quoted 8 lines · Wojciech Kromer

a)first i have:
- 2.4.25 kernel (from denx cvs)
- eldk with 2.95.4 compiler
this one set works fine :)

b)then, i've tried to same sources with:
gcc-3.4.3 , self build from uClibc buildroot
new hernel hangs just after decompressing :(

I haven't tried this on PPC, but under similar circumstances on ARM what I learned was: there are several places in the kernel where lists are generated by some linker tricks. For example all of the device initialization functions are assembled into a list, so they can be conveniently called in sequence.

The semantics for getting the linker to fill this list have changed. In 2.4 days they used ELF sections marked as "unnused", which were simply ignored but passed through.

Newer toolchains now drop unnused sections, so the initialization tables are not present in your kernel, which leads to the crash. I was able kludge around this by changing in <asm/setup.h> and <linux/init.h>, search for __attribute__((unused, ...) and change to "used" instead. There are about half dozen occurrences, in the __init* and __exit* macros. You then need some ugly casts in <linux/module.h> to match.

Of course the same thing could happen in other places/drivers, so really
the above is not a good solution. New 2.6 kernels handle this sort of
thing in a different way. Best solution is to keep an older gcc for older kernels, and a newer one for 2.6...

-Ralph

#2 lore raw
In reply to Wojciech Kromer
Quoted 11 lines · Wojciech Kromer

a)first i have:
- 2.4.25 kernel (from denx cvs)
- eldk with 2.95.4 compiler
this one set works fine :)

b)then, i've tried to same sources with:
gcc-3.4.3 , self build from uClibc buildroot
new hernel hangs just after decompressing :(

any tricks?

you can use the include/linux/init.h and compiler.h from 2.4.29 kernel + patching some header files, where the inlining does not work any longer. I also suggest comparing with 2.4.29 kernel.

ciao,
Gerhard

Signature · 3 lines
Gerhard Jaeger <[email protected]>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de 
#3 lore raw
Quoted 15 lines · Gerhard Jaeger
Quoted 11 lines · Wojciech Kromer

a)first i have:
- 2.4.25 kernel (from denx cvs)
- eldk with 2.95.4 compiler
this one set works fine :)

b)then, i've tried to same sources with:
gcc-3.4.3 , self build from uClibc buildroot
new hernel hangs just after decompressing :(

any tricks?

Quoted 7 lines

you can use the include/linux/init.h and compiler.h from 2.4.29 kernel + patching some header files, where the inlining does not work any longer. I also suggest comparing with 2.4.29 kernel.

ciao,
Gerhard

If all you want is a cross compiler to make a kernel why not try this procedure ?

Tested with :

gcc-3.4.2
binutils-2.15.90.0.3
dietlibc-0.28 or dietlibc cvs

1
untar all sources

2
binutils:

./configure --prefix=/usr/local/powerpc-linux --target=powerpc-linux

make
make install

3
gcc:

./configure --prefix=/usr/local/powerpc-linux --target=powerpc-linux --with-ecos --disable-nls --enable-threads=posix --disable-shared --enable-languages=c --with-headers=../dietlibc/include

make
make install

There might be a little error in gcc/unwind-dw2-fde-glibc.c and gcc/unwind-dw2-fde.h

I can't remember the exact errors in those two files, but, hopefully those should be easy enough to fix.

Once you work around the slight inconsistency between dietlibc & gcc in those two files, and make install, you should have a full toolchain in /usr/local/powerpc-linux

I had been thinking about making a small script for kernel people such as yourself, who wanted just a toolchain for kernel cross compiles. Maybe I'll do that.

But, in any case, the above procedure gives me a 3.4.2 which is quite happy to compile a 2.4.28-rc3 (though I haven't tried out the denx 2.4.25... but, I can't see why that would fail).

Hope this helps.

--
Bryan

#4 lore raw
Quoted 68 lines · Bryan O'Donoghue
Quoted 15 lines · Gerhard Jaeger
Quoted 11 lines · Wojciech Kromer

a)first i have:
- 2.4.25 kernel (from denx cvs)
- eldk with 2.95.4 compiler
this one set works fine :)

b)then, i've tried to same sources with:
gcc-3.4.3 , self build from uClibc buildroot
new hernel hangs just after decompressing :(

any tricks?

Quoted 7 lines

you can use the include/linux/init.h and compiler.h from 2.4.29 kernel + patching some header files, where the inlining does not work any longer. I also suggest comparing with 2.4.29 kernel.

ciao,
Gerhard

If all you want is a cross compiler to make a kernel why not try this procedure ?

Tested with :

gcc-3.4.2
binutils-2.15.90.0.3
dietlibc-0.28 or dietlibc cvs

1
untar all sources

2
binutils:

./configure --prefix=/usr/local/powerpc-linux --target=powerpc-linux

make
make install

3
gcc:

./configure --prefix=/usr/local/powerpc-linux --target=powerpc-linux --with-ecos --disable-nls --enable-threads=posix --disable-shared --enable-languages=c --with-headers=../dietlibc/include

make
make install

There might be a little error in gcc/unwind-dw2-fde-glibc.c and gcc/unwind-dw2-fde.h

I can't remember the exact errors in those two files, but, hopefully those should be easy enough to fix.

Once you work around the slight inconsistency between dietlibc & gcc in those two files, and make install, you should have a full toolchain in /usr/local/powerpc-linux

I had been thinking about making a small script for kernel people such as yourself, who wanted just a toolchain for kernel cross compiles. Maybe I'll do that.

Quoted 5 lines

But, in any case, the above procedure gives me a 3.4.2 which is quite happy to compile a 2.4.28-rc3 (though I haven't tried out the denx 2.4.25... but, I can't see why that would fail).

Hope this helps.

I'm pretty sure, that it won't help on a 2.4.25 kernel. The 2.4.28-rc3 already has the needed patches/changes applied, that's why it works for you ;)

ciao,
Gerhard

Signature · 3 lines
Gerhard Jaeger <[email protected]>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de