Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: building a kernel "the old way"

    Date:        Wed, 24 May 2017 17:58:51 +0200
    From:        Christian Groessler <>
    Message-ID:  <>

  | But now I just want to compile a modified kernel to check something out. 
  | But the nice, simple, way I was using
  | in older times doesn't work anymore :-(

I build my local kernels "the old way" (or something approaching it
anyway) all the time - it is the way I build my custom kernels, as I
don't put their CONFIG files in src/sys/arch/xxx/conf - they just
live in my home directory (well, in a subdirectory thereof).

I can send you the script I use if you want (off list) - it is fairly
large, but that is mostly because it is trying to deal with building
from a single CONFIG file for almost any NetBSD version (at least from
NetBSD 3 upwards) - and things keep changing..   Most of the complexity
is to deal with that (the config files pass through a whole jungle of
sed scripts).

My script also relies upon having been run previously (or being
able to run) to build the tools, and there being (at least part of) the
resulting DESTDIR available (for 

The actual building part boils down to:

                MAKECONF=/dev/null		# this is just so I am not importing trash
                export MAKECONF
                PATH="${NB_TOOLS}/bin:${PATH}"; export PATH
                USETOOLS=YES; export USETOOLS

		# more stuff that is not very interresting
                "${NB_TOOLS}/bin/nbconfig" &&
                   ${nodepend} ||
                  "${NB_TOOLS}/bin/nbmake-${ARCH}"      \  
                        -m "${NB_DEST}/usr/share/mk"    \
                        ${MKDEP} ${GENASSYM} depend
                } &&    
                "${NB_TOOLS}/bin/nbmake-${ARCH}"        \
                        -m "${NB_DEST}/usr/share/mk"  ${GENASSYM}

What GENASSYM & MKDEP are set to depends upon which version of NetBSD is
being compiled - for current GENASSYM contains
(and to be clear, that is what you get when you execute
I am not saying thet the value of GENASSYM is nbgenassym)

MKDEP is not set for current, but is MKDEP="MKDEP=nbmkdep" for NetBSD7
(why that distinction exists I am not sure, but it works for me to build
both current and NetBSD 7, and earlier 6, and 5 ...)

(GENASSYM has't changed since NetBSD 3 - back then it was empty.)

(nodepend is true if the option to avoid running make depend has been
given to the script, otherwise false).

NB_DEST is the DESTDIR for a previous build of the same version system
(so the appropriate make file fragments can be found.)  NB_TOOLS is the
tools binary directory for the same system.   ARCH should be obvious.

I use the style of building where the CONFIG (called literally "CONFIG")
file goes in the obj directory in which the kernel is being built (and
has "source" and "build" directives included) - the sed jungle takes the
original (randomly named) CONFIG file, mangles it, and places it there.


Home | Main Index | Thread Index | Old Index