AUTHOR: Robert Connolly (ashes) DATE: 2007-10-15 LICENSE: Public Domain SYNOPSIS: How to install an m68k cross compiler. PRIMARY URI: http://www.linuxfromscratch.org/~robert/new/m68k-compiler.txt DESCRIPTION: This hint is written because the cross compiler howto's I found are a few years old and are not particularly suited for a standard LFS installation. This hint does not show how to install a cross compiled C library, although it could be adapted to. If you want to cross compile a C library I suggest you look at: http://www.linuxfromscratch.org/clfs/ and http://buildroot.uclibc.org/ and http://kegel.com/crosstool/ PREREQUISITES: A native compiler (included with any LFS version). HINT: I'm installing a cross toolchain for my iRiver portable audio player (m68k). - Binutils First disable the installation of 'libiberty.a' so that we do not replace the one in /usr/lib on the host system: sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in We probably do not want to replace our info or manual pages, so we can install those to /tmp/stuff. Native language support is disabled so it does not replace the files on the host system, and because a cross toolchain does not need it. Using CFLAGS when building a cross toolchain is generally a bad idea, so they're disabled here. Your CONFIG_SITE, if any, is probably also bad here. Change your "--target" option as needed, and build with (as regular user): mkdir obj && cd obj && env -u CFLAGS CONFIG_SITE=/dev/null \ ../configure --prefix=/usr --disable-nls --target=m68k-elf \ --mandir=/tmp/stuff --infodir=/tmp/stuff --datadir=/tmp/stuff && make CONFIG_SITE=/dev/null && make DESTDIR=$(pwd)/DESTDIR install Make sure everything in "DESTDIR/" looks right (ignore DESTDIR/tmp/stuff/), and install with (as root): make install && rm -rf /tmp/stuff - GCC Disable the installation of 'libiberty.a': sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in We can't cross compile libssp or libmudflap, so those are disabled. Compile GCC with (as regular user): mkdir obj && cd obj && env -u CFLAGS CONFIG_SITE=/dev/null \ ../configure --disable-nls --prefix=/usr --libexecdir=/usr/lib \ --target=m68k-elf --mandir=/tmp/stuff --infodir=/tmp/stuff \ --datadir=/tmp/stuff --disable-libmudflap --disable-libssp \ --enable-languages=c && make CONFIG_SITE=/dev/null && make DESTDIR=$(pwd)/DESTDIR install Check that everything in "DESTDIR/usr/" looks right, and install (as root): make install && rm -rf /tmp/stuff Then use CC="m68k-elf-gcc". Uninstalling is easy. Use 'find /usr -name "*m68k-elf*" -exec rm -rf {} \;'. ACKNOWLEDGMENTS: * None. CHANGELOG: [2007-10-15] * Initial hint.