Imbrium Logo

Configuration for the Toolset And Compiler for m68k-elf

What is This?

I wanted to go through the process of building my toolset from scratch to see if I could do it. I could not :) Not yet, anyway... In order not to forget what I did, I wrote it down, that's all. This page is unfinished, I put that aside for a while, sorry...

Building the GNU Toolchain (binutils)

Get the newest toolchain from here and unpack this into /home/uclinux/src/. With the current release, this would be:

	# cd /home/uclinux/src
	# tar xvjf binutils-2.13.tar.bz2
	# chown uwe.uwe binutils-2.13 -R
	# cd binutils-2.13
	# ./configure --target=m68k-elf --prefix=/home/uclinux/toolchain
	# make
	# make install

This will install the elf tools in the directory /home/uClinux. The bin/ directory will contain the elf tools needed to build uClinux apps in the m68k-elf format. In order for the next step to build successfully, it is necessary to put path of the binaries into your $PATH or make a symbolic link to the m68k- executables. I did it like this:

	# cd /home/uclinux
	# mkdir bin
	# ln -s /home/uclinux/toolchainm68k-elf/bin/* bin

Building gcc-2.95.3 for m68k-elf PIC

In order to build the gcc for cross-compiling, the standard GCC-2.95.3 must be patched so that it will not use the glibc. First, get and unpack gcc:

	# cd /home/uclinux/src
	# tar xvzf gcc-2.95.3.tar.gz
	# chown uwe.uwe gcc-2.95.3.tar.gz -R

Now get the gcc-2.95.3-full.patch from and patch the gcc by doing:

	# cd gcc-2.95.3
	# patch -p1 < gcc-2.95.3-full.patch

This should produce the following output:

	patching file ChangeLog
	patching file gcc/ChangeLog
	patching file gcc/config/m68k/lb1sf68.asm
	patching file gcc/config/m68k/m68k-none.h
	patching file gcc/config/m68k/m68k.c
	patching file gcc/config/m68k/m68k.h
	patching file gcc/config/m68k/
	patching file gcc/config/m68k/m68kelf.h
	patching file gcc/config/m68k/t-m68kbare
	patching file gcc/config/m68k/t-m68kelf
	patching file gcc/invoke.texi
	patching file gcc/longlong.h
	patching file gcc/version.c

Frankly, I don't know what exactly the patch does, sorry :)

There is another thing that you must do in order for the compiler to compile properly.
Now build the m68k cross-compiler by issuing the configure command to build just the C compiler for the m68k-elf target:

	# ./configure --prefix=/home/uclinux/m68k-elf --target=m68k-elf \
                  --enable-multilib --enable-languages=c
	# make
	# make install

Building the romfs

Get the newest romfs from here and unpack this into /home/uclinux/src/

With the current release, this would be:

	# cd /home/uclinux/src
	# tar xvzf romfs...
	# chown uwe.uwe romfs... -R