Subject: Re: objdirs and readonly /usr/src
To: NetBSD Current <current-users@NetBSD.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: current-users
Date: 02/21/2004 15:57:31
On Sat, Feb 21, 2004 at 13:35:15 +0100, Johnny Billquist wrote:

> > >  cc  -O -o nbmake *.o
> > >  #    objdir  /usr/obj/tools
> > >  ln: obj: Read-only file system
> > >
> > > Which I assume is because build.sh can't make symlinks in /usr/src.
> > >
> > > Have I missed something?
> > > I'm starting to think rsync would be less hassle :)
> >
> > Hmm, I build from readonly sources all the time.  What do you have in
> > your mk.conf?   Sounds like you have some *OBJ* var set in there.
> 
> No, he have a silly problem that there is no one obvious right solution
> to.
> 
> As a part of building, you want to create symlinks from the whole /usr/src
> tree to somewhere local. So you create an obj symlink in every directory,
> pointing at somewhere local, writeable. But the creation of the actual
> symlink itself requires write access to the source directory.

What you describe is only one way to use objdirs, that indeed requires
write permissions to create obj symlinks in the src tree.  But the
build process can use a method, that doesn't require obj symlinks at
all.  E.g. on my FreeBSD build box:

    $ cd /nb/src
    $ find . -name obj
    $ mount | grep /nb 
    <above>:/export/netbsd/cvs on /nb (union, local, read-only, noclusterw)

I build with a small wrapper around build.sh that does, effectively:

b=/usr/nb
m="$1"
./build.sh -m $m			\
        -T $b/tools -R $b/release	\
        -O $b/obj/$m -D $b/distrib/$m	\
        "$@"


You can check share/mk/bsd.README (section about bsd.obj.mk) for
details on objdirs.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen