Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2002 10:20:01 +0100 (CET)
From:      BOUWSMA Beery <freebsd-user@dcf77-zeit.netscum.dyndns.dk>
To:        hackers@freebsd.org
Cc:        "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
Subject:   Re: buildworld via ro mounted /usr/src
Message-ID:  <200201310920.g0V9K1L00787@beerswilling.netscum.dyndns.dk>
References:  <20020130170244.6f1cdf09.corecode@corecode.ath.cx>

next in thread | previous in thread | raw e-mail | index | archive | help

Moin, moin!
%s wrote on %.3s, %lld Sep 1993

> and building world/kernel via nfs mounts.
> in order not to get things mixed up i share /usr/ports and /usr/src ro and
> /usr/ports/distfiles, /usr/obj rw.

> should work as desired:
> WRKDIRPREFIX set to a reasonable value (depending on arch and cpu) and
> MAKEOBJDIRPREFIX too.

Okay, what, and how?

I just encountered this problem some weeks ago, and found a solution
that seems to work for me, that I'll share with you.  There may be
some subtleties that will later sneak up upon me, but this does work
with a read-only source tree:

As seen in my /etc/make.conf file:
WRKDIRPREFIX=   /usr/obj/ports/${OSREL}
(note that there *are* problems with this in /usr/obj, but I haven't
rediscovered them with this particular incantation, and it keeps a
separate ports build tree for both 4.x and 5.0 that I have on the
same disk which was one of my original goals)
RELNAME!=       /usr/bin/uname -r
MAKEOBJDIRPREFIX?=      /usr/obj/${RELNAME}
                ^^ IMPORTANT!!  WICHTIG!!@!!

This probably failed for you because you set an absolute value for
this (using `=' rather than `?=').  One of the makefiles or mk files
says more about this, as it's something you should use as an `env'
environment variable, as it gets reset in the build process, which
results in the failure you see (and that I saw).

I've used this, and it seems to work just fine.  Again, I do this to
keep a separate build object tree for each of the three OSen on my
disk, for whatever reason.


Now, later, you'll come to the problem that you need to configure
and build a kernel, and if you're trying to do that with a read-only
source, the default location for your kernel config file is within
that.  This is solved in -CURRENT and is trivial to patch -STABLE to
fix.  Then the following lines in /etc/make.conf will work, to allow
you to keep your kernel config outside the source tree, and on your
local machine.  Change as you see fit, and you may give these instead
on the build like like you probably do now (and if you do, it will
override these customized defaults):

KERNCONF?=      FreeBEER
KERNCONFDIR?=   /usr/local/etc/config

For this to work, you need the following patch to /usr/src/Makefile.inc1 :


--- /usr/local/system/src/Makefile.inc1-DIST	Mon Dec 17 16:41:55 2001
+++ /usr/local/source-hacks/Makefile.inc1	Tue Dec 18 07:38:10 2001
@@ -400,11 +400,12 @@
 KRNLSRCDIR=	${.CURDIR}/sys
 KRNLCONFDIR=	${KRNLSRCDIR}/${MACHINE}/conf
 KRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
+KERNCONFDIR?=	${KRNLCONFDIR}
 
 BUILDKERNELS=
 INSTALLKERNEL=
 .for _kernel in ${KERNCONF}
-.if exists(${KRNLCONFDIR}/${_kernel})
+.if exists(${KERNCONFDIR}/${_kernel})
 BUILDKERNELS+=	${_kernel}
 .if empty(INSTALLKERNEL)
 INSTALLKERNEL= ${_kernel}
@@ -438,7 +439,8 @@
 .if !defined(NO_KERNELCONFIG)
 	cd ${KRNLCONFDIR}; \
 		PATH=${TMPPATH} \
-		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
+		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
+			${KERNCONFDIR}/${_kernel}
 .endif
 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
 .if defined(MODULES_WITH_WORLD) || defined(NO_MODULES) || !exists(${KRNLSRCDIR}/modules)


Taken verbatim out of the -current Makefile.inc1

(Someday I'll get off my lazy butt and submit this as a pr, to try
and get it incorporated in -stable, to make my life easier)


> but *somehow* some tools appear to be built into /usr/src and not into /usr/obj
> (as it should be).
> might be that's just the bootstrapping tools,
> but why? and how do i change this behavior?

The key to this is how you've set MAKEOBJDIRPREFIX.


> i didn't find a good (any) guide to this on the net.

Hope my experience (reported to freebsd-bugs a little while back)
helps you out.  It works fine for me...


barry bouwsma, netscum


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201310920.g0V9K1L00787>