History log of /freebsd-11-stable/usr.sbin/config/mkmakefile.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 346587 23-Apr-2019 kevans

MFC r346254: config(8): replace opteq with a call to strcasecmp

This obscures the comparison slightly less; when option name appear in
files, they are case-insensitive.


# 337335 04-Aug-2018 kevans

MFC r336973-r336975

r336973:
config(8): Strip comments from env lines

Consolidates the small bits of logic required for preprocessing a line
before inclusion into a file or nvlist.

r336974:
Re-insert variable disappeared during mis-application of r336973

r336975:
Remove variable re-inserted during mis-application of r336973


# 337333 04-Aug-2018 kevans

kenv MFC: r335998, r336019, r336026, r336036, r336217, r336335, r336337,
r336415-r336416, r336419

As an aside- this has been slightly altered from the version in head to keep
the MD and config-static environments mutually exclusive by default.

This difference is a one-line change in init_static_kenv to setup the MD
environment if the config-static environment is empty or if
loader_env.disabled is explicitly set to 0.

r335998:
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
the chain of environments (or dynamic environment) without relying on
global state
- All three environments will be searched if they actually have valid hints
to use, rather than just choosing the first environment that actually had
a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

r336019:
config(8): De-dupe hint/env vars within a single file

r335653 flipped the order in which hints/env files are concatenated to match
the order in which vars are processed by the kernel. This is the other
hammer to drop.

Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
latest value specified for a key. This leaves some duplicates if a variable
is specified in multiple hint/env files or via `envvar` in a kernel config,
but the reversed order of concatenation (from r335653) makes this a
non-issue as the latest-specified version will be seen first.

This change also silently rewrote hint bits to use the same sanitization
process that ian@ wrote for r335642. To the kernel, hints and env vars are
basically the same thing through early boot, then get merged into the
dynamic environment once kmem becomes available and the dynamic environment
is created. They should be subjected to the same restrictions.

libnv has been added to -legacy for the time being to support the build of
config(8) with the new cnvlist API.

r336026:
config(8): Fix broken ABI

r336019 introduced ${SRCTOP}/sys to the include paths in order to pull in a
new sys/{c,}nv.h. This is wrong, because the build tree's ABI isn't
guaranteed to match what's running on the host system.

Fix instead by removing -I${SRCTOP}/sys and installing the libnv headers
with `make -C lib/libnv includes`... this may or may not get re-worked in
the future so that a userland lib isn't installing includes from sys/.

r336036:
kern_environment: Fix SYSINIT ordering

The dynamic environment was being initialized at SI_SUB_KMEM, SI_ORDER_ANY.
I added the hint-merging at SI_SUB_KMEM, SI_ORDER_ANY as well in r335998 -
this can only work by coincidence.

Re-do both to operate at SI_SUB_KMEM + 1, SI_ORDER_FIRST and SI_ORDER_SECOND
respectively to be safe. It's sufficiently obfuscated away as to when in
SU_SUB_KMEM malloc will be available, and the dynamic environment cannot be
relied upon there anyways since it's initialized at SI_ORDER_ANY.

r336217:
kern_environment: Give the static environment a chance to disable MD env

This variable has been given the name "loader_env.disabled" as it's the
primary way most people will have an MD environment. This restores the
previously-default behavior of ignoring the loader(8) environment, which may
be useful for vendor distributions or other scenarios where inheriting the
loader environment may be considered a security issue or potentially
breaking of a more locked-down environment.

As the change to config(5) indicates, disabling the loader environment
should not be a choice made lightly since it may provide ACPI hints and
other useful things that the system can rely on to boot.

An UPDATING entry has been added to mention an upgrade path for those that
may have relied on the previous behavior.

r336335 by arichardson:
No longer install sys/nv.h and sys/cnv.h in lib/libnv/Makefile

Use tools/build/Makefile to install the headers into ${WORLDTMP}/legacy
instead. Compared to r336026 this has the minor advantage that it avoids
unncessary header installation when building the non-bootstrap libnv.

r336337:
Unconditionally build libnv in legacy

Rather than using a config(8) built from new tree linking libnv built on
host.

r336415:
config(8): Add compatibility shims for r335998

Plumb the %VERSREQ from Makefile.<arch> through to the rest of config(8).
We've recorded the config(8) version that we're calling "the end of
envmode and hintmode," and we'll write them out for earlier versions. Later
kernel version bumps will remove envmode/hintmode from the kernel as needed,
which is OK since the current kernel does not use them at all.

These compatibility shims really need to go away when the major version
rolls over...

r336416:
Fix GCC 4.2 build after r336415, proper declaration and prototype

r336419:
config(8): Invert checks; envmode/hintmode reflect "env provided"

Relnotes: yes (maybe) [The loader environment may now be used with
the config-static environment by specifying loader_env.disabled=0 in the
config-static environment]


# 336938 30-Jul-2018 kevans

MFC r307967,324082,325955: config(8) fixes

