On Mon, Feb 25, 2008 at 5:35 AM, Travers Buda <[EMAIL PROTECTED]> wrote:

>  Why on earth are you bothering with this?  Please don't tell me
>  it's for security, because that would be inane.

I have a heterogeneous collection of machines on which I run OpenBSD,
both amd64 and i386.
I have separate build machines for each architecture.
I would vastly  prefer to download the source once, put it on a local
NAS, and have each build machine build the release it needs.

In my experience, this doesn't work at all if the build processes
writes into the src tree itself, and historically I have had to keep a
"virgin" source tree, and copy to each build machine, which takes a
long time, and it is really kind of a pain to maintain the consistency
of 3 copies.

While choosing to avoid the use of the (inflammatory) word "inane", I
find it curious that in following the proscribed procedure for
building a release, I have ALREADY built a new kernel for this
architecture (which is basically the first step before building
userland,
and then onto the release itself), (and in my case, I have already
built both the GENERIC and GENERIC.MP kernels), that the Makefile.inc
in /usr/src/etc/etc.amd64 goes ahead and does:

    #       $OpenBSD: Makefile.inc,v 1.7 2006/07/27 02:53:55 deraadt Exp $

    .ifdef DESTDIR
    snap_md: bsd bsd.mp bootblocks distrib
        cp ${.CURDIR}/../sys/arch/amd64/compile/GENERIC/bsd \
            ${DESTDIR}/snapshot/bsd
        cp ${.CURDIR}/../sys/arch/amd64/compile/GENERIC.MP/bsd \
            ${DESTDIR}/snapshot/bsd.mp

    bsd:
        cd ${.CURDIR}/../sys/arch/amd64/conf && config GENERIC
        cd ${.CURDIR}/../sys/arch/amd64/compile/GENERIC && \
            ${MAKE} clean && ${MAKE} depend && exec ${MAKE}

    bsd.mp:
        cd ${.CURDIR}/../sys/arch/amd64/conf && config GENERIC.MP
        cd ${.CURDIR}/../sys/arch/amd64/compile/GENERIC.MP && \
            ${MAKE} clean && ${MAKE} depend && exec ${MAKE}

    bootblocks:
        cp ${DESTDIR}/usr/mdec/pxeboot ${DESTDIR}/snapshot
        cp ${DESTDIR}/usr/mdec/cdboot ${DESTDIR}/snapshot
        cp ${DESTDIR}/usr/mdec/cdbr ${DESTDIR}/snapshot

    .PHONY: bsd bsd.mp bootblocks

    .endif  # DESTDIR check

(I discovered this makefile AFTER I had sent my email last night....)

Anyway, it looks like one possible solution to my question would be to
modify this file so that
the bsd and bsd.mp targets are either no-ops, or perform their make in
the previously generated kernel build directories,
and then to change the snap_md  target to copy the resulting bsd files
out of these build directories, and not from the middle
of the source tree.  Of course, I'll have to do this again for the the
comparable i386 Makefile.inc.  It would be preferable if the makefile
would check an environment variable for the location of where it
should actually compile things (outside of the src tree!)
and do it there.  If unset, the Makefile could continue to pollute the
source tree with its builds, if that is what you want.

Questions:

Is there any other way (a better way?) to do what I am looking for?

What other compiles does "make release" perform that involve writing
into the source tree?

Thanks!

Don


> * Don Jackson <[EMAIL PROTECTED]> [2008-02-24 23:27:31]:
>
>
>
>  > The FAQ describes two ways to build the kernel (
>  > http://www.openbsd.org/faq/faq5.html#BldKernel ),
>  >
>  >       # cd /usr/src/sys/arch/i386/conf
>  >       # config GENERIC
>  >       # cd ../compile/GENERIC
>  >       # make clean && make depend && make
>  >
>  > or
>  >     Variation on above process: Read-only source tree
>  >     Sometimes, you may wish to ensure your /usr/src/sys directory
>  > remains untouched. This can be done by using the following process:
>  >        $ cd /somewhere
>  >        $ cp /usr/src/sys/arch/i386/conf/GENERIC .
>  >        $ config -s /usr/src/sys -b . GENERIC
>  >        $ make clean && make depend && make
>  >
>  > I would like "make release" to use the "read only source tree" variant
>  > above, how can I accomplish this?
>  >
>  > Right now, I see "make release" do:
>  >
>  >     cd /home/4.2/src/etc/../sys/arch/amd64/conf && config GENERIC
>  >
>  > Which is going to attempt to build the GENERIC kernel right there in
>  > my source tree.
>  >
>  > Also, I am having some other weird problem, due to the following logic
>  > in the Makefile.amd64  which contains:
>  >
>  >      # source tree is located via $S relative to the compilation directory
>  >      .ifndef S
>  >      S!=     cd ../../../..; pwd
>  >      .endif
>  >      AMD64=  $S/arch/amd64
>  >
>  > For some reason the above is setting my AMD64 to some weird path that
>  > is not correct on my system, namely:
>  >
>  >    cd /home/4.2/src/etc/../sys/arch/amd64/conf && config GENERIC
>  >     GENERIC:13: cannot open ../../../../arch/amd64/conf/files.amd64
>  > for reading: No such file or directory
>  >
>  >     *** Error code 1
>  >
>  >     Stop in /home/4.2/src/etc (line 11 of etc.amd64/Makefile.inc).
>  >
>  > What is the point of the above, and how can I get the path correct for
>  > this build?
>  >
>  > Thanks,
>  >
>  > Don
>  >
>  >
>
>  Why on earth are you bothering with this?  Please don't tell me
>  it's for security, because that would be inane.
>
>  --
>  Travers Buda

Reply via email to