home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
docs
/
readme-cross
< prev
next >
Wrap
Text File
|
1996-10-14
|
10KB
|
270 lines
===================================================
How To Build an Amiga Cross Development Environment
===================================================
(1) Pick an installation tree root directory
--------------------------------------------
Pick a location for the root of the binary install tree. This is where all
the executables, libraries, include files, etc will be installed after being
built. This can be any directory you want, as long as you have sufficient
permissions to create it or write to it.
On many systems, the standard location for this directory is "/usr/local",
and in fact that is the default location. For these instructions, because I
want to create a totally private toolset, I will be installing in the
directory "/home/fnf/ade".
Make the install directory and a few necessary subdirectories, if they don't
already exist:
mkdir -p /home/fnf/ade
mkdir -p /home/fnf/ade/bin
mkdir -p /home/fnf/ade/lib
mkdir -p /home/fnf/ade/m68k-cbm-amigaos
Strictly speaking it isn't necessary to make anything except /home/fnf/ade,
since the subdirectories will normally be created as needed during the
install procedure.
(2) Pick a source tree root directory
-------------------------------------
Pick a location for the root of the source tree. An example, used in these
directions, is "/home/fnf/ade-src". This is where you will unpack all the ade
source archives.
Make the directory if it doesn't already exist:
mkdir -p /home/fnf/ade-src
(3) Pick a build tree root directory
------------------------------------
Pick a location for the build tree. This is a temporary work area in which
you will build all the object files, executables, libraries, etc, that will
be installed in your installation tree. It is possible to use the source
tree as the build tree (building "in place") but that is not recommended.
For one thing, you may want to remove the build tree once you've built and
installed everything, and it is much easier to do that if you can just
remove an entire directory and all subdirectories. For another thing, if
you make changes to the source tree, it is easier to find out later what
those changes are by diffing your source tree against the original, if your
source tree is not cluttered with all the files created during the build.
An example, used in these directions, is "/home/fnf/build". Make the
directory if it doesn't already exist:
mkdir -p /home/fnf/build
IMPORTANT: In order to successfully use separate source and build trees you
must be using a "make" program that fully supports "VPATH". Many native
"make" programs do not! The workaround is to use GNU make, so you may have
to first build and install GNU make if you wish to keep the build and source
trees separate. If this is not an option for you, then you can just do the
builds in the source tree and forget about having a separate build tree.
(4) Get and unpack the ixemul includes and libraries
----------------------------------------------------
During the build of the cross tools, you will need the standard ixemul
header files. These are not used to build the cross tools, but rather used
by the cross compiler when it is compiling some amiga objects, such as the
libgcc.a runtime library that gets linked with the output of the cross
compiler to make an Amiga executable. You will also need some other runtime
files, such as an Amiga crt0.o and libc.a, from the ixemul library
distribution. It is best if you get and install these files now, before
starting to build the cross tools.
From the latest ADE distribution, get the os specific inline files
(fd2inline-X.X-bin.lha), the os specific libraries (libamiga-bin.lha), and
the ixemul runtime files (EX: ixemul-43.1-env-bin.lha,
ixemul-43.1-inc-bin.lha). If you expect to do Amiga specific development
you will also need the AT/VISCorp include files, which are not available in
the ftp ADE distributions but are in the CD-ROM distributions (at-inc-bin.lha).
Alternatively you can get these files later from some other source, such as
one of the Native Developer Update Kits (NDUK). The AT/VISCorp include files
are not necessary for building the cross environment.
Because these files are distributed in lha format in the ADE distribution,
the easiest way to get them to your cross machine is to extract all of these
archives in a temporary directory on an Amiga and then make a "tar" archive
which will be copied to your cross machine and unpacked there:
(on an Amiga)
lha -mraxe x fd2inline-X.X-bin.lha
lha -mraxe x libamiga-bin.lha
lha -mraxe x ixemul-X.X-env-bin.lha
lha -mraxe x ixemul-X.X-inc-bin.lha
lha -mraxe x at-inc-bin.lha (optional)
This will create subdirectories "include" "lib", and "man".
Use the Amiga version of tar to pack the "include", "lib", and "man"
directories into a tar archive, move the archive to the system on which you
are installing the cross environment, and unarchive it in the appropriate
subdirectory in the binary tree:
(on an Amiga)
tar -cvf inclibman.tar include lib man
delete include lib man all
(on the cross host system)
cd /home/fnf/ade/m68k-cbm-amigaos
tar -xvf inclibman.tar
rm inclibman.tar
Note that you can use any other method you like to get these files from your
Amiga to the cross host system. The important thing is that they end up in
the correct subdirectory in the installation tree, which is where the cross
tools will look for them once the tools are built.
(5) Build and install the "binutils"
------------------------------------
Get the binutils (assembler, linker, archiver, etc) distribution from the
latest ADE snapshot (ftp.ninemoons.com:pub/ade/960412/binutils-2.6-src.tgz
for example) and extract it in the source directory. It will create the
subdirectory "fsf/binutils" and populate it with the binutils source files:
cd /home/fnf/ade-src
tar -xvzf binutils-2.6-src.tgz
Check the ADE updates directory (ftp.ninemoons.com:pub/ade/updates) for any
patch files that need to be applied to the archive from the latest snapshot
directory, and apply the patch (if necessary):
gzip -d binutils-960412-960506.diffs.gz
cd fsf/binutils
patch -p0 <../../binutils-960412-960506.diffs
Configure and build the binutils in the build tree. Note that the --prefix
option should be set to the binary tree that you chose. Also, using a
common cache file via the --cache-file option makes the configure go faster:
cd /home/fnf/build
mkdir binutils
cd binutils
/home/fnf/ade-src/fsf/binutils/configure -v --prefix=/home/fnf/ade --target=m68k-cbm-amigaos --cache-file=config.cache
make
If everything builds OK, then install binutils into the binary tree:
make install
(6) Build and install gcc
-------------------------
Get the gcc distribution (ftp.ninemoons.com:pub/ade/960412/gcc-2.7.2-src.tgz
for example) from the latest ADE snapshot and extract it in the source
directory. It will create the subdirectory "fsf/gcc" and populate it with
the gcc source files:
cd /home/fnf/ade-src
tar -xvzf gcc-2.7.2-src.tgz
Check the ADE updates directory (ftp.ninemoons.com:pub/ade/updates) for any
patch files that need to be applied to the archive from the latest snapshot
directory, and apply the patch (if necessary):
gzip -d gcc-960412-960506.diffs.gz
cd fsf/gcc
patch -p0 <../../gcc-960412-960506.diffs
Configure gcc in the build tree. Note that the --prefix option should be
set to the binary tree that you chose:
cd /home/fnf/build
mkdir gcc
cd gcc
/home/fnf/ade-src/fsf/gcc/configure -v --prefix=/home/fnf/ade --target=m68k-cbm-amigaos
Because of a couple of unresolved problems building a cross compiler, apply
the following patch to the gcc Makefile after configuring and before
building gcc.
============================================================================
--- Makefile.orig Fri Jun 28 18:50:08 1996
+++ Makefile Fri Jun 28 18:50:47 1996
@@ -38,5 +38,5 @@
# Selection of languages to be made.
# This is overridden by configure.
-LANGUAGES = c objective-c proto c++
+LANGUAGES = c c++
ALLOCA =
@@ -194,5 +194,5 @@
# include files.
# NOTE: local_prefix *should not* default from prefix.
-local_prefix = /ade/local
+local_prefix = $(prefix)/local
# Directory in which to put host dependent programs and libraries
exec_prefix = $(prefix)
@@ -271,5 +271,5 @@
# libgcc1-test target (must also be overridable for a target)
-LIBGCC1_TEST = libgcc1-test
+LIBGCC1_TEST =
# List of extra executables that should be compiled for this target machine
@@ -442,5 +442,5 @@
SYSTEM_HEADER_DIR = /ade/include
-OTHER_FIXINCLUDES_DIRS = /ade/os-include
+OTHER_FIXINCLUDES_DIRS =
# We don't need a libgcc1, it's all in ixemul.library
============================================================================
After the patch is applied, build and install gcc:
make
make install
You might want to add the binary directory to your PATH variable:
PATH=/home/fnf/ade/bin:$PATH ; export PATH
(7) Test the new cross tools
----------------------------
An easy way to test the new cross tools is to configure and build one of
the ADE components in the cross environment, and then copy the executable
back to an Amiga to see if it runs OK. I would suggest using the "brik"
program:
cd /home/fnf/ade-src
tar -xvzf brik-2.0-src.tgz
cd /home/fnf/build
mkdir brik
cd brik
CC=m68k-cbm-amigaos-gcc /home/fnf/ade-src/contrib/brik/configure -v
make CC=m68k-cbm-amigaos-gcc
On a 166 Mhz Pentium system running RedHat linux this build takes only 3
seconds while on an A4000 with 40 Mhz WarpEngine, it takes about 20 seconds.
The executable should be about 12,800 bytes, but the exact size may vary
depending upon a number of factors. Move the executable back to an Amiga
and test it:
(on an Amiga)
brik -Gvb brik
which should print something like:
# Whole file CRCs generated by Brik v2.0. Use "brik -C" to verify them.
# CRC-32 filename
# ------ --------
2515614901b brik
Don't worry if the CRC is not the same as printed here.
If this works, you now have a functioning cross environment (or at least a
cross compiler) that depending upon the model of your Amiga and the machine
you are using as a cross development host, could easily be 20 times faster
than a native compiler.
-Fred Fish