Home | History | Annotate | Download | only in config
History log of /src/usr.bin/config/gram.y
RevisionDateAuthorComments
 1.57  18-Jan-2024  thorpej With config(1) as it exists today, a kernel Makefile is able to implement
logic on kernel options so long as those options are not defflag'd or
defparam'd. This works because such options are automatally added to the
IDENT var in the kernel Makefile as a preprocessor define, and the Makefile
can then do an operation like:

.if !empty(IDENT:M-DSOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif

Unfortunately, this precludes making it possible to generate a compile-time
dependency on SOMECOOLCPUOPTION, or having SOMECOOLCPUOPTION imply another
kernel config option using the normal config(1) option dependency function.

Fix this by introducing a new option description keyword: mkflagvar. This
keyword marks an already defflag'd option as wanting a kernel Makefile var
defined if that option is selected in the kernel config file. So:

defflag opt_coolcpu.h SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION
mkflagvar SOMECOOLCPUOPTION ANOTHERCOOLCPUOPTION

will cause:

KERNEL_OPT_SOMECOOLCPUOPTION="1"
KERNEL_OPT_ANOTHERCOOLCPUOPTION="1"

...to be emitted into the kernel Makefile if those options are, in fact,
selected with "options ..." in the kernel config file, thus allowing for
a compile-time dependency on the option to be generated in addition to
Makefile logic, which now looks like:

.if !empty(KERNEL_OPT_SOMECOOLCPUOPTION)
CFLAGS+= -mcpu=somecoolcpu
.endif
 1.56  26-Jul-2020  uwe Add debug output for ENDDEFS.

This makes it more clear in the debug output where config switched
from definitions to selections.
 1.55  07-Mar-2020  christos Keep track where more objects are declared so that we can print where things
have been redefined.
 1.54  07-Aug-2016  christos branches: 1.54.14; 1.54.16;
Accept "-no" as a "no" that does not cause errors if the object deleted
does not exist.
 1.53  29-Apr-2016  mlelstv Extend syntax of config phrase, a quoted string instead of a device name
is passed as root specification string. This can be used to specify a
wedge by name.
 1.52  01-Sep-2015  uebayasi Introduce a new syntax, "buildprefix", to specify prefix of files under kernel
build subdirectory. This is not used now that everything is built at the
top of kernel build directory. It will become mandatory for source/object
files put out of kernel source tree to specify corresponding build subdirectory.
Only ``no dots'' relative path is accepted as "buildprefix".
 1.51  01-Sep-2015  uebayasi Merge struct objects into struct files. Keep per-suffix file lists.
 1.50  31-Aug-2015  uebayasi Restore the old behavior of "maxusers" to allow the value to be overriden.
Problem reported by John D. Baker.
 1.49  29-Aug-2015  uebayasi Convert MAXUSERS, take 2.

Define MAXUSERS in opt_param.h and include it from sys/param.h, for more
accurate dependency. Don't define -DMAXUSERS and add it to ${CPPFLAGS}.
config(5)'s "maxusers" syntax doesn't change.

(The version just before revert was OK, but I had something bad in my obj
dirs.)
 1.48  29-Aug-2015  uebayasi Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.
 1.47  28-Aug-2015  uebayasi Retire optional `rule' argument of `file' command.

This has existed since Rev. 1.1 of Torek's config(8) [1], but probably has
never been used by anyone.

(I can not imagine how a `file' like look like if `rule' is specified.)

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config.new/Attic/files.c?rev=1.1
 1.46  04-Nov-2014  joerg makedev returns ~uint64_t, but val is int64_t. Cast for -Wconversion.
 1.45  31-Oct-2014  uebayasi config(1), config(5): Introduce "select"

o Introduce a new selection directive "select" to select an attribute (as a
module) and its dependencies.
o Support "no select" too.
o Stop abusing "options" to select an attribute.
o Bump config(1) version.
 1.44  29-Oct-2014  christos - add RCSID's
- fix -Wconversion (except scanner)
 1.43  10-Oct-2014  uebayasi Allow dependency on undefined attributes, so that attribute definitions can
be written out-of-order, like:

# b is not defined yet
define a: b
file a.c a

# b is defined here
define b
fine b.c
 1.42  10-Oct-2014  uebayasi Split plain/interface/devclass attribute initializers.
 1.41  09-Oct-2014  uebayasi Sort definition/selection rules to clarify which is which.
 1.40  09-Oct-2014  uebayasi The word "configuration" is too ambiguous; use "selection" meaning that
user selects some of provided "definitions".
 1.39  29-May-2014  mrg branches: 1.39.2;
implement "no ident".
 1.38  11-Aug-2013  pooka branches: 1.38.2;
ioconf/pseudo-root have been in here unchanged for 3+ years and their use
has spread from rump kernels into dozens of kernel modules. Let's pretend
we don't want to see config yell about them being experimental every time.
 1.37  12-Mar-2012  dholland branches: 1.37.2;
Give option definitions their own data structure instead of using nvlists.
(and using messy hacks to make up for nvlists not holding quite the right
things)
 1.36  11-Mar-2012  dholland Move locator lists to their own data structure. This can use more tidying;
it is not clear to me at the moment what the "string" and "num" values
pushed around in locator lists are supposed to actually mean.
 1.35  11-Mar-2012  dholland More naming improvements.
 1.34  11-Mar-2012  dholland Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)
 1.33  11-Mar-2012  dholland Rename a few more things; try to use the same terminology as config(5).
 1.32  11-Mar-2012  dholland Create a new type struct attrlist to manage lists of attributes,
instead of using struct nvlist.

(struct nvlist holds lists (or trees!) of semi-arbitrary stuff with no
structure and almost no type safety; it should go away.)
 1.31  11-Mar-2012  dholland Strengthen the logic that wraps allocations going on the parser stack.
(This allows cleaning up when a syntax error occurs, because yacc just
dumps the parser stack on the floor.)

The new logic can handle arbitrary data types instead of being limited
to struct nvlist.
 1.30  11-Mar-2012  dholland Write out the expression grammar for dependency constraints instead of
using precedence rules. Precedence rules (besides being a hack) often
lead to unexpected/unwanted behavior in corner cases.
 1.29  11-Mar-2012  dholland Sort productions in grammar. No functional change.
 1.28  11-Mar-2012  dholland Simplify some things. Rename some productions for clarity.
 1.27  11-Mar-2012  dholland A bit more of previous.
 1.26  11-Mar-2012  dholland Reformat according to (my) basic standards for yacc grammars.
No functional change.
 1.25  11-Mar-2012  dholland Comments.
 1.24  30-Apr-2010  pooka branches: 1.24.6;
For the simple cases, augment device-major with information on how
a driver expects /dev/node -> minor mappings to go and include that
information in devsw_conv.
(no, I didn't plow through all the MD majors files)
 1.23  08-Mar-2010  pooka print ioconf WARNING in caps too
 1.22  08-Mar-2010  pooka Add a highly experimental pseudo-root feature to be used in conjuction
with the also-experimental ioconf keyword. pseudo-root allows to
specify a root at any point in the device tree without having
attachments from the actual root.

For example, instead of having a config file like this:
mainbus0 at root
bus_a? at mainbus0
bus_b? at bus_a*
device7 at bus_b?

You can have one like this:
pseudo-root bus_b*
device7 at bus_b?

This will produce the relevant ioconf.c glue for device number 7
only instead of the whole 9 yards from root. Perhaps needless to
say, this can be used to generate snippets of config glue for
modules and, let's not deny that my main motivation for doing this,
rump components.

This is part 2/3 of my modifications to config (the last part is
autogenerating source file lists and component Makefiles).

No strong objection from cube (after a little pressuring ;), but
like he said, the implementation will most likely need some more
tweaking and may not work correctly under all pseudo-root uses yet.
 1.21  03-Mar-2010  pooka Remove fs_foo.h support from deffs now that nothing uses it.
 1.20  03-Feb-2010  pooka Introduce experimental support for ioconf-only configuration files.
This is done by giving the "ioconf" keyword in the config file.
As a result, config produces only ioconf.c and locators.h. Currently,
only "monolithic" configurations with the device path starting from
root are supported. Eventually, the goal is to support a local
root in the input file from any point along the device tree using
files.* in our kernel tree. This will make autogenerating the
config glue for device modules possible instead of having to write
it by hand like is currently required (yes, it sounds simple to
implement, but ...).

reviewed by cube.
(the next part will demand major discussions with you, so prepare ;)
 1.19  13-Mar-2009  cube Actually allow a full expression for the condition for "makeoptions" in
files.*

Patch from Yorick Hardy.
 1.18  28-Dec-2008  christos branches: 1.18.2;
rename nv_int -> nv_num and make it long long, so that dev_t will fit when
we change it.
 1.17  10-Jun-2008  drochner Disable use of pseudo-devices defined "defpseudo" with interface
attributes, but provide compatibility for older source trees (according
to the "version" in conf/files and other files.*.
reviewed by cube
 1.16  10-Jun-2008  drochner Seperate pseudo-devs which don't use device_t et al. (the classical
ones, mostly network pseudo interfaces) and those which use autoconf
to attach instances dynamically, or to attach child devices.
Use a new keyword "defpseudodev" for the latter.
Issue a warning if interface attributes are used with "old" pseudodevs,
but let it work as before for now. This will be removed soon.
approved by cube
 1.15  11-Nov-2007  cube branches: 1.15.6; 1.15.8;
Don't defattr machinearch if it's NULL. Pointed out by
Juergen Hannken-Illjes.
 1.14  10-Nov-2007  cube Make the "machine" statement define attributes for `machine', `arch' and
all the `subarch' given as parameters. This is useful in combination with
ifdef...
 1.13  13-Jan-2007  christos branches: 1.13.4;
- rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.
 1.12  12-Jan-2007  cube Handle defopt lists properly, as ':=' syntax introduce an additional
element... For that, introduce nvcat(nv1, nv2).
 1.11  09-Jan-2007  cube Add new syntaxic sugar to provide a value in lint (i.e., config -L)
configurations for defparams. It will be used _only_ by config -L.

This will greatly help automating tests with lint configurations,
hopefully.
 1.10  04-Sep-2006  dsl Add support for specifying a default value on a 'defparam' line.
If a default is specified then the option is always defined in the
corresponding .h file.
Particularly useful for parameters where the default action isn't the
same a defining the value zero, given that the current use of #if defined(opt)
is open to problems wehere the relevant .h file isn't actually included, so
requiring an option to always have a value makes sense.
Also included (but commented out) is code that adds a global symbol to
the object file to stop objects compiled with different values for the
same option being linked together - I'm not quite happy with it yet!
 1.9  30-Aug-2006  matt Allow deffs to take dependencies like defflag and defopt
 1.8  26-Aug-2006  christos Now that this is part of tools, we don't need the extra build glue.
 1.7  04-Jun-2006  cube D'uh. Forgot the file name argument in the "obsolete" statements.
 1.6  25-May-2006  cube Introduce two new statements:

obsolete defflag <option> [, <option> [, ...]]
obsolete defparam <option> [, <option> [, ...]]

The two statements actually do the same thing (there could be only one),
but it makes things less cryptic that way. The optional ": deps" part of
a 'defflag' or 'defparam' still has to be dropped when it gets obsoleted.

When the user has 'options OBSOLETE_OPTION' in his configuration file, it
is ignored (that is, opt_*.h files are generated as if it wasn't there),
and the user gets a warning about it.

Bump version to 20060525.

When someone first uses that syntax in the tree, a "version 20060525"
statement should be added before its occurrence, preferably at the top
of sys/conf/files.

Suggested by Matt Thomas a few months ago.
 1.5  11-Feb-2006  cube branches: 1.5.2;
Add 'no config <name>'.
 1.4  12-Oct-2005  cube Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.

To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.

Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.

In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.

(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
 1.3  30-Sep-2005  cube Introduce two new statements:

no device at <attachment>

<attachment> can take two forms: either numbered/wildcarded, in which
case only exactly matching instances will be removed, or plain (with
no number or wildcard), in which case all matching instances will be
removed.

When <attachment> is a plain interface attribute, all instances using
that attribute (either directly or through an explicit device) will be
removed.

E.g.:
auich* at pci? dev ? function ?
audio0 at audiobus?
audio1 at auich?
audio* at auich0

no device at auich0 -> removes audio*
no device at auich? -> removes audio1
no device at auich -> removes audio1 _and_ audio*
no device at audiobus? -> removes audio0
no device at audiobus -> removes audio0, audio1 and audio*

no <device>

As in the previous case, <device> can either be numbered/starred, in
which case all exactly matching instances are removed, or plain, in
which case all instances of the device are removed.

E.g.: (continuing previous example)

no audio* -> removes 'audio* at auich0'
no audio -> removes all audio instances
 1.2  10-Sep-2005  martin Move package/cinclude/include handling from the parser to the scanner,
where it belongs. This has the side effect of fixing PR toolchain/30903.
 1.1  05-Jun-2005  thorpej config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin. Move them
there.
 1.5.2.1  19-Jun-2006  chap Sync with head.
 1.13.4.1  09-Jan-2008  matt sync with HEAD
 1.15.8.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.6.1  17-Jun-2008  yamt sync with head.
 1.18.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.24.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.6.1  17-Apr-2012  yamt sync with head
 1.37.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.1  10-Aug-2014  tls Rebase.
 1.39.2.2  11-May-2016  martin Pull up following revision(s) (requested by mlelstv in ticket #1164):
usr.bin/config/sem.c: revision 1.74
usr.bin/config/config.5: revision 1.35
usr.bin/config/gram.y: revision 1.53
Extend syntax of config phrase, a quoted string instead of a device name
is passed as root specification string. This can be used to specify a
wedge by name.
 1.39.2.1  06-Mar-2015  snj Pull up following revision(s) (requested by mrg in ticket #572):
usr.bin/config/Makefile: up to 1.10
usr.bin/config/TODO: up to 1.14
usr.bin/config/config.1: up to 1.17
usr.bin/config/config.5: up to 1.25
usr.bin/config/defs.h: up to 1.64
usr.bin/config/files.c: up to 1.18
usr.bin/config/gram.y: up to 1.46
usr.bin/config/hash.c: up to 1.11
usr.bin/config/lint.c: up to 1.15
usr.bin/config/main.c: up to 1.74
usr.bin/config/mkdevsw.c: up to 1.12
usr.bin/config/mkheaders.c: up to 1.26
usr.bin/config/mkioconf.c: up to 1.28
usr.bin/config/mkmakefile.c: up to 1.37
usr.bin/config/mkswap.c: up to 1.8
usr.bin/config/pack.c: up to 1.9
usr.bin/config/scan.l: up to 1.22
usr.bin/config/sem.c: up to 1.71
usr.bin/config/sem.h: up to 1.19
usr.bin/config/util.c: up to 1.19
sync config(1) with HEAD.
 1.54.16.1  09-Mar-2020  martin Pull up the following, requested by christos in ticket #776:

usr.bin/config/TODO up to 1.32
usr.bin/config/defs.h up to 1.105
usr.bin/config/files.c up to 1.37
usr.bin/config/gram.y up to 1.55
usr.bin/config/main.c up to 1.99
usr.bin/config/scan.l up to 1.30
usr.bin/config/sem.c up to 1.84
usr.bin/config/util.c up to 1.21

config(1): fix issue with incorrect handling of elifdef statements.
 1.54.14.1  08-Apr-2020  martin Merge changes from current as of 20200406

RSS XML Feed