From owner-svn-src-all@FreeBSD.ORG Thu Jan 29 22:49:31 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88511E6C; Thu, 29 Jan 2015 22:49:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68CA463C; Thu, 29 Jan 2015 22:49:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0TMnVb5087047; Thu, 29 Jan 2015 22:49:31 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0TMnUhi087043; Thu, 29 Jan 2015 22:49:30 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201501292249.t0TMnUhi087043@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Thu, 29 Jan 2015 22:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277904 - head/usr.sbin/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 22:49:31 -0000 Author: rodrigc Date: Thu Jan 29 22:49:30 2015 New Revision: 277904 URL: https://svnweb.freebsd.org/changeset/base/277904 Log: 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 , Simon Gerraty Obtained from: Juniper Networks, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D1722 Relnotes: yes Modified: head/usr.sbin/config/config.8 head/usr.sbin/config/main.c Modified: head/usr.sbin/config/config.8 ============================================================================== --- head/usr.sbin/config/config.8 Thu Jan 29 21:54:01 2015 (r277903) +++ head/usr.sbin/config/config.8 Thu Jan 29 22:49:30 2015 (r277904) @@ -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 Modified: head/usr.sbin/config/main.c ============================================================================== --- head/usr.sbin/config/main.c Thu Jan 29 21:54:01 2015 (r277903) +++ head/usr.sbin/config/main.c Thu Jan 29 22:49:30 2015 (r277904) @@ -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); }