r307967: Allow config to be compiled from another source directory, such as
one for building tools. This boils down to replacing ${.CURDIR} with
${SRCDIR}, where the latter is the directory in which this makefile
lives.

Also allow overriding where file2c comes from using ${FILE2C}.

r324082: Typo in filename in comment.

r325955: Fix 'local' to not look in the source tree for the file.

Usually 'local' is used along with other rules such as 'no-implicit-rule' or
'dependency' which avoids this problem. It's possible to need to use
'local' while relying on the default rules though for a file which is not in
the source tree nor generated in the kernel.


# 336343 16-Jul-2018 kevans

MFC r335652-r335654

r335652:
config(8): Make 'env' files consistent with other file-accepting options

Previously, only one 'env' file could be specified. Later 'env' directives
would overwrite earlier 'env' directives. This is inconsistent with every
other file-accepting directives which process files in order, including
hints.

A caveat applies to both hints and env that isn't mentioned: they're
concatenated in the order of appearance, so they're not actually applied in
the way one might think by supplying:

hints x
hints y

Hints in x will take precedence over same-name hints in y due to how
the kernel processes them, stopping at the first line that matches the hint
we're searching for. Future work will flip the order of concatenation so
that later files may still properly override earlier files.

In practice, this likely doesn't matter at all due to the nature of the
beast.

r335653:
config(8): Flip the order of concatenation for `hints` and `env`

As previously noted, kernel's processing of these means that the first
appearance of a hint/variable wins. Flipping the order of concatenation
means that later variables override earlier variables, as expected when one
does:

hints x
hints y

Where perhaps x is:

hint.aw_sid.0.disable=1

and y is:

hint.aw_sid.0.disable=0

The expectation would be that a later appearing variable would override an
earlier appearing variable, such as with `device`/`nodevice`, device.hints,
and other similarly structured data files.

r335654:
config(8): part of patch disappeared, don't close ifp at the end


# 335863 02-Jul-2018 kevans

MFC r335642, r335651: config(8) envvar support

r335642:
config(8): Add `envvar` support

envvar allows adding individual environment variables to the kernel's static
environment without the overhead of pulling in a full file. envvar in a
config looks like:

envvar some_var=5

All envvar-provided variables will be added after the env file is processed,
so envvar keys that exist in the previous env will be overwritten by
whatever value is set here in the kernel configuration directly.

As an aside, envvar lines are intentionally tokenized differently from
basically every other line. We used a named state when ENVVAR is encountered
to gobble up the rest of the line, which will later be cleaned and validated
in post-processing by sanitize_envline. This turns out to be the simplest
and cleanest way to allow the flexibility that kenv does while not
compromising on silly hacks.

r335651:
config(8): Set envmode if we accept an envvar


# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 298687 27-Apr-2016 araujo

For pointers use NULL instead of 0.

Reviewed by: rpaulo
MFC after: 2 weeks.
Differential Revision: https://reviews.freebsd.org/D5946


# 289262 13-Oct-2015 rpaulo

Fix two memory leaks in config(8).

PR: 202145
Submitted by: Kurt Lidl <lidl pix.net>


# 274936 23-Nov-2014 ian

Fix the negation (!) operator so that it binds only to the word that
immediately follows it, which means 'not' has to be reset every time an
option word or device name is processed.


# 261501 04-Feb-2014 imp

Fix ! by not clearing not at the bottom of the loop.
Add a blank line

Submitted by: bde (blank line)


# 261493 04-Feb-2014 imp

Implement the '!' operator for files* files. It means 'include this
only if the specified option is NOT specified.' Bump version because
old config won't be able to cope with files* files that have this
construct in them.


# 261446 03-Feb-2014 imp

Convert the loop by gotos into a for loop to improve readability. I
did this only with the inner loop for the token parsing, and not the
outer loop which was understandable enough when the extra layers of
looping went away...


# 261445 03-Feb-2014 imp

Fix a bug introduced in r261437 that failed to honor "optional
profiling-routine" to work, since profiling-routine is not really an
option or a device, but a special case elsewhere in the code.


# 261444 03-Feb-2014 imp

Slight cleanup to the error messaging to compress code vertically...


# 261442 03-Feb-2014 imp

Better error messages when EOF is hit in the middle of a phrase.


# 261438 03-Feb-2014 imp

Move the check for standard keyword + optional inclusion specifier to
its proper location. Otherwise you could have 'file.c standard pci'
without an error. This construct isn't in our tree, and has no well
defined meaning.


# 261437 03-Feb-2014 imp

Don't believe we have a requirement until after we've checked all the
known key words. This will make error messages slightly better in
weird corner cases, but should otherwise be a nop.


# 261436 03-Feb-2014 imp

In the 17 years since r30796, the mandatory keyword has never been used
in any files as far as I can tell, and is currently unused. Retire it.


# 261435 03-Feb-2014 imp

