Re: buildworld via ro mounted /usr/src

2002-02-02 Thread Simon 'corecode' Schubert

On Fri, 1 Feb 2002 15:03:32 -0800 "Crist J. Clark"
<[EMAIL PROTECTED]> wrote:

> > The build procedure should be done as usual --
> > # make (env variables if not given in /etc/make.conf) -j4 buildworld
> > # make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf -j4
> > buildkernel# make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf
> > installkernel and so on...
> 
> No, I was confused. I thought we were discussing how to do an "old
> fashioned" kernel build in a read-only /usr/src/sys.

thanks for your replies ;]
actually the main problem was make needing MAKEOBJDIRPREFIX set as env var. perhaps 
there is a way to specify something like WRKDIRPREFIX (ports') for bsd.obj.mk.
after setting MAKEOBJDIRPREFIX to the right path and really cleaning /usr/src i was 
able to build world + kernel on a readonly /usr/src. though i needed to do
env MAKEOBJDIRPREFIX=/usr/obj/i386/k7 make buildworld -j4
 builds bootstrap tools, somewhere bails out on a rm i think.
env MAKEOBJDIRPREFIX=/usr/obj/i386/k7 make buildworld -j4 -DNOCLEAN
 then works as desired.
env MAKEOBJDIRPREFIX=/usr/obj/i386/k7 make buildkernel -j4
 works right out-of-the-box.

cheerz
  corecode

-- 
/"\   http://corecode.ath.cx/
\ /
 \ ASCII Ribbon Campaign
/ \  Against HTML Mail and News



msg31353/pgp0.pgp
Description: PGP signature


Re: buildworld via ro mounted /usr/src

2002-02-01 Thread Crist J. Clark

On Fri, Feb 01, 2002 at 10:54:55PM +0100, BOUWSMA Beery wrote:
> 
> Mahlzeit!
> %s wrote on %.3s, %lld Sep 1993

Hrm?

> > > 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
> 
> > Or you can just use the 'kernel,' 'buildkernel,' and 'installkernel'
> > targets in the /usr/src Makefiles.
> 
> Erm...  now I'm confused.  I'm not sure what I should think that you
> thought that I meant to say if I didn't mean what I meant or wasn't
> clear in saying what I should have said but might not have.
> 
> The build procedure should be done as usual --
> # make (env variables if not given in /etc/make.conf) -j4 buildworld
> # make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf -j4 buildkernel
> # make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf installkernel
> and so on...

No, I was confused. I thought we were discussing how to do an "old
fashioned" kernel build in a read-only /usr/src/sys.
-- 
Crist J. Clark | [EMAIL PROTECTED]
   | [EMAIL PROTECTED]
http://people.freebsd.org/~cjc/| [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: buildworld via ro mounted /usr/src

2002-02-01 Thread BOUWSMA Beery


Mahlzeit!
%s wrote on %.3s, %lld Sep 1993

> > 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

> Or you can just use the 'kernel,' 'buildkernel,' and 'installkernel'
> targets in the /usr/src Makefiles.

Erm...  now I'm confused.  I'm not sure what I should think that you
thought that I meant to say if I didn't mean what I meant or wasn't
clear in saying what I should have said but might not have.

The build procedure should be done as usual --
# make (env variables if not given in /etc/make.conf) -j4 buildworld
# make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf -j4 buildkernel
# make KERNCONF=FreeBEER KERNCONFDIR=/usr/local/etc/conf installkernel
and so on...

Our victim didn't say in his original message whether he is trying to
accomplish this read-only /usr/src build with -current or -stable.
With -current, the above commands work.  With -stable, only
# make KERNCONF=FreeBEER buildkernel
can be used, as far as I know.  I couldn't figure out how to place my
kernel configuration file anywhere outside /usr/src/sys/i386/conf/ .

Now, the way I see it, our victim has three options with -stable, which
I'm assuming he's using:
1)  On the central fileswerver, create config files in /usr/src/sys/i386/conf
(or alpha or wherever) for each unique machine to be built.
2)  On each machine, mount_unionfs some directory atop /usr/src/sys/ARCH/conf
and put that machine's kernel config file there, except that union mounts,
while it may work in this case, may not work reliably.  Heck, in this case
a mount_nullfs mount should be fine...
3)  On each machine, set aside a directory (like in /usr/local/etc/conf)
and customize the kernel config file there, but to the best of my
knowledge, in order to get -stable to *use* KERNCONF somewhere other
than /usr/src/sys/ARCH/conf, you need to borrow KERNCONFDIR from -current.
If not, I'd appreciate being corrected.

The question is whether the kernel config file should be local to each
machine, or if all should be collected on the central fileswerver, in
which case nothing unusual need be done.

Or did you mean something else entirely?


barry bouwsma


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: buildworld via ro mounted /usr/src

2002-02-01 Thread Crist J. Clark

On Thu, Jan 31, 2002 at 10:20:01AM +0100, BOUWSMA Beery wrote:
[snip]

> 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. 

Or you can just use the 'kernel,' 'buildkernel,' and 'installkernel'
targets in the /usr/src Makefiles.
-- 
Crist J. Clark | [EMAIL PROTECTED]
   | [EMAIL PROTECTED]
http://people.freebsd.org/~cjc/| [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: buildworld via ro mounted /usr/src

2002-01-31 Thread BOUWSMA Beery


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-DISTMon 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message