summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committersjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit65145fa4c81da358fcbc3b650156dab705dfa34e (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /usr.sbin/config
parent60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff)
parente6b664c390af88d4a87208bc042ce503da664c3b (diff)
downloadFreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip
FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz
Merge sync of head
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/Makefile3
-rw-r--r--usr.sbin/config/Makefile.depend1
-rw-r--r--usr.sbin/config/config.813
-rw-r--r--usr.sbin/config/config.y12
-rw-r--r--usr.sbin/config/configvers.h2
-rw-r--r--usr.sbin/config/main.c23
-rw-r--r--usr.sbin/config/mkmakefile.c24
7 files changed, 57 insertions, 21 deletions
diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile
index 6561989..76712d2 100644
--- a/usr.sbin/config/Makefile
+++ b/usr.sbin/config/Makefile
@@ -13,8 +13,7 @@ CFLAGS+= -I. -I${.CURDIR}
NO_WMISSING_VARIABLE_DECLARATIONS=
-DPADD= ${LIBL} ${LIBSBUF}
-LDADD= -ll -lsbuf
+LIBADD= l sbuf
CLEANFILES+= kernconf.c
diff --git a/usr.sbin/config/Makefile.depend b/usr.sbin/config/Makefile.depend
index 6f629ac..ee946e4 100644
--- a/usr.sbin/config/Makefile.depend
+++ b/usr.sbin/config/Makefile.depend
@@ -12,6 +12,7 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libsbuf \
usr.bin/lex/lib \
+ usr.bin/yacc.host \
.include <dirdeps.mk>
diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8
index bfaded9..dcfbc62 100644
--- a/usr.sbin/config/config.8
+++ b/usr.sbin/config/config.8
@@ -39,6 +39,7 @@
.Op Fl CVgp
.Op Fl I Ar path
.Op Fl d Ar destdir
+.Op Fl s Ar srcdir
.Ar SYSTEM_NAME
.Nm
.Op Fl x Ar kernel
@@ -85,6 +86,10 @@ Note that
does not append
.Ar SYSTEM_NAME
to the directory given.
+.It Fl s Ar srcdir
+Use
+.Ar srcdir
+as the source directory, instead of the default one.
.It Fl m
Print the MACHINE and MACHINE_ARCH values for this
kernel and exit.
@@ -143,6 +148,14 @@ header files,
definitions of
the number of various devices that will be compiled into the system.
.Pp
+The
+.Nm
+utility looks for kernel sources in the directory
+.Pa ../..
+or the one given with the
+.Fl s
+option.
+.Pp
After running
.Nm ,
it is necessary to run
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index 81329d9..c7198a0 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -178,7 +178,7 @@ Config_spec:
} |
OPTIONS Opt_list
|
- NOOPTION Save_id { rmopt_schedule(&opt, $2); } |
+ NOOPTION NoOpt_list |
MAKEOPTIONS Mkopt_list
|
NOMAKEOPTION Save_id { rmopt_schedule(&mkopt, $2); } |
@@ -225,6 +225,11 @@ Opt_list:
Option
;
+NoOpt_list:
+ NoOpt_list COMMA NoOption
+ |
+ NoOption
+ ;
Option:
Save_id {
newopt(&opt, $1, NULL, 0);
@@ -236,6 +241,11 @@ Option:
newopt(&opt, $1, $3, 0);
} ;
+NoOption:
+ Save_id {
+ rmopt_schedule(&opt, $1);
+ };
+
Opt_value:
ID { $$ = $1; } |
NUMBER {
diff --git a/usr.sbin/config/configvers.h b/usr.sbin/config/configvers.h
index 56ca85c..5c29373 100644
--- a/usr.sbin/config/configvers.h
+++ b/usr.sbin/config/configvers.h
@@ -49,5 +49,5 @@
*
* $FreeBSD$
*/
-#define CONFIGVERS 600013
+#define CONFIGVERS 600014
#define MAJOR_VERS(x) ((x) / 100000)
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 86ecfa6..f2d2a70 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -116,7 +116,7 @@ main(int argc, char **argv)
printmachine = 0;
kernfile = NULL;
SLIST_INIT(&includepath);
- while ((ch = getopt(argc, argv, "CI:d:gmpVx:")) != -1)
+ while ((ch = getopt(argc, argv, "CI:d:gmpsVx:")) != -1)
switch (ch) {
case 'C':
filebased = 1;
@@ -144,6 +144,12 @@ main(int argc, char **argv)
case 'p':
profiling++;
break;
+ case 's':
+ if (*srcdir == '\0')
+ strlcpy(srcdir, optarg, sizeof(srcdir));
+ else
+ errx(EXIT_FAILURE, "src directory already set");
+ break;
case 'V':
printf("%d\n", CONFIGVERS);
exit(0);
@@ -180,7 +186,8 @@ main(int argc, char **argv)
len = strlen(destdir);
while (len > 1 && destdir[len - 1] == '/')
destdir[--len] = '\0';
- get_srcdir();
+ if (*srcdir == '\0')
+ get_srcdir();
} else {
strlcpy(destdir, CDIR, sizeof(destdir));
strlcat(destdir, PREFIX, sizeof(destdir));
@@ -275,7 +282,8 @@ static void
usage(void)
{
- fprintf(stderr, "usage: config [-CgmpV] [-d destdir] sysname\n");
+ fprintf(stderr,
+ "usage: config [-CgmpV] [-d destdir] [-s srcdir] sysname\n");
fprintf(stderr, " config -x kernel\n");
exit(EX_USAGE);
}
@@ -314,6 +322,11 @@ begin:
}
cp = line;
*cp++ = ch;
+ /* Negation operator is a word by itself. */
+ if (ch == '!') {
+ *cp = 0;
+ return (line);
+ }
while ((ch = getc(fp)) != EOF) {
if (isspace(ch))
break;
@@ -673,7 +686,7 @@ kernconfdump(const char *file)
{
struct stat st;
FILE *fp, *pp;
- int error, len, osz, r;
+ int error, osz, r;
unsigned int i, off, size, t1, t2, align;
char *cmd, *o;
@@ -701,7 +714,7 @@ kernconfdump(const char *file)
if (pp == NULL)
errx(EXIT_FAILURE, "popen() failed");
free(cmd);
- len = fread(o, osz, 1, pp);
+ fread(o, osz, 1, pp);
pclose(pp);
r = sscanf(o, "%d%d%d%d%d", &off, &size, &t1, &t2, &align);
free(o);
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index cae2efc..0f873c4 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -386,13 +386,9 @@ next:
if (nreqs == 0)
errout("%s: syntax error describing %s\n",
fname, this);
- if (not)
- compile += !match;
- else
- compile += match;
+ compile += match;
match = 1;
nreqs = 0;
- not = 0;
continue;
}
if (eq(wd, "no-obj")) {
@@ -474,19 +470,23 @@ next:
this, wd);
STAILQ_FOREACH(dp, &dtab, d_next)
if (eq(dp->d_name, wd)) {
- dp->d_done |= DEVDONE;
+ if (not)
+ match = 0;
+ else
+ dp->d_done |= DEVDONE;
goto nextparam;
}
SLIST_FOREACH(op, &opt, op_next)
- if (op->op_value == 0 && opteq(op->op_name, wd))
+ if (op->op_value == 0 && opteq(op->op_name, wd)) {
+ if (not)
+ match = 0;
goto nextparam;
- match = 0;
+ }
+ match &= not;
nextparam:;
+ not = 0;
}
- if (not)
- compile += !match;
- else
- compile += match;
+ compile += match;
if (compile && tp == NULL) {
if (std == 0 && nreqs == 0)
errout("%s: what is %s optional on?\n",
OpenPOWER on IntegriCloud