summaryrefslogtreecommitdiff
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2015-01-29 22:49:30 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2015-01-29 22:49:30 +0000
commit69627a0de1c856f804c05a94edd43ecfc6f6bc72 (patch)
tree3c905ed4688af9b5a738cf9de057f19234b1e4f8 /usr.sbin/config
parent0b77a417c8703732f99a17e6b0c9985bf9857f8d (diff)
downloadsrc-test2-69627a0de1c856f804c05a94edd43ecfc6f6bc72.tar.gz
src-test2-69627a0de1c856f804c05a94edd43ecfc6f6bc72.zip
Add -s option to config.
This option allows for specifying the directory to use as the location for kernel source files. This option was ported from NetBSD. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/18 Submitted by: Steve Kiernan <stevek@juniper.net>, Simon Gerraty <sjg@juniper.net> Obtained from: Juniper Networks, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D1722 Relnotes: yes
Notes
Notes: svn path=/head/; revision=277904
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/config.813
-rw-r--r--usr.sbin/config/main.c14
2 files changed, 24 insertions, 3 deletions
diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8
index bfaded9c0ecd..dcfbc62f3db7 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/main.c b/usr.sbin/config/main.c
index ff18d3c86109..887514272625 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);
}