From owner-freebsd-arch@FreeBSD.ORG Tue Jul 22 08:31:17 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 683) id 7A31E37B401; Tue, 22 Jul 2003 08:31:17 -0700 (PDT) Date: Tue, 22 Jul 2003 08:31:17 -0700 From: Eivind Eklund To: arch@FreeBSD.org Message-ID: <20030722083117.A36628@FreeBSD.org> References: <20030721080836.GF917@funkthat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030721080836.GF917@funkthat.com>; from gurney_j@efn.org on Mon, Jul 21, 2003 at 01:08:36AM -0700 Subject: Re: module opt_* building X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2003 15:31:17 -0000 --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 21, 2003 at 01:08:36AM -0700, John-Mark Gurney wrote: > I recently realized that for kernel module building, we can simply create > a symlink pointing to the opt_*.h file created by config. (See attached > patch.) > > This only is part of the work. The problem is that the modules/Makefile's > define a target, which needs to be overriden in the case of being built > as part of the kernel, and left intact when building standalone. > > The only thing I can think of is to add a opt_xxx.h_def or something > similar to the target in the modules/Makefile, and then add a dependancy > on that target in the standalone case. > > I have thought about a way to automate building of these options. It'd > require setting up a file with defaults to build from. Extending options > files? Yet another place to list options doesn't seem like a good idea. > > Comments? The attached patch is a year-old attempt to deal with the same case; I had some problems with it, but don't remember what exactly it was (some weird error, I remember...) I'd think the infrastructure should probably be extended so each module can contain a file 'config' which contains suitable kernel config fragments to build that module, and which is run alongside a normal config for that module. Not quite sure what implementation to use for this - possibly a new way of running config(8) to generate a suitable build space for each module? Eivind. --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="modules-with-kernel-options.patch" Index: conf/Makefile.i386 =================================================================== RCS file: /home/ncvs/src/sys/conf/Makefile.i386,v retrieving revision 1.255 diff -u -r1.255 Makefile.i386 --- conf/Makefile.i386 20 Feb 2002 23:35:49 -0000 1.255 +++ conf/Makefile.i386 2 Mar 2002 14:48:10 -0000 @@ -30,7 +30,8 @@ .endif .include "$S/conf/kern.pre.mk" -MKMODULESENV+= MACHINE=i386 +KERNCOMPILEDIR!=pwd +MKMODULESENV+= MACHINE=i386 KERNCOMPILEDIR=${KERNCOMPILEDIR} %BEFORE_DEPEND Index: conf/kmod.mk =================================================================== RCS file: /home/ncvs/src/sys/conf/kmod.mk,v retrieving revision 1.113 diff -u -r1.113 kmod.mk --- conf/kmod.mk 1 Mar 2002 01:21:29 -0000 1.113 +++ conf/kmod.mk 13 Mar 2002 14:13:20 -0000 @@ -93,15 +93,20 @@ .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S -CFLAGS+= ${COPTS} -D_KERNEL ${CWARNFLAGS} -CFLAGS+= -DKLD_MODULE # Don't use any standard or source-relative include directories. # Since -nostdinc will annull any previous -I paths, we repeat all # such paths after -nostdinc. It doesn't seem to be possible to # add to the front of `make' variable. _ICFLAGS:= ${CFLAGS:M-I*} -CFLAGS+= -nostdinc -I- ${INCLMAGIC} ${_ICFLAGS} +#CFLAGS= ${COPTFLAGS} -D_KERNEL ${CWARNFLAGS} +CFLAGS+= -D_KERNEL ${CWARNFLAGS} +CFLAGS+= -DKLD_MODULE +CFLAGS+= -nostdinc -I- ${INCLMAGIC} +.if defined(KERNCOMPILEDIR) +CFLAGS+= -I. -I${KERNCOMPILEDIR} -include ${KERNCOMPILEDIR}/opt_global.h +.endif +CFLAGS+=${_ICFLAGS} # Add -I paths for system headers. Individual KLD makefiles don't # need any -I paths for this. Similar defaults for .PATH can't be --WIyZ46R2i8wDzkSu--