Subject: Re: NetBSD crosscompiler
To: Markus Hitter <M.Hitter@trier.fh-rpl.de>
From: Erik Bertelsen <erik@sockdev.uni-c.dk>
List: port-mac68k
Date: 12/23/1995 23:21:04
On Fri, 22 Dec 1995, Markus Hitter wrote:

> Ok, guys,
> 
> there seem to be several people which want to setup a cross compiling
> environment on a UN*X machine NOT running NetBSD. Since I'm one of these people
> 
> 2) Get the sources for 'make' from .../NetBSD-current/src/usr.bin/make/* and
> compile it as well on the host machine. Install it (maybe as 'bmake') in the
> PATH.
Copy the make sources out of the NetBSD source tree and compile them on the
host computer. Use Makefile.boot instead of Makefile. You may need a few
minor tweaks of the header file inclusions.
Install the executable file as make in the same directory as the gcc cross
compiler.
You must patch make to look for the Makefile include files in the
NetBSD source tree (or somewhere else) instead of in /usr/share/mk.
In these Makefile include files (sys.mk I think) you should set
     CC=gcc -b m68k-apple-netbsd1.1
Also add -nostdinc and -I options to include your netbsd headers.
You must also patch make to set the correct MACHINE and MACHINE_ARCH
variables to designate the target as NetBSD/Mac68k. 
> 
> 4) Build GCC with 'configure --target=m68k-mac-netbsd'  followed
  by a 'make LANGUAGES=c' and 'make install'. Skip any stage 2 and following
  build steps. I recommend that you first configure and install gcc 2.7.2
  for the host system, then install the cross compiler with the samme
  configure options plus --target=m68k-apple-netbsd1.1.
  (By the way: on a current MacBSD system configure will guess its 
  host as m68k-apple-netbsd1.1A).
  
> 
> 5) Build a cross-assembler and a cross-linker for NetBSD on the host 
    machine.'
If you take the current binutils package and install it with
./configure --target=m68k-apple-netbsd1.1, you will get the assembler,
linker, etc. installed in one turn.

If your "normal" gcc is in /usr/local/bin, all the cross tools will be
installed in /usr/local/m68k-apple-netbsd1.1/bin, which should be added
to your path while installing.

> 
> 6) Build a kernel similar to the steps in .../NetBSD-current/doc/sun3/BUILDING:
>      1) cd src/sys/arch/mac-m68k/conf
>      2) cp GENERIC FOO (where foo could be the name of your machine)
>      3) config FOO
>      4) cd ../compile/FOO
>      5) bmake depend
>      6) bmake

When you try to build the rest of NetBSD, you may also run into trouble with
the 'find' and 'install' programs which use options that are not available
on all host systems.

regards
Erik Bertelsen

PS: I look forward to see how much faster it is to build a complete kernel
on a Sparc Server 20 (or Decstation) than on my Mac IIcx (where it takes
half a night for config;make clean;make depend;make).