Subject: Re: building for multiple archs from a read-only tree
To: Rob Healey <rhealey@norstar.com>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 03/29/2001 16:38:50
(just re-visiting old e-mail...)

[ On Thursday, December 21, 2000 at 20:04:27 (-0600), Rob Healey wrote: ]
> Subject: building for multiple archs from a read-only tree
>
> 	The standard "make obj" process seems to need a writable source
> 	tree in order to work.

True.  However with a *standard* "obj" link target, i.e. one that points
to the same directory no matter what the value of $MACHINE, it's
possible.

Note that the BSDOBJDIR directory can indeed be a symbolic link itself
too.

So, if "BSDOBJDIR=/var/NetBSD-obj" (for example), and you run "make obj"
*before* you make your media writable then you can do builds.  The only
problem is that to make a CD that would work on all architectures you'd
have to run "make obj" for every MACHINE because there are always some
directories that are not traversed during "make obj".  Perhaps if all of
the architecture-dependent makefiles could be taught to ignore
${MACHINE} (or treat it as "all") when the target is "obj" then this
would be easier too.

On at least i386, and probably most others, you also have to set
KERNOBJDIR to something sensible, such as:  ${BSDOBJDIR}/arch/compile

The trick is *not* to use OBJMACHINE or USR_OBJMACHINE.  The first would
require a "make obj" for every target MACHINE, and the latter requires
OBJMACHINE if you're sharing the same source tree (eg. via NFS).  (Well
until the issue above is corrected you have to do a "make obj" for every
target MACHINE anyway, but it's still pretty pointless to have a whole
raft of obj.* symlinks all pointing at the same place.)

This is, BTW, the way the 4.4BSD CDROMs where shipped (with
BSDOBJDIR=/usr/obj and all symlinks already created).  Of course they
didn't ship many "obj" symlinks in any of the sys/*/stand
subdirectories.

> 	My old meathod of building 3 archs at the same time was to NFS
> 	export the source tree read-only and then use union mounts on
> 	the 3 different archs to build all 3 at the same time from the same
> 	source tree without nasty things like following bad symlinks happening.

I'm doing that now, with mk.conf settings as described above, but
without the union mounts -- just a different (and usually local)
/var/obj on each build machine.  I'm running at least a couple of the
builds mostly myself too (i.e. not as root).

Well, actually I have not yet gone so far as to use a read-only NFS
mount, but maybe I'll try that on the sparc-20 with the second full
"make build" after the first one finally succeeds all the way through.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>