Slightly deobfuscate read_file() and likely pessimize the runtime
performance by epsilon.
(Translation: elminate bogus macros that hid 'returns' making it hard
to read and moved a block of code inline rather than at the end of the
fuction where it was effectively a 'gosub' kind of goto).


# 241395 10-Oct-2012 jhb

- Fix the error message when a dependency string is not provided to
reference a missing dependency rather than a missing compile command.
- Don't append a newline to the auto-generated compile command. The
compile command has a newline appended when it is later output to the
Makefile.

MFC after: 2 weeks


# 230051 13-Jan-2012 kevlo

Fix copyright year

Spotted by: pluknet


# 230044 13-Jan-2012 kevlo

fgets(3) returns a pointer, so compare against NULL, not integer 0.


# 229403 03-Jan-2012 ed

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# 228153 30-Nov-2011 fjoe

Generate ${NORMAL_CTFCONVERT} invocation without '@' modifier:
- ${NORMAL_CC} is also invoked without '@'
- Userland CTF support was changed previously to echo ctfconvert invocations too


# 227429 10-Nov-2011 rstone

The generated Makefile for the kernel was not running ctfconvert on
object files corresponding to source files that had the compile-with
option set in conf/files. This means that any fbt probes for functions
in that object file would not have correct argument types.

The fix is to run ctfconvert on any target file that does not have the
no-obj option set in files.

PR: bin/160275
Reported by: Paul Ambrose (ambrosehua AT gmail DOT com)
MFC after: 1 week


# 219819 21-Mar-2011 jeff

- Merge changes to the base system to support OFED. These include
a wider arg2 for sysctl, updates to vlan code, IFT_INFINIBAND,
and other miscellaneous small features.


# 218544 11-Feb-2011 imp

Generate MACHINE= and MACHINE_ARCH= lines based on the machine
directive. Once this is MFC'd, we can move these out of the template
files where they are (incosnsitently) defined.

MFC after: 1 week


# 214654 02-Nov-2010 obrien

Give the user a hint as to what config(8) is unhappy with.


# 210144 15-Jul-2010 imp

Put warnings out to stderr rather than stdout.

MFC after: 3 days


# 209135 13-Jun-2010 imp

style(9) fixes:

o make cmd scoped to the whole do_rules function, since it really is
scoped to the whole fucnion. Making it static was the wrong way to
fix referencing it outside of the block in which it was declared
(and conforms to the style of the rest of the file).
o remove a couple of meaningless blank lines
o properly wrap one line.


# 207260 27-Apr-2010 imp

Move checking the version up from Makefile generation to just after
we've parsed the config file. Makefile generation is too late if
we've introduce changes to the syntax of the metafiles to warn about
version skew, since we have to try to parse them and we get an parse
error that's rather baffling to the user rather than a 'your config is
too old, upgrade' which we should get.

We have to defer doing it until after we've read the user's config
file because we define machinename there. The version required to
compile the kernel is encoded in Makefile.machinename. There's no
real reason for this to be the case, but changing it now would
introduce some logistical issues that I'd rather avoid for the moment.
I intend to revisit this if we're still using config in FreeBSD 10.

This also means that we cannot introduce any config metafile changes
that result in a syntax error or other error for the user until 9.0 is
released. Otherwise, we break the upgrade path, or at least reduce
the usefulness of the error messages we generate.

# This implies that the config file option mapping will need to be redone.

MFC after: 3 days


# 207056 22-Apr-2010 netchild

Revert r206179 (by imp) and do something similar which is more consistent
with all other corresponding CTF places by changing the corresponding
code which is generated by config(8). Or in short, move the '@' from
the variable definition to the use of the variable. [1]

While I'm here break up a long line. [2]

Discussed with: imp [1,2], bde [2]


# 205880 30-Mar-2010 ru

- Handle calloc() allocation failures.
- Fixed a comment.
- 2 -> EXIT_FAILURE in some places.
- errx() -> err() where appropriate.

PR: 144644
Submitted by: Garrett Cooper


# 185186 22-Nov-2008 thompsa

Allow multiple makeoption lines to be used with the += operator, this permits
the following syntax in the kernel config.

makeoptions MODULES_OVERRIDE=foo
makeoptions MODULES_OVERRIDE+=bar
makeoptions MODULES_OVERRIDE+=baz

Bump config minor version to 600007.


# 180089 29-Jun-2008 jb

Revice the way the CTF conversion is done per object. Avoid creating a second
shell (which was the problem with the original implementation) and avoid
letting make see an empty definition (which was the problem with the current
implementation).


# 179666 09-Jun-2008 jb

Change the CTF conversion makefile code to use a new line to avoid
spawning another shell.

Requested by: Ed Schouten

M config/mkmakefile.c


# 179227 23-May-2008 jb

Add the CTF conversion to the generated makefile. In the case where
NO_CTF or !WITH_CTF, the macro is empty.


# 163640 24-Oct-2006 imp

Don't leak files.
This also eliminates the need for ifp init.

Submitted by: ru@


