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