README.mknative revision 1.9 1 1.9 mrg $NetBSD: README.mknative,v 1.9 2011/09/21 02:15:18 mrg Exp $
2 1.9 mrg
3 1.9 mrg XXX THIS FILE DOES NOT DESCRIBE GCC 4.5 METHODS PROPERLY XXX
4 1.1 mrg
5 1.2 skrll This file describes how to bootstrap the native toolchain on a new NetBSD
6 1.2 skrll platform (and how to update the new toolchain files, if needed). These
7 1.2 skrll files may be generated on a cross-compile host without problems.
8 1.1 mrg
9 1.2 skrll NOTE: DO NOT RUN "mknative" BY HAND! It requires the Makefile in this
10 1.2 skrll directory to set up certain environments first.
11 1.2 skrll
12 1.2 skrll Since libc's features change over time, the config.h files can change as a
13 1.2 skrll result; thus the instructions below are the same no matter whether
14 1.2 skrll bootstrapping on a cross or native host. This is important: even on a
15 1.2 skrll "native" host, you should bootstrap the toolchain by building from an
16 1.2 skrll up-to-date source tree to a $DESTDIR using the exact same instructions.
17 1.2 skrll
18 1.2 skrll In these notes, MACHINE is the $MACHINE of the target. These files can be
19 1.2 skrll cross-generated. Though a $MACHINE_ARCH all uses the same config files, you
20 1.2 skrll must pick a specific $MACHINE so that building the requisite bits below will
21 1.2 skrll work.
22 1.2 skrll
23 1.2 skrll 1. Set MKMAINTAINERTOOLS=yes in mk.conf. (Needed so that src/tools/gettext
24 1.2 skrll gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
25 1.2 skrll
26 1.2 skrll 2. Build and install a cross toolchain (via "build.sh -m MACHINE tools").
27 1.2 skrll
28 1.2 skrll 3. In src/tools/gcc, do "nbmake-MACHINE bootstrap-libgcc".
29 1.2 skrll
30 1.6 mrg This will create just enough glue in src/gnu/lib/libgcc4/arch to make it
31 1.2 skrll possible to build, based on the toolchain built in ${.OBJDIR}/build.
32 1.2 skrll Because the files generated in this step contain things like
33 1.4 martin -DCROSS_COMPILE, they are not suitable for committing. Step 8 below
34 1.2 skrll will regenerate the "proper" libgcc config files.
35 1.2 skrll
36 1.2 skrll 4. At top level, do
37 1.7 skrll "nbmake-MACHINE do-distrib-dirs obj includes MKGCC=no MKBINUTILS=no".
38 1.2 skrll
39 1.6 mrg 5. In src/gnu/lib/libgcc4, do "nbmake-MACHINE obj includes".
40 1.2 skrll
41 1.8 mrg 6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in src/gnu/lib/crtstuff4
42 1.8 mrg do "nbmake-MACHINE dependall install"
43 1.4 martin
44 1.8 mrg 7. In each of src/lib/csu, src/gnu/lib/libgcc4, and src/lib,
45 1.8 mrg do "nbmake-MACHINE dependall install".
46 1.2 skrll
47 1.2 skrll Optionally, all of the following may be set in the environment to reduce
48 1.2 skrll the amount of code needed to build at this step. Basically, it must be
49 1.2 skrll possible for static binaries to build and base system libs to exist so
50 1.2 skrll that "configure" can do its job for the target--these MK* options omit
51 1.2 skrll the rest for this stage of the build.
52 1.2 skrll
53 1.2 skrll MKCRYPTO=no
54 1.2 skrll MKLINT=no
55 1.2 skrll MKPROFILE=no
56 1.2 skrll MKSHARE=no
57 1.2 skrll
58 1.4 martin 8. In src/tools/gcc, do "nbmake-MACHINE native-gcc".
59 1.2 skrll
60 1.2 skrll This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
61 1.2 skrll cross toolchain (--build reflects the host platform, but --host and
62 1.2 skrll --target are the target). The result is a tree that would build a
63 1.2 skrll native-to-NetBSD compiler on a cross host, and mknative pulls glue data
64 1.2 skrll from this.
65 1.2 skrll
66 1.4 martin 9. Try out a full build using "nbmake-MACHINE"; the result should include
67 1.2 skrll a native compiler.
68 1.2 skrll
69 1.4 martin 10. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*.
70