aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/config
Commit message (Collapse)AuthorAgeFilesLines
* config: style for '\0' and NULLWarner Losh2021-04-191-9/+9
| | | | | | | | | | Use NULL for pointers instead of '0' (though hey are the same thing in these cases). Ditto for using the zero character '\0' instead of a naked 0 (ditto). Reviewed by: markj@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29847
* Revert "config(8): Correct the mentioned paper in the SEE ALSO section"Gordon Bergling2021-04-141-4/+3
| | | | | | | | config(8) was first imported from 4.4BSD. Reported by: rgrimes This reverts commit e6ab1e365c06559e964667d2f5a6de856fa28be6.
* config(8): Correct the mentioned paper in the SEE ALSO sectionGordon Bergling2021-04-131-3/+4
| | | | | | | | | | FreeBSD's version of the config(8) utility is based on 4.3BSD not 4.4BSD. So correct the mentioned paper in the SEE ALSO section. Reported by: imp Reviewed by: imp X-MFC-with: 2b59392cb0da804e825c63469beb1934ec4267db Differential Revision: https://reviews.freebsd.org/D29701
* config(8): Mention the authors of a paper in the SEE ALSO sectionGordon Bergling2021-04-091-1/+5
| | | | | Obtained from: OpenBSD MFC after: 1 week
* config(8): remove support for -pKonstantin Belousov2021-04-027-47/+1
| | | | | | | | | and other equivalent ways to request mcount-based profiling, like 'profile N' in kernel config. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29529
* config: Fix typo in comment.John Baldwin2021-02-011-1/+1
|
* config: Fix a few mandoc related errorsGordon Bergling2020-12-192-10/+11
| | | | | | | | | | - new sentence, new line - no blank before trailing delimiter MFC after: 1 week Notes: svn path=/head/; revision=368809
* Do not use macros in the argument to -widthMateusz Piotrowski2020-06-281-3/+3
| | | | | | | | | This patch improves the presentation of the FILES section dramatically. MFC after: 2 weeks Notes: svn path=/head/; revision=362742
* config: Add no-ctfconvert support.Bryan Drewery2020-04-283-4/+12
| | | | | | | | | | | | | | | | Bump CONFIGVERS to 600018 for this support. Some files may purposely have debug info disabled or are *source files* that attempt to run ctfconvert on them. Currently ctfconvert ignores these errors but I have a change to make the errors real so we can catch real problems like exceeding type limits. Sponsored by: Dell EMC Reviewed by: imp, cem, kevans Differential Revision: https://reviews.freebsd.org/D24535 Notes: svn path=/head/; revision=360443
* config(8): use sbuf to manage line buffersJason A. Harmening2020-04-121-42/+39
| | | | | | | | | | | PR: 245476 Reported by: kevans Reviewed by: imp, kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24373 Notes: svn path=/head/; revision=359815
* config(8): "fix" a couple of buffer overflowsKyle Evans2020-04-071-4/+24
| | | | | | | | | | | | | | | | | Recently added/changed lines in various kernel configs have caused some buffer overflows that went undetected. These were detected with a config built using -fno-common as these line buffers smashed one of our arrays, then further triaged with ASAN. Double the sizes; this is really not a great fix, but addresses the immediate need until someone rewrites config. While here, add some bounds checking so that we don't need to detect this by random bus errors or other weird failures. MFC after: 3 days Notes: svn path=/head/; revision=359689
* config(8): fixes for -fno-commonKyle Evans2020-03-282-9/+20
| | | | | | | | | | | | | Move this handful of definitions into main.c, properly declare these as extern in config.h. This fixes the config(8) build with -fno-common. Unexplained in my previous commit to gas, -fno-common will become the default in GCC10 and LLVM11, so it's worth addressing these in advance. MFC after: 3 days Notes: svn path=/head/; revision=359389
* Create ../compileWarner Losh2020-02-241-1/+10
| | | | | | | | | | | Give up the battle to keep extra files in $MACHINE/compile to keep the file in the tree. Instead, create CDIR (usually ../compile) if it doesn't exist when we're using a default build location (eg, not using -d). If it does, we do nothing. This only affects people that do old-school builds, but it's bit me a dozen times since last summer so time to fix the bug. Notes: svn path=/head/; revision=358291
* Bump CONFIGVERS to 600017.Warner Losh2020-02-231-1/+1
| | | | | | | | | This change reflects the ability to change machine_arch in a config file. This is useful for including one config in another and changing the machine_arch in the second one. Notes: svn path=/head/; revision=358266
* Relax machine directives a little.Warner Losh2020-02-232-3/+7
| | | | | | | | | Currently, you can have multiple machine directives if they are otherwise identical. Relax this so that only the machinename part is the same. This allows one to change the machine arch in a different config file you've included easily. Notes: svn path=/head/; revision=358265
* For valid arch values (really $MACHINE), remove references to alphaWarner Losh2020-02-101-6/+6
| | | | | | | | | | and sparc64. Add references to arm64 and riscv Reivewed by: cy@, bcr@ Differential Revision: https://reviews.freebsd.org/D23593 Notes: svn path=/head/; revision=357738
* config: do not link against libl, it is not neededBaptiste Daroussin2019-09-101-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=352119
* Fix small bug in wrapping introduced in r325955.Warner Losh2019-08-171-8/+6
| | | | | | | | | When local support was fixed, it introduced a minor bug in formatting. We don't increment the lpos by enouogh, so lines are a little too long. Adjust to be correct now with variable length srcprefix. Notes: svn path=/head/; revision=351157
* Add nowerror and local to the list of tokens.Warner Losh2019-08-171-0/+1
| | | | Notes: svn path=/head/; revision=351156
* Move initializations of config earlier.Warner Losh2019-08-171-10/+10
| | | | | | | | Inizialize global variables earlier in the process. It doesn't matter today, but may in the future if we want to access these lists earlier in config's run. Notes: svn path=/head/; revision=351155
* Catch mkheaders.c up to the removal of counted device support in 2005.Warner Losh2019-08-151-4/+4
| | | | | | | | | | | | mkheaders.c hasn't made headers in ~15 years. Belatedly update the comments to reflect that all it does these days is warn about 'device foo' lines in the config where we don't know what a 'foo' is. Remove extra includes too. These also haven't been needed for 15 years and weren't removed at the time the comment wasn't updated... Notes: svn path=/head/; revision=351089
* Sort getopt(3) options and case statements per style(9)Warner Losh2019-08-151-10/+10
| | | | | | | Alphebetize the options and cases without regard for case. Notes: svn path=/head/; revision=351087
* config: Only warn if duplicate option/device comes from the same fileEmmanuel Vadot2019-04-162-6/+15
| | | | | | | | | | | | | | | | | | | | | | This is useful for arm (possibly other arches too) where we want to have a GENERIC kernel that only include files for the different SoC. Since multiple SoCs/Board needs the same device we would need to do either : Include the device in a generic file Include the device in each file that really needs it Option 1 works but if someone wants to create a specific kernel config (which isn't uncommon for embedded system), he will need to add a lots of nodevice to it. Option 2 also works but produce a lots of warnings. Reviewed by: kevans MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19424 Notes: svn path=/head/; revision=346298
* config(8): replace opteq with a call to strcasecmpKyle Evans2019-04-151-19/+2
| | | | | | | | | | This obscures the comparison slightly less; when option name appear in files, they are case-insensitive. MFC after: 1 week Notes: svn path=/head/; revision=346254
* config(8): Remove all instances of an option when opting outKyle Evans2018-12-221-2/+1
| | | | | | | | | | | | Quick follow-up to r342362: options can appear multiple times now, so clean up all of them as needed. For non-OPTIONS options, this has no effect since they're already de-duplicated. MFC after: 1 week X-MFC-With: r342362 Notes: svn path=/head/; revision=342363
* config(8): Allow duplicate options to be specifiedKyle Evans2018-12-221-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | config(8)'s option handling has been written to allow duplicate options; if the value changes, then the latest value is used and an informative message is printed to stderr like so: /usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1 Currently, this is only a possibility for cpu types, MAXUSERS, and MACHINE_ARCH. Anything else duplicated in a config file will use the first value set and error about duplicated options on subsequent appearances, which is arguably unfriendly since one could specify: include GENERIC nooptions VERBOSE_SYSINIT options VERBOSE_SYSINIT to redefine the value later anyways. Reported by: mmacy MFC after: 1 week Notes: svn path=/head/; revision=342362
* config(8): Allow escape-quoted empty stringsKyle Evans2018-08-201-1/+1
| | | | | | | | | | | | | For use with things like BOOT_TAG=\"\" -- there are valid reasons to allow empty strings, especially as these are usually being passed through as options. The same argument could perhaps be made for the unquoted variant in things like MODULES_OVERRIDE="", but it's not immediately clear that this is an issue so I've left it untouched. MFC after: 3 days Notes: svn path=/head/; revision=338120
* Remove variable re-inserted during mis-application of r336973Kyle Evans2018-07-311-2/+1
| | | | Notes: svn path=/head/; revision=336975
* Re-insert variable disappeared during mis-application of r336973Kyle Evans2018-07-311-1/+1
| | | | Notes: svn path=/head/; revision=336974
* config(8): Strip comments from env linesKyle Evans2018-07-311-15/+28
| | | | | | | | Consolidates the small bits of logic required for preprocessing a line before inclusion into a file or nvlist. Notes: svn path=/head/; revision=336973
* config(8): Invert checks; envmode/hintmode reflect "env provided"1Kyle Evans2018-07-171-2/+2
| | | | Notes: svn path=/head/; revision=336419
* Fix GCC 4.2 build after r336415, proper declaration and prototypeKyle Evans2018-07-171-2/+3
| | | | Notes: svn path=/head/; revision=336416
* config(8): Add compatibility shims for r335998Kyle Evans2018-07-174-4/+22
| | | | | | | | | | | | | | | | 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... Discussed with: imp Notes: svn path=/head/; revision=336415
* Revert r336353 completely based on protest; compatibility shims incomingKyle Evans2018-07-171-1/+1
| | | | Notes: svn path=/head/; revision=336414
* config(8): Bump major version after r335998Kyle Evans2018-07-161-1/+1
| | | | | | | | | | | | config-generated hints.c/env.c from r335998 and later are incompatible with earlier kernels due to no longer setting envmode/hintmode. A minor bump for this is insufficient, as matching major version with a later minor version is still viewed as backwards-compatible. This was an MI kernel change, soo all VERSREQ's are bumped. Notes: svn path=/head/; revision=336353
* kern_environment: Give the static environment a chance to disable MD envKyle Evans2018-07-121-2/+13
| | | | | | | | | | | | | | | | | | | | | | 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. Discussed with: bde Relnotes: yes (maybe) Notes: svn path=/head/; revision=336217
* config(8): Fix broken ABIKyle Evans2018-07-061-1/+1
| | | | | | | | | | | | | | | 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/. Reported by: bdrewery Notes: svn path=/head/; revision=336026
* config(8): De-dupe hint/env vars within a single fileKyle Evans2018-07-062-75/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Tested with: universe (11 host & 12 host) MFC after: 1 month Notes: svn path=/head/; revision=336019
* Revert r336011,r336012 until I can competently testKyle Evans2018-07-052-98/+75
| | | | Notes: svn path=/head/; revision=336013
* Fix build after r336011Kyle Evans2018-07-052-2/+2
| | | | | | | Add libnv to bootstrap-tools, use ${SRCTOP}/sys headers. Notes: svn path=/head/; revision=336012
* config(8): De-dupe hint/env vars within a single fileKyle Evans2018-07-052-74/+97
| | | | | | | | | | | | | | | | | | | | | | | 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. MFC after: 1 month Notes: svn path=/head/; revision=336011
* kern_environment: use any provided environments, evict hintmode/envmodeKyle Evans2018-07-054-16/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. MFC after: 1 month (maybe) Differential Revision: https://reviews.freebsd.org/D15953 Notes: svn path=/head/; revision=335998
* Revert r335995 due to accidental changes snuck inKyle Evans2018-07-054-41/+17
| | | | Notes: svn path=/head/; revision=335997
* kern_environment: use any provided environments, evict hintmode/envmodeKyle Evans2018-07-054-17/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. MFC after: 1 month (maybe) Differential Revision: https://reviews.freebsd.org/D15953 Notes: svn path=/head/; revision=335995
* config(8): part of patch disappeared, don't close ifp at the endKyle Evans2018-06-261-2/+0
| | | | Notes: svn path=/head/; revision=335654
* config(8): Flip the order of concatenation for `hints` and `env`Kyle Evans2018-06-262-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=335653
* config(8): Make 'env' files consistent with other file-accepting optionsKyle Evans2018-06-264-40/+55
| | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=335652
* config(8): Set envmode if we accept an envvarKyle Evans2018-06-261-0/+1
| | | | | | | X-MFC-With: r335642 Notes: svn path=/head/; revision=335651
* config(8): Add `envvar` supportKyle Evans2018-06-256-28/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. Reviewed by: ian (also contributor of sanitize_envline rewrite) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D15962 Notes: svn path=/head/; revision=335642
* Let -s actually work.Bryan Drewery2018-06-221-1/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: Dell EMC Notes: svn path=/head/; revision=335526