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