# 163638 23-Oct-2006 imp

End my resistance to jmg's multiple hints files and bring in support
for having multiple hints files generate a correct hints.c (eg, with
all the specified ones catenated together).


# 162936 01-Oct-2006 ru

Added rudimentary support for the "include" directive (inside "files").
This will be used to split sys/conf/files into multiple files similar
to how this is done in NetBSD.


# 160495 19-Jul-2006 stefanf

Remove an unused variable.


# 159362 06-Jun-2006 delphij

Use calloc() instead of zeroing the memory our own.


# 155240 03-Feb-2006 imp

Allow newer config versions to config older versions with the same
major number.

Reviewed by: ru@, jhb@, arch@ (a few months ago)

# this is subject to refinement based on experience.


# 153889 30-Dec-2005 ru

- Avoid adding devices multiple times to the device list.
- Avoid adding options multiple times to the option list.

Based on a patch by: Matt Emmerton <matt@gsicomp.on.ca>


# 153888 30-Dec-2005 ru

Clean up most of the "XXX"-tagged items:

- The code that creates hints.c and env.c from the skeleton files
moved into separate functions.

- Sanity checks for missing "ident" and "cputype" directives moved
into main(), alongside the existing check for "machine".

PR: bin/90310
Submitted by: Matt Emmerton <matt@gsicomp.on.ca>


# 152862 27-Nov-2005 ru

Make config(8) understand ORed dependecies in "files*" and
improve tracking of known devices. Bump config(8) version.


# 152811 25-Nov-2005 ru

Clean some code that became obfuscated over the years:
Don't keep duplicate files in the files list just to
mark the device as "known" later. XXX: Since the
device list isn't unique (there can be two "device foo"
directives, as this the case with LINT+DEFAULTS), we
have to traverse it all to mark all copies of the same
device as "used", but this is not worse than it was.


# 134542 30-Aug-2004 peter

Kill count device support from config. I've changed the last few
remaining consumers to have the count passed as an option. This is
i4b, pc98/wdc, and coda.

Bump configvers.h from 500013 to 600000.

Remove heuristics that tried to parse "device ed5" as 5 units of the ed
device. This broke things like the snd_emu10k1 device, which required
quotes to make it parse right. The no-longer-needed quotes have been
removed from NOTES, GENERIC etc. eg, I've removed the quotes from:
device snd_maestro
device "snd_maestro3"
device snd_mss

I believe everything will still compile and work after this.


# 133248 07-Aug-2004 imp

Per letter dated July 22, 1999, delete clause 3 from code directly
from Berkeley.


# 129119 11-May-2004 cognet

Fix a few glitches in my previous commit.
This makes config(8) WARNS?=6 compliant.


# 129073 09-May-2004 cognet

Add a new "files" directive, which allows to include a files.foo file directly
from a kernel config file.
Bump config version to reflect this change.


# 116450 16-Jun-2003 markm

