Page MenuHomeFreeBSD

D39540.diff
No OneTemporary

D39540.diff

diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -260,9 +260,11 @@
extern STAILQ_HEAD(file_list_head, file_list) ftab;
extern STAILQ_HEAD(files_name_head, files_name) fntab;
+extern STAILQ_HEAD(options_files_name_head, files_name) optfntab;
extern int debugging;
extern int found_defaults;
+extern int verbose;
extern int maxusers;
extern int versreq;
diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5
--- a/usr.sbin/config/config.5
+++ b/usr.sbin/config/config.5
@@ -239,6 +239,15 @@
and return to the current file after
.Ar filename
is successfully processed.
+.\" -------- INCLUDEOPTIONS --------
+.Pp
+.It .Ic includeoptions Ar filename
+Specifies a file containing a list of additional options
+specific to that kernel configuration file.
+This is useful for build environments that need to add
+custom options and is often used in conjunction with the
+.Ic makeoption
+directive.
.\" -------- MACHINE --------
.Pp
.It Ic machine Ar arch Op Ar cpuarch
diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8
--- a/usr.sbin/config/config.8
+++ b/usr.sbin/config/config.8
@@ -33,7 +33,7 @@
.Nd build system configuration files
.Sh SYNOPSIS
.Nm
-.Op Fl CVgp
+.Op Fl CVgpv
.Op Fl I Ar path
.Op Fl d Ar destdir
.Op Fl s Ar srcdir
@@ -99,6 +99,8 @@
This option makes sense only if
.Cd "options INCLUDE_CONFIG_FILE"
entry was present in your configuration file.
+.It Fl v
+Turns on verbose output.
.It Ar SYSTEM_NAME
Specify the name of the system configuration file
containing device specifications, configuration options
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -24,6 +24,7 @@
%token NOMAKEOPTION
%token SEMICOLON
%token INCLUDE
+%token INCLUDEOPTIONS
%token FILES
%token <str> ENVLINE
@@ -83,6 +84,7 @@
const char *yyfile;
struct file_list_head ftab;
struct files_name_head fntab;
+struct options_files_name_head optfntab;
char errbuf[80];
int maxusers;
@@ -93,6 +95,7 @@
static void newdev(char *name);
static void newfile(char *name);
+static void newoptionsfile(char *name);
static void newenvvar(char *name, bool is_file);
static void rmdev_schedule(struct device_head *dh, char *name);
static void newopt(struct opt_head *list, char *name, char *value, int append, int dupe);
@@ -135,6 +138,10 @@
include($2, 0);
};
|
+ INCLUDEOPTIONS PATH SEMICOLON { newoptionsfile($2); };
+ |
+ INCLUDEOPTIONS ID SEMICOLON { newoptionsfile($2); };
+ |
FILES ID SEMICOLON { newfile($2); };
|
SEMICOLON
@@ -335,6 +342,21 @@
STAILQ_INSERT_TAIL(&fntab, nl, f_next);
}
+/*
+ * Add a new options file to the list of options files.
+ */
+static void
+newoptionsfile(char *name)
+{
+ struct files_name *nl;
+
+ nl = (struct files_name *) calloc(1, sizeof *nl);
+ if (nl == NULL)
+ err(EXIT_FAILURE, "calloc");
+ nl->f_name = name;
+ STAILQ_INSERT_TAIL(&optfntab, nl, f_next);
+}
+
static void
newenvvar(char *name, bool is_file)
{
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l
--- a/usr.sbin/config/lang.l
+++ b/usr.sbin/config/lang.l
@@ -80,6 +80,7 @@
{ "nooption", NOOPTION },
{ "nooptions", NOOPTION },
{ "include", INCLUDE },
+ { "includeoptions", INCLUDEOPTIONS },
{ "files", FILES },
{ 0, 0 },
};
diff --git a/usr.sbin/config/main.cc b/usr.sbin/config/main.cc
--- a/usr.sbin/config/main.cc
+++ b/usr.sbin/config/main.cc
@@ -78,6 +78,7 @@
int debugging;
int found_defaults;
int incignore;
+int verbose;
/*
* Preserve old behaviour in INCLUDE_CONFIG_FILE handling (files are included
@@ -130,7 +131,8 @@
STAILQ_INIT(&ftab);
STAILQ_INIT(&hints);
STAILQ_INIT(&envvars);
- while ((ch = getopt(argc, argv, "Cd:gI:mps:Vx:")) != -1)
+ STAILQ_INIT(&optfntab);
+ while ((ch = getopt(argc, argv, "Cd:gI:mps:Vvx:")) != -1)
switch (ch) {
case 'C':
filebased = 1;
@@ -165,6 +167,9 @@
case 'V':
printf("%d\n", CONFIGVERS);
exit(0);
+ case 'v':
+ verbose++;
+ break;
case 'x':
kernfile = optarg;
break;
diff --git a/usr.sbin/config/mkoptions.cc b/usr.sbin/config/mkoptions.cc
--- a/usr.sbin/config/mkoptions.cc
+++ b/usr.sbin/config/mkoptions.cc
@@ -38,6 +38,7 @@
#include <err.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/param.h>
#include "config.h"
#include "y.tab.h"
@@ -71,7 +72,9 @@
}
if (maxusers == 0) {
- /* fprintf(stderr, "maxusers not specified; will auto-size\n"); */
+ if (verbose)
+ fprintf(stderr,
+ "maxusers not specified; will auto-size\n");
} else if (maxusers < users.u_min) {
fprintf(stderr, "minimum of %d maxusers assumed\n",
users.u_min);
@@ -363,8 +366,15 @@
char genopt[MAXPATHLEN];
fp = fopen(fname, "r");
- if (fp == NULL)
+ if (fp == NULL) {
+ if (verbose) {
+ getcwd(genopt, sizeof(genopt));
+ fprintf(stderr, "Unable to open options file: %s\n",
+ fname);
+ fprintf(stderr, "CWD: %s\n", genopt);
+ }
return (0);
+ }
while (!(wd = get_word(fp)).eof()) {
if (wd.eol())
continue;
@@ -417,6 +427,7 @@
read_options(void)
{
char fname[MAXPATHLEN];
+ struct files_name *nl, *tnl;
SLIST_INIT(&otab);
read_option_file("../../conf/options", 0);
@@ -426,6 +437,12 @@
(void)snprintf(fname, sizeof fname, "options.%s", machinename);
read_option_file(fname, 0);
}
+ for (nl = STAILQ_FIRST(&optfntab); nl != NULL; nl = tnl) {
+ read_option_file(nl->f_name, 0);
+ tnl = STAILQ_NEXT(nl, f_next);
+ free(nl->f_name);
+ free(nl);
+ }
read_option_file("../../conf/options-compat", OL_ALIAS);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 12, 12:56 PM (19 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16610793
Default Alt Text
D39540.diff (5 KB)

Event Timeline