Date: Mon, 1 Jun 1998 21:04:15 +0200 From: Eivind Eklund <eivind@yes.no> To: Richard Wackerbarth <rkw@dataplex.net> Cc: current@FreeBSD.ORG Subject: Re: How about /usr/ports/kernel ? Message-ID: <19980601210415.48779@follo.net> In-Reply-To: <l03130303b197eeb76060@[208.2.87.10]>; from Richard Wackerbarth on Mon, Jun 01, 1998 at 06:31:33AM -0500 References: <l03130310b196ef2053d9@[208.2.87.10]>; <l03130309b195d4c6fd5b@[208.2.87.10]>; <199805301346.PAA29505@labinfo.iet.unipi.it>; <199805301346.PAA29505@labinfo.iet.unipi.it> <19980530182913.04478@follo.net> <l03130309b195d4c6fd5b@[208.2.87.10]> <19980531052120.41610@follo.net> <l03130310b196ef2053d9@[208.2.87.10]> <19980531235232.04296@follo.net> <l03130303b197eeb76060@[208.2.87.10]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 01, 1998 at 06:31:33AM -0500, Richard Wackerbarth wrote: > At 9:52 PM -0000 5/31/98, Eivind Eklund wrote: > >However, to be able to do automated kernel builds we have to have a > >way of specifying which kernels to build which do not come as a shock > >to our userbase (this is a political necessity; I don't think either > >of us would get any way arguing otherwise). This probably mean that > >we'll have to support the use of config(8) in the way it is presently > >used for a transition period of at least a year. > > Not necessarily. Consider the following strategy: > (1) Replace "config" with a shell script that > (a) copies the configuration file to .../src/sys/compile hierarchy > (b) issues a message reminding the user that the procedure for > building a kernel has been slightly modified, and perhaps > (c) does a "make" in the newly constructed target area. > (2) (To avoid confusion) Rename the present "config" and modify > it to be a tool for the new structure. It would fit in, in a > manner similar to yacc, to be called where needed. This blows my present cross-builds (to 2.2) away, at least. Not good, as that probably means that it blows other people's builds, too. I proposed something similar to this as a solution for mknod - jkh shot me down (and with good reason, I might add). We need something that don't blow away our users - which I believe unfortunately mean we'll need to build compatibility into config for a while :-( > As far as "automatic kernel build" is concerned, I think that this can > be handled by having an optional Makefile.inc in the src/sys structure > that adds SUBDIR's for the desired kernels. > We could always use "SUBDIR?= GENERIC" to provide the default. This doesn't mesh with the use of 'SUBDIR' presently. Possibly we could add a 'beforesubdir' target that are responsible for making sure there are a subdir in either ${.OJDIR} or ${.CURDIR}, but I'm not certain how easy this will be. Something like the patches at the end _might_ work (but is completely untested). Now, to be able to do this with config files located other places that sys/<arch>/conf, we need to be able to specify different paths for the kernel config, and for the destination directory. Patches to usr.sbin/config is at the end (compiles, but otherwise untested). This leaves us with a fairly simple sys/compile/Makefile, something like the following (again, completely untested): # Copyright (C) 1998, Eivind Eklund. All rights reserved. # You're hereby granted the right to do anything with this, as long as # you don't attempt to hold me responsible for it. .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" .endif # Uncomment this to make the system default to building GENERIC #SUBDIR?=GENERIC beforesubdir: realbeforesubdir .include <bsd.subdir.mk> realbeforesubdir: @for entry in ${SUBDIR} ${_SUBDIR_EXTRA}; do \ (if ! (test -f ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop && \ grep -w $${entry} \ ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop \ > /dev/null); then \ (cd ${.CURDIR}/../$$(awk \ '/^machine/ {print ($2 ~ /^\".*\"$/) ? substr($2, 2, length($2)-2) : \ $2}' ${.CURDIR}/configs/$${entry})/conf && \ config -f ${.CURDIR}/configs/$${entry} \ -o ${.OBJDIR} $${entry}); \ fi); \ done; How does the above look? The extra interpretation of subdirdrop is dirty, as is the need for having targets after the include - the former I think can be fixed, the latter probably be very, very difficult (unless I'm misrememebering the order of evaluation in make - then it can just be moved :-) > >Do you disagree with the way of adding this meta-information to > >contributed subsystems? I'm all ears for anything better that give > >the same capabilites for external people modifying the system - I just > >haven't found any better way. > > As I have previously stated, I view the kernel in the same way that > I view a user-level command. It may require a few unique variants. > However, it is fundamentally, source (compiled) into object (linked) > into executable (loaded) for execution > > I see the inclusion of kernel components fitting in in a manner analogous > to the "contrib" structure. Can you give a _concrete_ proposal for how to solve this, presently for the kernel only? We need the capabilities outlined, and we've needed them for a while. I hope to avoid the use of a temporary measure here, so if you've got any ideas we can use to solve this to be compatible with a future generic way... > Summary: > Think "Lego", or, for those old enough to remember, the A.C. Gilbert > "Erector" sets rather than "Microsoft". However, _also_ think efficiency. These are often somewhat at odds. Eivind. Index: share/mk/bsd.subdir.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.subdir.mk,v retrieving revision 1.24 diff -u -r1.24 bsd.subdir.mk --- bsd.subdir.mk 1998/05/06 16:53:53 1.24 +++ bsd.subdir.mk 1998/06/01 18:42:31 @@ -39,18 +39,22 @@ .MAIN: all -.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ - exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) +.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) +.if exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) SUBDIR!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist .endif -.if defined(SUBDIR_CHANGE) && !empty(SUBDIR_CHANGE) && \ - exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) +.if exists(${SUBDIR_CHANGE}/${DIRPRFX}/subdirlist) _SUBDIR_EXTRA!=cat ${SUBDIR_CHANGE}/${DIRPRFX}/subdiradd +SUBDIR=${SUBDIR} ${_SUBDIR_EXTRA} .endif +# Should really fix up SUBDIR to respect "subdirdrop" here, instead of +# requiring it in the loops +.endif + _SUBDIRUSE: .USE - @for entry in ${SUBDIR} ${_SUBDIR_EXTRA}; do \ + @for entry in ${SUBDIR}; do \ (if ! (test -f ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop && \ grep -w $${entry} \ ${SUBDIR_CHANGE}/${DIRPRFX}/subdirdrop \ @@ -60,10 +64,19 @@ "===> ${DIRPRFX}$${entry}.${MACHINE}"; \ edir=$${entry}.${MACHINE}; \ cd ${.CURDIR}/$${edir}; \ - else \ + elif test -d ${.OBJDIR}/$${entry}.${MACHINE}; then \ + ${ECHODIR} \ + "===> ${DIRPRFX}$${entry}.${MACHINE}"; \ + edir=$${entry}.${MACHINE}; \ + cd ${.OBJDIR}/$${edir}; \ + elif test -d ${.CURDIR}/$${entry}; then \ ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ edir=$${entry}; \ cd ${.CURDIR}/$${edir}; \ + elif \ + ${ECHODIR} "===> ${DIRPRFX}$$entry"; \ + edir=$${entry}; \ + cd ${.OBJDIR}/$${edir}; \ fi; \ ${MAKE} ${.TARGET:realinstall=install} \ SUBDIR_CHANGE=${SUBDIR_CHANGE} \ @@ -72,7 +85,7 @@ ); \ done -${SUBDIR}:: +${SUBDIR}:: beforesubdir @if test -d ${.TARGET}.${MACHINE}; then \ cd ${.CURDIR}/${.TARGET}.${MACHINE}; \ else \ @@ -84,9 +97,13 @@ .for __target in all checkdpadd clean cleandepend cleandir depend lint \ maninstall obj objlink regress tags .if !target(${__target}) -${__target}: _SUBDIRUSE +${__target}: beforesubdir .WAIT _SUBDIRUSE .endif .endfor + +.if !target(beforesubdir) +beforesubdir: +.endif .if !target(install) .if !target(beforeinstall) Index: usr.sbin/config/config.8 =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/config.8,v retrieving revision 1.10 diff -u -r1.10 config.8 --- config.8 1998/02/18 04:15:03 1.10 +++ config.8 1998/06/01 18:57:31 @@ -40,6 +40,8 @@ .Sh SYNOPSIS .Nm config .Op Fl gpr +.Op Fl f Ar configfile +.Op Fl o Ar directory .Ar SYSTEM_NAME .Sh DESCRIPTION This is the old version of the @@ -72,8 +74,12 @@ Available options and operands: .Pp .Bl -tag -width SYSTEM_NAME +.It Fl f Ar configfile +Use this file as the input filename, instead of ./SYSTEM_NAME .It Fl g Configure a system for debugging. +.It Fl o Ar directory +Use this file as the target directory, instead of ../../compile. .It Fl p Configure a system for profiling; for example, .Xr kgmon 8 Index: usr.sbin/config/main.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/main.c,v retrieving revision 1.24 diff -u -r1.24 main.c --- main.c 1998/05/02 01:57:38 1.24 +++ main.c 1998/06/01 18:55:06 @@ -66,6 +66,7 @@ #endif char *PREFIX; +static char *CDIR = "../../compile/"; static int no_config_clobber = TRUE; int old_config_present; @@ -85,12 +86,20 @@ struct stat buf; int ch; char *p; + char *configfn = NULL; /* filename */ + extern char *optarg; - while ((ch = getopt(argc, argv, "gprn")) != -1) + while ((ch = getopt(argc, argv, "f:go:prn")) != -1) switch (ch) { + case 'f': + configfn = optarg; + break; case 'g': debugging++; break; + case 'o': + CDIR = optarg; + break; case 'p': profiling++; break; @@ -112,8 +121,11 @@ if (argc != 1) usage(); - if (freopen(PREFIX = *argv, "r", stdin) == NULL) - err(2, "%s", PREFIX); + PREFIX = *argv; + if (configfn == NULL) + configfn = PREFIX; + if (freopen(configfn, "r", stdin) == NULL) + err(2, "%s", configfn); p = path((char *)NULL); if (stat(p, &buf)) { @@ -327,9 +339,8 @@ { register char *cp; -#define CDIR "../../compile/" - cp = malloc((unsigned int)(sizeof(CDIR) + strlen(PREFIX) + - (file ? strlen(file) : 0) + 2)); + cp = malloc((unsigned int)(strlen(CDIR) + strlen(PREFIX) + + (file ? strlen(file) : 0) + 3)); (void) strcpy(cp, CDIR); (void) strcat(cp, PREFIX); if (file) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980601210415.48779>