Not particularly pretty hack to generate rules to make .ln files
from .c files. Actually, this is overkill, as the .ln file targets
are assumed from .? (any) files. This is not a problem in practice,
merely a bit untidy, as the linting rules DTRT. See the sys/conf/*
and sys/mk/* files for usage.


# 113951 23-Apr-2003 des

Don't convert the kernel ident to uppercase when writing the Makefile.


# 113397 12-Apr-2003 phk

Avoid emitting duplicate makefile entries.


# 110895 15-Feb-2003 ru

Convert to using <sys/queue.h> macros.


# 99923 13-Jul-2002 bde

Moved the setting of all profiling-related variables except the key one
(PROFLEVEL) to kern.pre.mk so that it is easier to manage. Bumped config
version to match.

Moved the check for cputype being configured to a less bogus place in
mkmakefile.c.


# 91002 20-Feb-2002 peter

Commit some infrastructure for turning on -Werror for kernel compiles.
It doesn't actually do it yet though. This adds a flag to config so
that we can exclude certain vendor files from this even when the rest
of the kernel has it on. make -DNO_WERROR would also bypass all of it.


# 83594 17-Sep-2001 peter

Use includes to get prototypes for hints and env arrays.

Submitted by: bde


# 82393 27-Aug-2001 peter

Enable hardwiring of things like tunables from embedded enironments
that do not start from loader(8).


# 79705 14-Jul-2001 peter

Put on my peril-sensitive sunglasses and remove the POLA-violating
stealth hints loading. 'make release' has been fixed to not need this
now anyway. If you want static hints, specify it explicitly.

Hey! Why did it suddenly get so dark??


# 73204 28-Feb-2001 peter

Some more tidying up. we dont use config-dependent anyware. Eliminate
some duplicate code (cut/paste bug?). tidy up some other minor stuff.


# 73199 28-Feb-2001 peter

s/special/compilewith/ (so I stop confusing myself) and GC an unused
function I missed before.


# 73198 28-Feb-2001 peter

Untangle some special magic that happened for conflicting defintions for
local files.* and options.* files on the third pass.


# 73193 27-Feb-2001 peter

Remove some more dead code. :-/


# 73192 27-Feb-2001 peter

GC some leftover stuff (device-driver suffix)


# 72927 22-Feb-2001 peter

Move the 'dont forget "make depend"' to be the last thing that people see,
after the warnings.


# 72684 19-Feb-2001 peter

${BDECFLAGS} work. And fix a real error in the process. A "MAXUSERS"
string could have been passed to free(); There are some warnings here
I am not sure how to fix as they are in the lex scanner code, etc.


# 72674 18-Feb-2001 peter

Devices are NOT compiled with the "special c2 option -i"..


# 71879 31-Jan-2001 peter

Unwind a bit more cruft - we only have one type of device now.


# 71363 22-Jan-2001 peter

Clean up some obsolete stuff. config -r has not been needed since around
FreeBSD 3.x or so when the 'make depend' picked up the opt_foo.h files.
Convert warnings into actual errors in the hope that buildkernel users
will pay more attention. :-(


# 71258 19-Jan-2001 peter

Stop turning 'mandatory' into an implicit 'count' line. i386/npx was the
only consumer of this and it is no longer needed.


# 69135 25-Nov-2000 peter

Make the xxxFILES= list generation generic. This makes it easier to add
things like MFILES= or CONFFILES= without having to modify config code.


# 69004 21-Nov-2000 imp

Fix buffer overflows in filenames. If you had a path > 80 characters
for your /usr/obj/path/to/my/files path to the kernel, then weird
things happened. make buildkernel would fail because config was
dumping core or generating bad file names (depending on the lenght of
the path).

While I was here, also use strlcpy, strlcat and snprintf (or asprintf)
as necessary. Minor format policing for the snprintf calls as well.


# 65091 25-Aug-2000 peter

If a ${KERNEL}.hints file exists, and no hints are specified explicitly,
then include the hints with a marker indicating that it is a fallback.
The kernel side of this is to come shortly.


# 61652 14-Jun-2000 peter

Argh! I broke the static hints parser at the last minute on freefall when
I added the $FreeBSD$ (commented) line.
Fix:
1: s/break/continue/
2: will somebody please shoot me! :-]


# 61640 13-Jun-2000 peter

Borrow phk's axe and apply the next stage of config(8)'s evolution.

Use Warner Losh's "hint" driver to decode ascii strings to fill the
resource table at boot time.

config(8) no longer generates an ioconf.c table - ie: the configuration
no longer has to be compiled into the kernel. You can reconfigure your
isa devices with the likes of this at loader(8) time:
set hint.ed.0.port=0x320

userconfig will be rewritten to use this style interface one day and will
move to /boot/userconfig.4th or something like that.

It is still possible to statically compile in a set of hints into a kernel
if you do not wish to use loader(8). See the "hints" directive in GENERIC
as an example.

All device wiring has been moved out of config(8). There is a set of
helper scripts (see i386/conf/gethints.pl, and the same for alpha and pc98)
that extract the 'at isa? port foo irq bar' from the old files and produces
a hints file. If you install this file as /boot/device.hints (and update
/boot/defaults/loader.conf - You can do a build/install in sys/boot) then
loader will load it automatically for you. You can also compile in the
hints directly with: hints "device.hints" as well.

There are a few things that I'm not too happy with yet. Under this scheme,
things like LINT would no longer be useful as "documentation" of settings.
I have renamed this file to 'NOTES' and stored the example hints strings
in it. However... this is not something that config(8) understands, so
there is a script that extracts the build-specific data from the
documentation file (NOTES) to produce a LINT that can be config'ed and
built. A stack of man4 pages will need updating. :-/

Also, since there is no longer a difference between 'device' and
'pseudo-device' I collapsed the two together, and the resulting 'device'
takes a 'number of units' for devices that still have it statically
allocated. eg: 'device fe 4' will compile the fe driver with NFE set
to 4. You can then set hints for 4 units (0 - 3). Also note that
'device fe0' will be interpreted as "zero units of 'fe'" which would be
bad, so there is a config warning for this. This is only needed for
old drivers that still have static limits on numbers of units.
All the statically limited drivers that I could find were marked.

Please exercise EXTREME CAUTION when transitioning!

Moral support by: phk, msmith, dfr, asmodai, imp, and others


# 61523 10-Jun-2000 peter

A checkpoint of a part of a work-in-progress. Some more cleanups for
config(8). This commit allows control of the creation of the
#include "foo.h" files. We now only create them explicitly when needed.
BTW; these are mostly bad because they usually imply static limits on
numbers of units for devices. eg: struct mysoftc sc[NFOO];
These static limits have Got To Go.


# 55614 08-Jan-2000 peter

Support getting *.$MACHINE from sys/conf as well as sys/$MACHINE/conf.
This would mean that we could move files.alpha, files.i386, files.pc98
etc all next to conf/files, and the various Makefiles next to each
other. This should go a long way towards committers "seeing" the
Alpha etc stuff and remembering to update that too as it would be
right next to the i386 config files. Note this does not include
the GENERIC etc files as they can't be shared. I haven't actually
moved the files, but the support is here for it. It still supports
the per-machine conf directories so that folks working on a new arch
can just distribute a subdir of files.


# 54490 12-Dec-1999 peter

Add a 'warning' option for the files* files. This is intended to enable
giving a dire warning about certain drivers going away in the future.


# 54047 02-Dec-1999 archie

A better version of the previous checkin. If the user specifies
a custom file that could override a FreeBSD file under a different
configuration, but doesn't under this one, give a different warning.


# 54044 02-Dec-1999 archie

When specifying additiona user-specified kernel compilation source
files in a 'files.XXX' file, config allows non-FreeBSD source files
with the same name as a FreeBSD source file to override the latter,
and in this situation it issues a warning.

However, if one of the user-specified files is actually a FreeBSD
source file (perhaps your kernel has some custom option that requires
that file), config mistakenly thinks it's a completely new file
and goes ahead and overrides all previous information for that file
(and issues the warning).

Fix this.

With help from: julian


# 52653 30-Oct-1999 marcel

Add option "-d destdir" which instructs config to use another output
directory than the default one. If the option is not given, then the
output of config is exactly as before. Only when an alternate output
directory has been specified will config modify its behavior.

Additional changed:
o Remove the now conflicting and unused NODEV define. It
conflicts with NODEV in sys/param.h.
o Rename the now conflicting MACHINE token to ARCH. It
conflicts with MACHINE in sys/param.h.
o Fix some easy style bugs.
o Fix some easy grammar bugs in the manpage.

Approved by: peter, archie


# 52098 10-Oct-1999 peter

Further cleanup. Also remove the following unused or defunct tokens:
and, bio, cam, master, minor, net, priority, sequential, size, slave, trace


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48525 03-Jul-1999 peter

Delete special handling for 'device-driver' suffix, it's not used in
the kernel source now.


# 46821 09-May-1999 peter

Put on my viking helmet from the closet, and get out the war axe and
"retire" some more stuff.


# 46815 09-May-1999 phk

config(8) lobotomy, please see commit msg in sys.

(I have no idea why cvs didn't take these changes before.)


# 46021 24-Apr-1999 peter

More cleanups, tweaks and features.
- make this work: options FOO123=456 *without quotes*
- grumble (but accept) vector xxxintr, and tty/net/bio/cam flags.
- complain if a device is specified twice (eg: 2 x psm0)
- don't require quotes around: port IO_COM2
- recognize negative numbers. (ie: options CAM_DEBUG_UNIT=-1)
- GC some more unused stuff (we don't have composite disks from config(8)).
- various other nits (snprintf paranoia etc)


# 45819 19-Apr-1999 peter

Slightly reorder the all: to make sure it's before any alternate kernel
names for debugging etc. all: should now always be the first target.


# 45775 18-Apr-1999 peter

Further cleanups. i386_ioconf.c and alpha_ioconf.c were essentially the
same and were merged into a single newbus_ioconf.c. CG'd some more unused
code.


# 45744 17-Apr-1999 peter

Get out the blow torch and hack away all the unused stuff. Note that
I zapped the MACHINE_MIPS stuff, it isn't likely to be useful apart from
recognition of the machine name. It would be reasonable to expect new
ports would look something like the alpha/i386 from a config perspective.


# 45660 13-Apr-1999 peter

Clean up the -g/DEBUG handling. This logic can go in the Makefile
so that config -g can work the same as: makeoptions DEBUG="-g"


# 45579 11-Apr-1999 grog

Back out default debug kernel. The flags revert to historical behaviour.

Requested-by: ache
bde
dg

Modify targets for debug kernels: when -g was specified, make will
now build a debug kernel called kernel.debug, and create a stripped
version called kernel at the same time. The two targets install and
install.debug are otherwise unchanged.

Requested-by: dillon

Update man page accordingly.


# 45424 07-Apr-1999 grog

1. Modify config to issue different code for debugging.
2. Config complains if you use -g:

Debugging is enabled by default, there is no ned to specify the -g option

3. Config warns you if you don't use -s:

Building kernel with full debugging symbols. Do
"config -s BSD" for historic partial symbolic support.
To install the debugging kernel, do make install.debug

(BSD was the name of the config file I used; I print out the same
name).

4. Modify Makefile.i386, Makefile.alpha, Makefile.pc98 and config to
work if a kernel name other than 'kernel' is specified. This is
not absolutely necessary, but useful, and it was relatively easy.
I now have a kernel called /crapshit :-)

5. Modify Makefile.i386, Makefile.alpha, Makefile.pc98 "clean" target
to remove both the debug and normal kernel.

6. Modify all to install the stripped kernel by default and the debug
kernel if you enter "make install.debug".

7. Update version number of Makefiles and config.


# 39307 15-Sep-1998 gibbs

Bump config version. Also mention that even after rebuilding a new
config, you may need to resynchronize your config file with syntax
or name changes documented in GENERIC or LINT.


# 38782 03-Sep-1998 nsouch

Reviewed by: Doug Rabson
Submitted by: nsouch
'local' token added to support new bus architecture .c files generated
by .m files.


# 37578 12-Jul-1998 bde

Convert the maxusers directive to a normal MAXUSERS option (normally
define MAXUSERS in opt_param.h as directed in /sys/conf/options;
if it's not mentioned there, then define it in IDENT; never define
it in PARAM). MAXUSERS probably should be a completely normal option.

Don't define PARAM now that it is empty.

Cleaned up similar conversion of cpu directives to XXX_CPU options.


# 37129 24-Jun-1998 jkh

MF22: more explanatory message from config on version mismatch detection.


# 36813 09-Jun-1998 dfr

Add (mostly stub) alpha support. Incidentally, it doesn't build on stable
unless I manually construct y.tab.h. Is this normal?


# 35609 01-May-1998 kato

Support PC-98 machine.


# 34619 16-Mar-1998 eivind

Style & message change.

Submitted by: bde


# 33598 18-Feb-1998 eivind

Style police service brought to you by: bde


# 33538 18-Feb-1998 eivind

Make '-n' the default, and introduce a new flag '-r' to get old
behaviour. Also indicate which option(s) are unknown if there are any
old-style options.


# 33196 09-Feb-1998 eivind

All our options are new-style now - enable the warning if unrecognized
(that is, old-style) options are found.


# 30796 28-Oct-1997 joerg

Allow for a keyword in the "files" file named "mandatory". The first
candidate for this is "npx0", more are likely to follow.

Check for pseudo-devices that are being configured, but don't appear
in any "files" file. The ``pseudo-device bpf 2'' already hit me too
often.


# 30638 21-Oct-1997 peter

Recognize a %VERSREQ=nnnnn string in the system Makefile. Both config(8)
and the kernel will have a 'config interface version number'. If an
incompatable change is made to the kernel that requires a rebuild of
config(8) (such as the cam devtab stuff), then the version number would be
bumped in both places. If a user neglects to rebuild config, then they
will get a nagging (but non-fatal) warning that they need to rebuild
config.


# 29451 15-Sep-1997 charnier

Use err(3), add usage(). -Wall clean.


# 20458 14-Dec-1996 joerg

Part #2 of the config cleanup. More aggressive, replaced an NIH
version of strdup() by a macro, killed many calls to strdup(), thus
potentially wasting less malloc'ed space (their args were never be
free()ed desptie despite of being malloc'ed). Probably still a huge
memory leak at all... Also killed two totally useless variables.

I've tested it as i could, but wouldn't be surprised if unexpected
problems showed up. So watch out this space!


# 20457 14-Dec-1996 joerg

Round #1 of cleaning up the config(8) mess. This is only the more
conservative part of the tidyup, like fixing potential buffer overflow
conditions. It is believed to be safe to go into 2.2.

Pointed out by: lozenko@cc.acnit.ac.ru (Evgeny A. Lozenko)


# 20395 13-Dec-1996 bde

Moved nonstandard compiler profiling options out of config. Just print
the profiling level in config and decide what to do in makefiles.

Makefile.i386:
Align functions to 16-byte boundaries if profiling is enabled. This
will allow a fourfold reduction in the size of the profiling buffers.


# 16073 02-Jun-1996 phk

Backout yacc changes.


# 16023 30-May-1996 phk

yacc rule changes.


# 13400 12-Jan-1996 peter

Make a little more effort to avoid touching certain generated files if
they were not changed. This makes 'make depend' more useful.


# 13109 29-Dec-1995 dg

Changed the default/min/max number of users to 8/2/512 for all machine
types. This is closer to the reality of reasonable values.


# 13107 29-Dec-1995 bde

Implemented non-statistical kernel profiling. This is based on
looking at a high resolution clock for each of the following events:
function call, function return, interrupt entry, interrupt exit,
and interesting branches. The differences between the times of
these events are added at appropriate places in a ordinary histogram
(as if very fast statistical profiling sampled the pc at those
places) so that ordinary gprof can be used to analyze the times.

gmon.h:
Histogram counters need to be 4 bytes for microsecond resolutions.
They will need to be larger for the 586 clock.
The comments were vax-centric and wrong even on vaxes. Does anyone
disagree?

gprof4.c:
The standard gprof should support counters of all integral sizes
and the size of the counter should be in the gmon header. This
hack will do until then. (Use gprof4 -u to examine the results
of non-statistical profiling.)

config/*:
Non-statistical profiling is configured with `config -pp'.
`config -p' still gives ordinary profiling.

kgmon/*:
Non-statistical profiling is enabled with `kgmon -B'. `kgmon -b'
still enables ordinary profiling (and distables non-statistical
profiling) if non-statistical profiling is configured.


# 12772 11-Dec-1995 peter

Implement support for conf/options and i386/conf/options.i386
Note that this code is dormant unless the options files exist.
Also, parsing of quoted options in the config files is improved.

What this allows, is all the options in LINT to be specified to be
configured as #defines in a file rather than on the CC command line at
kernel build time. This means that 'make depend' will catch dependencies
on actual *options*, meaning that you can run 'config' and 'make depend'
in complete safety WITHOUT removing the compile directory each time.

Unfortunately, this requires a pass over the source to get the individual
files to #include the new .h files that would be generated by config.
This has a small compile time penalty (appears up to about 2% slower)
from a "fresh" build. Of course, you should not be needing to do complete
rebuilds very often once this was completed, so it would be an overall
win for most people.

Since this code is dormant and we've got a lot of other things happening
on the kernel tree at the moment (prototypes, devfs, static declarations
etc) I am not planning on doing any changes to activate this feature just
yet.


# 11917 29-Oct-1995 dg

Added support for a %SFILES token to auto-generate a SFILES= file list in
the same way that is done for CFILES. Files ending in .s or .S that match
the option criteria will be included in this list.


# 11711 23-Oct-1995 dg

Don't pre-processor define 'ident'. This has subtle consequences for people
who don't carefully consider their choice for the machine name. The same
functionality can still be had with an "option", so nothing is lost.


# 9370 29-Jun-1995 dg

Killed TIMEZONE, DST, and HZ keywords. They have generated a config error
for more than a year now. They've been replaced with userland methods for
changing (see adjkerntz).


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 8520 14-May-1995 rgrimes

Fix 3 printf's that had the wrong number of arguments.
Submitted by: gibbs


# 6803 01-Mar-1995 gibbs

Implement "clean" entries for device config entries.

Submitted by: Pointed out by Bruce Evans <bde@zeta.org.au>


# 5325 31-Dec-1994 gibbs

Allow config to fully handle the aic7770 driver dependancies.


# 4571 17-Nov-1994 gibbs

Add new keywords to config. The options availible in file.i386 are now:

/*
* filename [ standard | optional ] [ config-dependent ]
* [ dev* | profiling-routine ] [ device-driver] [ no-obj ]
* [ compile-with "compile rule" [no-implicit-rule] ]
* [ dependancy "dependancy-list"]
*/

