Preparing toolchain on a Pentium III Redhat 7.0

VAKKALANKA RAO Sridhar SVakkalankarao at
Wed Apr 23 17:27:20 EST 2003

> > > > Is it possible to cross build the PPC64 kernel and toolchain even though the Pentium III is a 32 bit machine?

> Yes.  On my x86 box, I use the following configure lines

> /src/binutils-current/configure --prefix=/usr/local \
>  --build=i586-linux --host=i586-linux --target=powerpc-linux \
>  --enable-targets=powerpc64-linux --disable-nls

> /src/gcc-ppc64-33/configure --prefix=/usr/local \
>  --build=i686-linux --host=i686-linux --target=powerpc64-linux \
>  --disable-nls --with-headers=/usr/local/powerpc64-linux/include \
>  --enable-languages=c,c++,f77

> /src/libc-current/configure --prefix=/usr/local/powerpc64-linux \
>  --build=i686-linux --host=powerpc64-linux --target=powerpc64-linux \
>  --with-headers=/src/linux-2.5.67-ppc/include --without-cvs --enable-add-ons \
>  --enable-shared --disable-sanity-checks

> These are suitable once you already have a toolchain installed.  It's
> a little more difficult getting the very first toolchain built!  For
> instance, the first gcc build needs to --disable-shared --disable-threads
> --enable-languages=c and you don't have headers.  In fact, even with
> these options, lack of headers will cause a failure in the build of
> libgcc, but it's possible to hack around that by disabling the code
> that needs the missing headers.  Or you can cheat and use headers
> from some other arch (x86 even) given that the first gcc only needs to
> be able to build the kernel and glibc.

Okay, I have reached a point the first pass has been completed for gcc and binutils. I made a few discoveries that must have known to experienced folks for a long time:

(1) The original (Redhat) 2.96 gcc first looks for include files in the path /usr/lib/gcc-lib/i386-redhat-linux/2.96/include before looking for them anywhere else. The next default search, obviously, is /usr/include. Now, the gcc (vers. 3.3) compiler that I built looks only for files in the path /opt/ppc64/lib/gcc-lib/powerpc64-linux/3.3/include and nowhere else (for the configuration example given above, the search path would be /usr/local/lib/gcc-lib/powerpc64-linux/3.3/include). So, how do I configure my cross-compile gcc such that it makes subsequent path searches without forcing me to add the -I flag to the Makefiles.

(2) I managed to get around the above problem for now. When building the kernel, I executed the "make mrproper", "make oldconfig" (because "make config" asks too many hardware questions that I don't have answers to) and "make dep" in the same order as specified by the instructions. Executing "make dep" caused a problem - it generated an executable called "mkdep" which is targeted for powerpc64-linux and not for i686-linux. In order to step further into the compilation process, the Makefile tries to execute "mkdep" and I get the error that "mkdep" cannot execute on this machine. How do I get around that?

I would much appreciate an answer.

Thanks in advance

** Sent via the linuxppc64-dev mail list. See

More information about the Linuxppc64-dev mailing list