From owner-freebsd-current@FreeBSD.ORG Thu Jan 12 11:50:27 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48C14106564A for ; Thu, 12 Jan 2012 11:50:27 +0000 (UTC) (envelope-from ray@freebsd.org) Received: from smtp.dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id 55BF38FC12 for ; Thu, 12 Jan 2012 11:50:26 +0000 (UTC) Received: from terran.dlink.ua (unknown [192.168.10.90]) by smtp.dlink.ua (Postfix) with SMTP id D36A1C492D; Thu, 12 Jan 2012 13:34:46 +0200 (EET) Date: Thu, 12 Jan 2012 13:36:05 +0200 From: Aleksandr Rybalko To: Luigi Rizzo Message-Id: <20120112133605.c1cba15b.ray@freebsd.org> In-Reply-To: <20120112111757.GA12063@onelab2.iet.unipi.it> References: <20120112081139.GA9921@onelab2.iet.unipi.it> <20120112101653.57decd32@ernst.jennejohn.org> <20120112100601.GA11325@onelab2.iet.unipi.it> <20120112101739.GA11498@onelab2.iet.unipi.it> <20120112122250.03176f4a.ray@dlink.ua> <20120112111757.GA12063@onelab2.iet.unipi.it> Organization: FreeBSD Project X-Mailer: Sylpheed 2.7.1 (GTK+ 2.20.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , current@freebsd.org Subject: Re: kernel config files outside of sys/${ARCH}/conf ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 11:50:27 -0000 On Thu, 12 Jan 2012 12:17:57 +0100 Luigi Rizzo wrote: >> On Thu, Jan 12, 2012 at 12:22:50PM +0200, Aleksandr Rybalko wrote: >> > On Thu, 12 Jan 2012 11:17:39 +0100 >> > Luigi Rizzo wrote: >> > >> > >> On Thu, Jan 12, 2012 at 01:55:39AM -0800, Garrett Cooper wrote: >> > >> > On Thu, Jan 12, 2012 at 2:06 AM, Luigi Rizzo >> > >> > wrote: >> > >> > > On Thu, Jan 12, 2012 at 10:16:53AM +0100, Gary Jennejohn >> > >> > > wrote: >> > >> > >> On Thu, 12 Jan 2012 09:11:39 +0100 >> > >> > >> Luigi Rizzo wrote: >> > >> > >> >> > >> > >> > usr/sbin/config assumes that the kernel config file >> > >> > >> > lives in ${src_base}/sys/${arch}/conf , which means that >> > >> > >> > if you need to build a custom kernel one needs RW >> > >> > >> > access to that directory. >> > >> > >> > >> > >> > >> > Any idea on how we can enable config to work in a >> > >> > >> > generic directory ? >> > >> > >> > >> > >> > >> > I scanned the source code usr.sbin/config and found that >> > >> > >> > it uses hardwired paths -- specifically, it looks for >> > >> > >> > the kernel source tree in "../.." and has multiple >> > >> > >> > hardwired paths such as "../../conf/". >> > >> > >> > There is also a somewhat undocumented access to a >> > >> > >> > file called DEFAULTS that extends the configuration you >> > >> > >> > pass. >> > >> > >> > >> > >> > >> > Any objections to the addition of a "-s" option to config >> > >> > >> > (8) to specify the location of the source tree ? >> > >> > >> > >> > >> > >> >> > >> > >> Seems like a good idea to me as long as the old behavior is >> > >> > >> kept. >> > >> > > >> > >> > > of course :) >> > >> > >> > >> > Why not just set KERNCONFDIR? >> > >> >> > >> The variable does not seem to be used by usr/sbin/config >> > >> >> > >> cheers >> > >> luigi >> > >> _______________________________________________ >> > >> freebsd-current@freebsd.org mailing list >> > >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> > >> To unsubscribe, send any mail to >> > >> "freebsd-current-unsubscribe@freebsd.org" >> > >> > Hi, >> > >> > ZRouter.org use just full path to config file >> > make KERNCONF=/path/to/config buildkernel >> >> It does not work: >> >> > ls -l /home/luigi/FreeBSD/pico9/qemu/PICOBSD.amd64 >> -rw-r--r-- 1 luigi wheel 4285 Jan 12 >> 11:32 /home/luigi/FreeBSD/pico9/qemu/PICOBSD.amd64 >> > make KERNCONF=/home/luigi/FreeBSD/pico9/qemu/PICOBSD.amd64 >> > buildkernel >> ERROR: Missing kernel configuration file(s) >> (/home/luigi/FreeBSD/pico9/qemu/PICOBSD.amd64). >> >> As i said, the hardwired paths in config suggest that there is >> a requirement that the config lives under the source tree and >> cannot be in a completely arbitrary position. My tests confirm that. >> So, KERNCONF=/path/to/config only works for certain values of >> /path/to/config . >> >> Of course i may be wrong but if you have direct experience >> in building a kernel whose config file name is /tmp/NOT_GENERIC >> please let me know how you do it. >> >> cheers >> luigi >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to >> "freebsd-current-unsubscribe@freebsd.org" Oh, yes, sorry, I forgot about Makefile.inc1 changes. Her it is: Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 229577) +++ Makefile.inc1 (working copy) @@ -29,6 +29,7 @@ # /usr/share/mk. These include: # obj depend all install clean cleandepend cleanobj +SRC_ROOT=${.CURDIR} # You are supposed to define both of these when calling Makefile.inc1 # directly. However, some old scripts don't. Cope for the moment, but # issue a new warning for a transition period. @@ -215,6 +216,7 @@ CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ MACHINE_ARCH=${TARGET_ARCH} \ MACHINE=${TARGET} \ + SRC_ROOT=${.CURDIR} \ CPUTYPE=${TARGET_CPUTYPE} .if ${OSRELDATE} < 700044 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib @@ -381,6 +383,7 @@ mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ -p ${WORLDTMP}/usr/include >/dev/null .endif + mkdir -p ${WORLDTMP}/legacy/usr/include/lzma >/dev/null _legacy: @echo @echo "--------------------------------------------------------------" @@ -768,12 +771,19 @@ BUILDKERNELS= INSTALLKERNEL= .for _kernel in ${KERNCONF} +__absolute=${_kernel:C/^\/.*$/abs/} .if exists(${KERNCONFDIR}/${_kernel}) BUILDKERNELS+= ${_kernel} .if empty(INSTALLKERNEL) INSTALLKERNEL= ${_kernel} .endif +.elif exists(${_kernel}) && ${__absolute} == "abs" +# Kernel config with absolute path +BUILDKERNELS+= ${_kernel} +.if empty(INSTALLKERNEL) +INSTALLKERNEL= ${_kernel} .endif +.endif .endfor # @@ -798,17 +808,24 @@ @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @echo "===> ${_kernel}" - mkdir -p ${KRNLOBJDIR} + mkdir -p ${KRNLOBJDIR}/${_kernel} .if !defined(NO_KERNELCONFIG) @echo @echo "--------------------------------------------------------------" @echo ">>> stage 1: configuring the kernel" @echo "--------------------------------------------------------------" +.if ! empty(_kernel:S/^\/.*$//) cd ${KRNLCONFDIR}; \ PATH=${TMPPATH} \ config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ ${KERNCONFDIR}/${_kernel} +.else + cd ${KRNLCONFDIR}; \ + PATH=${TMPPATH} \ + config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ + ${_kernel} .endif +.endif .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) @echo @echo "--------------------------------------------------------------" P.S. somewhere I else have patch to zrouter which allow do same w/o Makefile.inc1 modification posted by Luiz Otavio O Souza, but I can't find it right now :) WBW -- Aleksandr Rybalko