I added

no-obj - This entry does not create anything linkable to the kernel.
dependancy - Add additional dependancy rules to a target.
no-implicit-rule - Don't assume .c -> .o type rules. Config is really
dumb in this area and assumes that everything is a .c file
irregarless of extention. This was the best choice really
since there may even be .c file that you don't want to follow
the standard rules.

This was all done so that the building to the aic7770 assembler and using
the aic7770 assembler in the building of the aic7770 driver could be config
dependant. I can now have an entry like this for the driver:

aic7770 optional ahc device-driver \
compile-with "${CC} $> -o $@" \
dependancy "$S/gnu/misc/aic7770/aic7770.c" \
no-obj no-implicit-rule
aic7770_seq.h optional ahc device-driver \
compile-with "${.CURDIR}/aic7770 -o $@ $S/gnu/misc/aic7770/aic7770.seq"\
dependancy "$S/gnu/misc/aic7770/aic7770.seq aic7770" \
no-obj no-implicit-rule
i386/isa/aic7770.c optional ahc device-driver \
dependancy "aic7770_seq.h"

I also added '\' escaping to newlines so that this doesn't look as gross as
it could have.

Reviewed by: jkh


# 2105 18-Aug-1994 dg

Oops...forgot to list the changes....

/usr/src/usr.sbin.config:
o -DSTATCLOCK gives kludges to support the rtc non-device as well as
old kludges to support the clk non-device.

/usr/src/usr.sbin/config.8:
o Document the trivialness of the new vector.h.

/usr/src/usr.sbin/mkglue.c:
o Only print DEVICE_NAMES and NR_DEVICES in vector.h. These are
only required to support vmstat. The vmstat interface will need
to be improved for dynamic loading.

/usr/src/usr.sbin/mkioconf.c:
o Print device ids to be used as indexes into DEVICE_NAMES.
o Print secondary interrupt handler entry points (xxxintr()) instead
of primary ones (VdevU()). Primary ones are now XintrI() and
XfastintrI() and are independent of the config so they are not
handled here.
o Minor cleanups.

Submitted by: Bruce Evans


# 1973 09-Aug-1994 dg

Now that the timezone specification is no longer allowed, don't issue a
warning that it is missing.


# 1566 26-May-1994 rgrimes

Upgrade config to be compatible with our i386 port, pull in 95% of the
changes that have been made in FreeBSD 1.x, except for possibly the nfs
diskless support this is a completed config.


# 1554 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1553,
which included commits to RCS files with non-trunk default branches.


# 1553 26-May-1994 rgrimes

BSD 4.4 Lite usr.sbin Sources