News Introduction Developer Tools Project Status Installation Bugs!

Site Map

One processor per person is not enough. One operating system per computer is not enough.

Linux for BeBox logo

[ Back to the General Tools page ]

Cross compiling
There is now, thanks to Andy Lo A Foe, a PowerPC cross compiler that's hosted on x86. It's only really good for building a kernel, so don't expect to be able to use it for compiling X11 ;)

Why cross compile? The BeBox is dog slow at compiling kernels due to very poor handling of the cache in Linux 2.0. So we're using fast, cheap x86 boxes to accelerate development towards a slick SMP 2.1 kernel.

Required files

  • The cross compiler: Download by FTP from ftp.halfast.com or by HTTP from www.halfast.com. You must extract this into the root of your filesystem.

  • The kernel source tree: From ftp.linuxppc.org or wuarchive.wustl.edu. You cannot use a stock Linux kernel. You must remove any PPC executables before compiling - see below.

  • The magic patch: From here. This is a diff that Andy and I put together of an evening; it fixes a few problems with the PPC kernel and makes it possible to compile it.

Installing things
I'll assume that you've put your newly downloaded files in /tmp. The cross compiler has to live in /cross at present. Once you've got all the files in /tmp, the following commands (executed as root) should uncompress and install every thing:

aleph:~# cd /
aleph:/# bzip2 -dc /tmp/cross.compiler.bz2 | tar xfv -
aleph:/# cd cross
aleph:/cross# tar zxfv /tmp/linux-2.0.32.pax.gz
aleph:/cross# ln -s /cross/linux-2.0.32 linux
aleph:/cross# rm /cross/bebox.include/linux
aleph:/cross# ln -s /cross/linux/include/linux /cross/bebox.include/linux
aleph:/cross# cd linux
aleph:/cross/linux# patch -p1 < /tmp/belinux-2.0.32-pl2.diff
aleph:/cross/linux# make clean

The final command is very important as it will remove some PowerPC executables that someone left in the kernel source tree (presumably by mistake).

It is of the utmost importance that you carry out every one of these commands (especially modifying the symlink bebox.include/linux, this is a tiny error in the cross compiler archive).

Building your kernel
To build your kernel, first execute a make menuconfig, or just a plain make config if you prefer. Set the kernel up as you desire. If you want a kernel that includes support for most of the BeBox's hardware, copy this file on top of /cross/linux/.config - but you must still run make config at least once, as it establishes some symbolic links that are required.

Once you've got the desired configuration, these commands will build the kernel and copy it to a floppy in your first floppy drive:

aleph:~# cd /cross/linux
aleph:/cross/linux# export PATH=/cross/bin:$PATH
aleph:/cross/linux# make clean
aleph:/cross/linux# make dep
aleph:/cross/linux# make xImage
aleph:/cross/linux# dd if=arch/ppc/boot/xImage of=/dev/fd0 bs=512

This builds a kernel that mounts /dev/sda2 (SCSI) as the root filesystem (equivalent to FD_BOOT from the LinuxPPC distributions). For a kernel that mounts /dev/hda2 (IDE) as the root (equivalent to FD_BOOT-hd) replace the two references t o "xImage" in the last two commands above with "xImage-hd". The kernel you've just built replaces the FD_BOOT disk you were previously using with LinuxPPC. You still need to use the be_boot_disk as a bootstrap.

The compile will probably generate a lot of warnings; this is because the compiler is derived from egcs rather than gcc, and egcs generates a lot more noise than gcc.

Built on a BeBox Dual603-133

© 2002 William R Sowerbutts <will@sowerbutts.com>
Page last modified: Mon Dec 14 00:15:30 1998

Be is a registered trademark, and BeOS, BeBox, BeWare, GeekPort, the Be logo and the BeOS logo are trademarks of Be, Inc. All other trademarks mentioned are the property of their respective owners. Yadda yadda yadda.