README.mknative revision 1.2
143844Syokota$NetBSD: README.mknative,v 1.2 2004/02/12 18:57:08 skrll Exp $ 243844Syokota 343844SyokotaThis file describes how to bootstrap the native toolchain on a new NetBSD 443844Syokotaplatform (and how to update the new toolchain files, if needed). These 543844Syokotafiles may be generated on a cross-compile host without problems. 643844Syokota 743844SyokotaNOTE: DO NOT RUN "mknative" BY HAND! It requires the Makefile in this 843844Syokotadirectory to set up certain environments first. 943844Syokota 1043844SyokotaSince libc's features change over time, the config.h files can change as a 1143844Syokotaresult; thus the instructions below are the same no matter whether 1243844Syokotabootstrapping on a cross or native host. This is important: even on a 1343844Syokota"native" host, you should bootstrap the toolchain by building from an 1443844Syokotaup-to-date source tree to a $DESTDIR using the exact same instructions. 1543844Syokota 1643844SyokotaIn these notes, MACHINE is the $MACHINE of the target. These files can be 1743844Syokotacross-generated. Though a $MACHINE_ARCH all uses the same config files, you 1843844Syokotamust pick a specific $MACHINE so that building the requisite bits below will 1943844Syokotawork. 2043844Syokota 2143844Syokota1. Set MKMAINTAINERTOOLS=yes in mk.conf. (Needed so that src/tools/gettext 2243844Syokota gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.) 2343844Syokota 2443844Syokota2. Build and install a cross toolchain (via "build.sh -m MACHINE tools"). 2543844Syokota 2643844Syokota3. In src/tools/gcc, do "nbmake-MACHINE bootstrap-libgcc". 2750476Speter 2843844Syokota This will create just enough glue in src/gnu/lib/libgcc3/arch to make it 29268946Semaste possible to build, based on the toolchain built in ${.OBJDIR}/build. 3053200Sphantom Because the files generated in this step contain things like 3179538Sru -DCROSS_COMPILE, they are not suitable for committing. Step 7 below 3243844Syokota will regenerate the "proper" libgcc config files. 3343844Syokota 3443844Syokota4. At top level, do 3575670Sru "nbmake-MACHINE do-distrib-dirs obj includes MKGCC=no MKBFD=no". 3643844Syokota 3748588Syokota5. In src/gnu/lib/libgcc3/libgcc, do "nbmake-MACHINE obj includes". 3848588Syokota 3983791Ssobomax6. In each of src/lib/csu, src/gnu/lib/libgcc3/libgcc, src/lib/libdes, and 4083791Ssobomax src/lib, do "nbmake-MACHINE all install". 41141929Sbrueffer 4248588Syokota Optionally, all of the following may be set in the environment to reduce 4348588Syokota the amount of code needed to build at this step. Basically, it must be 4448588Syokota possible for static binaries to build and base system libs to exist so 4548588Syokota that "configure" can do its job for the target--these MK* options omit 4648588Syokota the rest for this stage of the build. 4748588Syokota 4848588Syokota MKCRYPTO=no 49119768Sroam MKLINT=no 5048588Syokota MKPROFILE=no 5148588Syokota MKSHARE=no 5282399Ssobomax 5356190Sasmodai7. In src/tools/gcc, do "nbmake-MACHINE native-gcc". 5456190Sasmodai 5556190Sasmodai This will do a full configury in ${.OBJDIR}/.native that is a "Canadian" 5656190Sasmodai cross toolchain (--build reflects the host platform, but --host and 5748588Syokota --target are the target). The result is a tree that would build a 5856190Sasmodai native-to-NetBSD compiler on a cross host, and mknative pulls glue data 5984877Syokota from this. 6084877Syokota 6184877Syokota8. Try out a full build using "nbmake-MACHINE"; the result should include 6284877Syokota a native compiler. 6384877Syokota 64197109Sdelphij9. If all is well, commit the glue files added to src/gnu/{lib,usr.bin}/*. 65268946Semaste 66268946Semaste- tv@NetBSD.org 67268946Semaste