This section describes the steps necessary to get a build environment for NetBSD under Windows. This includes a patch for the NetBSD source tree, details of the tools that need to be installed in your Cygwin environment, and a small patch for the Cygwin implementation of CVS to avoid a problem with directory name clashes due to the case insensitive file system on Windows. This work was carried out on a Windows XP Home Edition box; other versions of Windows may not work. If you have an alternate version of Windows, and try this, please let me know what problems you face, and better still any changes you need to make to get it working.
The following table describes the components/packages that must be installed, and the version that I had installed. Additionally, to build the new version of the CVS tools from source, you must installed the source package for CVS.
Component Version ash 20020731-1 autoconf 2.54-1 autoconf-devel 2.57-1 autoconf-stable 2.13-4 automake 1.7.1-1 automake-devel 1.7.3-1 automake-stable 1.4p5-5 base-files 1.3-1 base-passwd 1.1-1 bash 2.05b-9 bc 1.06-1 binutils 20030307-1 bison 20030307-1 byacc 1.9-1 bzip2 1.0.2-2 crypt 1.0-1 cvs 1.11.0-1 cygutils 1.1.3-1 cygwin 1.3.22-1 diffutils 2.8.1-1 fileutils 4.1-1 findutils 4.1.7-4 flex 2.5.4-2 gawk 3.1.2-2 gcc 3.2-3 gcc-mingw 20020817-5 gcc2 2.95.3-10 gdbm 1.8.0-5 grep 2.5-1 gzip 1.3.3-4 less 378-1 libbz2_1 1.0.2-2 libdb3.1 3.1.17-2 libgdbm 1.8.0-5 libgdbm-devel 1.8.0-5 libgdbm3 1.8.3-1 libiconv2 1.8-2 libintl1 0.10.40-1 libintl2 0.11.5-1 libncurses-devel 5.3-1 libncurses5 5.2-1 libncurses6 5.2-8 libncurses7 5.3-1 libpopt0 1.6.4-4 libreadline4 4.1-2 libreadline5 4.3-2 login 1.8-1 m4 1.4-1 make 3.79.1-7 mingw-runtime 2.4-1 mktemp 1.4-1 ncurses 5.3-1 patch 2.5.8-3 pcre 4.1-1 perl 5.8.0-2 readline 4.3-2 sed 4.0.7-1 sh-utils 2.0.15-3 sunrpc 4.0-1 tar 1.13.25-1 termcap 20020930-1 terminfo 5.3-2 texinfo 4.2-4 textutils 2.0.21-1 vim 6.1.300-1 w32api 2.3-1 which 1.5-1 zlib 1.1.4-1 _update-info-dir 00162-1
The Cygwin CVS patch is necessary in order to change the name of the directory placed at each level of the tree to record CVS information from CVS to __CVS. That prevents a clash with the cvs directories that appear in the NetBSD source tree, and also with the cvs command binary. Note: This patch will make any existing CVS trees/repositories on the local machine unusable, so use with care. That said, __CVS is much less likely to clash with any existing files or directories so this change could be useful for other projects forced to use Windows as a development workstation. Additionally, the source that was installed by the Cygwin setup program did not compile out of the box. I had to remove gdbm support. The patch necessary to do this is included below. I recommend placing both patches in the CYGWIN-PATCHES directory that is already present in /usr/src/cvs-1.11.0. To install the source patch, proceed as follows:$ cd /usr/src/cvs-1.11.0 $ patch -R -p1 < CYGWIN-PATCHES/cvs-1.11.0-1-gdbmify.patch $ patch -p1 < CYGWIN-PATCHES/cvs-1.11.0-1-netbsd.patch $ ./configure --prefix=/usr $ make $ make installRecent installations of Cygwin will have cvs-1.11.5-1 instead of cvs-1.11.0-1. This version needs less work to make it re-compile:
$ cd /usr/src/cvs-1.11.5 $ patch -p1 < CYGWIN-PATCHES/cvs-1.11.0-1-netbsd.patch $ ./configure --prefix=/usr $ make $ make install
The Patch
Download the patch from below, and install it over a -current NetBSD source tree as follows:cd src patch -p0 < cygwin-build.patchCheck the output from the patch command to make sure that none of the changes failed. If any did, you might need to manually insert the changes (most are simple). Please also let me know which files were affected so that I can update the patch. The following table documents what I have tested to date:
Machine Build Types Windows
VersionTested By i386 build
kernel=GENERICXP Home JohnGordon ibmnws build
kernel=IBMNWSXP Home JohnGordon Case Insensitive Filename Changes
At the time of writing, two architectures require a small change in the NetBSD tree in order to avoid a problem with the generated objects overwriting each other. Notice that this will affect any platform built using either of these two core architectures. The changes are as follows:
- PowerPC: Rename src/sys/arch/powerpc/powerpc/Locore.c to src/sys/arch/powerpc/powerpc/locore_c.c and change the corresponding reference to it in src/sys/arch/powerpc/conf/files.powerpc.
The acorn26 architecture has already been updated to avoid this problem. No others are believed to be affected.
- SH-3: Rename src/sys/arch/sh3/sh3/Locore.c to src/sys/arch/sh3/sh3/locore_c.c and change the corresponding reference to it in src/sys/arch/sh3/conf/files.sh3.
Building with Cygwin is much the same as building under NetBSD. Simply start a bash session (Cygwin installs the shortcut for bash in the programs menu and optionally on the desktop as well), then proceed as follows (assuming that you plan to use D:\NetBSD for your builds):
$ cd /cygdrive/d/NetBSD
$ CVSROOT=:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot; export CVSROOT
$ cvs login
(Logging in to anoncvs@anoncvs.netbsd.org)
CVS password:
$ cvs checkout -P src
...
$ mkdir i386
$ mkdir i386/tools
$ mkdir i386/obj
$ mkdir i386/root
$ cd src
$ patch -p0 < ../cygwin-build.patch
$ HOST_CC=gcc-2 bash ./build.sh -O /cygdrive/d/NetBSD/i386/obj \
-T /cygdrive/d/NetBSD/i386/tools \
-D /cygdrive/d/NetBSD/i386/root \
-U -m i386 build
...
$ HOST_CC=gcc-2 bash ./build.sh -O /cygdrive/d/NetBSD/i386/obj \
-T /cygdrive/d/NetBSD/i386/tools \
-D /cygdrive/d/NetBSD/i386/root \
-U -m i386 kernel=GENERIC
Important: Make sure that you have installed the new version of the CVS tools before starting this process. The new version must be used when checking out the sources.
cygwin-build.patch: NetBSD Source Tree Patch (20030608)
- cvs-1.11.0-1-netbsd.patch: Cygwin CVS Patch
- cvs-1.11.0-1-gdbmify.patch: Cygwin GDBM Patch
Please enter any feedback you have about this work here. You will need to register with my TWiki system before being allowed to edit or add any information.-- JohnGordon - 09 Jun 2003