Subject: RE: trying build.sh (was: GENERIC won't config?)
To: None <netbsd-help@NetBSD.org>
From: Charles Zmudzinski <brchuck@hotmail.com>
List: netbsd-help
Date: 01/21/2006 20:38:14
>From: "James K. Lowden" <jklowden@schemamania.org>
>Reply-To: netbsd-help@NetBSD.org
>To: netbsd-help@NetBSD.org
>Subject: trying build.sh (was: GENERIC won't config?)
>Date: Sat, 21 Jan 2006 14:00:38 -0500
>
>Quentin Garnier wrote:
> > Please use build.sh when you don't know very precisely what you are
> > doing.
>
>Trying to DTRT without fetching more than I actually need, this is what I
>did.
>
>1.  Naively fetched /usr/src/build.sh with "cvs update build.sh".
>2.  build.sh -h wouldn't run without /usr/src/share, so "cvs update
>share".
>3.  build.sh kernel=CHERRY (my kernel) wanted tools, so "cvs update
>tools".
>4.  build.sh complained about missing /usr/obj, so "mkdir /usr/obj".
>
>build.sh then ran, ending thus:
>
>===> makewrapper:      /usr/src/tooldir.NetBSD-2.0-i386/bin/nbmake-i386
>===> Updated /usr/src/tooldir.NetBSD-2.0-i386/bin/nbmake-i386
>===> Building kernel without building new tools
>#    objdir  /usr/obj/sys/arch/i386/compile
>===> Building kernel:  CHERRY
>===> Build directory:  /usr/src/sys/arch/i386/compile/obj/CHERRY
>rm -f a.out [Ee]rrs mklog core *.core .gdbinit
>./build.sh: /usr/src/tooldir.NetBSD-2.0-i386/bin/nbconfig: not found
>
>Guessing, I tried "./build.sh tools", but no joy:
>
>cc  -O -o nbmake *.o
>#    objdir  /usr/obj/tools
>===> MACHINE:          i386
>===> MACHINE_ARCH:     i386
>===> TOOLDIR path:     /usr/src/tooldir.NetBSD-2.0-i386
>===> DESTDIR path:     /usr/src/destdir.i386
>===> RELEASEDIR path:  /usr/src/releasedir
>===> Created /usr/src/tooldir.NetBSD-2.0-i386/bin/nbmake
>===> makewrapper:      /usr/src/tooldir.NetBSD-2.0-i386/bin/nbmake-i386
>===> Updated /usr/src/tooldir.NetBSD-2.0-i386/bin/nbmake-i386
>nbmake: don't know how to make obj-tools. Stop
>
>If someone has a map and a compass, I'd be more than happy for directions
>out of this thicket.  I don't even know where to look for directions.

It looks to me like you have been populating your /usr/src with current 
versions of the source tree, not 2.0 versions. To get 2.0 versions of the 
sources, you have to do something like

"cvs update -r netbsd-2-0-RELEASE build.sh", not just "cvs update build.sh"

Without the '-r netbsd-2-0-RELEASE' option to cvs update, you get the 
netbsd-current version, not the 2.0 version of the sources. If you have 
updated any of the files in /usr/src/sys with cvs update, but without the -r 
netbsd-2-0-RELEASE option, then you have kernel sources for netbsd-current, 
not for netbsd-2.0. That would also explain why Pavel noted that you must 
have updated your kernel source to 3.0 or -current. So I would just try 
backing up your custom config files in /usr/src/sys/arch/<arch>/conf (like 
CHERRY), and then start over with a fresh /usr/src/sys. Until you know how 
to use cvs to get the correct version of the sources, I would use ftp to get 
the kernel source:

ftp://ftp2.us.netbsd.org/pub/NetBSD/NetBSD-2.0.3/source/sets/syssrc.tgz

I saw that server doesn't have a directory for 2.0 anymore, but 2.0.2 or 
2.0.3 will work fine for you I am sure. If your tools on your system (like 
config) are still the 2.0 versions you should not need to use build.sh.

If you also updated the tools (such as config) you may have to use build.sh 
because you will essentially be cross-compiling your kernel between two 
different versions of netbsd, and that is what build.sh is designed for. The 
downside of that solution is that you will need to download and install all 
the tar files in the NetBSD-2.0.3/source/sets directory (except xsrc.tgz), 
just to build a kernel. It seems like overkill, but for cross-compiling a 
kernel you do need to build the tools, and for that, at the least, you will 
need the src.tgz and gnusrc.tgz sets in addition to the syssrc.tgz set, and 
from what you reported above sharesrc.tgz is also needed. Once the version 
of your toolchain does not match the version of the sources you are 
building, you will need to use build.sh, and I don't think build.sh is 
supported without a complete source tree (all of /usr/src except perhaps the 
xsrc.tgz set, which is only needed if you want to use build.sh to build the 
X11 part of NetBSD). If you do need to use build.sh, the file BUILDING in 
/usr/src is very helpful in learning how to use it. You will see it after 
you extract all the *.tgz files into /usr/src.

Chuck Zmudzinski