summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Make the internal assertion correct--only fail when '\0' is found inwkoszek2013-05-011-10/+4
| | | | | | | | | | places other than the end of the test section. Otherwise, with kernel compiled with Clang which happens to be setting ELF section alignment differently config(8) was throwing assert() failure unnecessarily Reported by: Kimmo Paasiala <kpaasial (at) gmail.com> Tested by: Kimmo Paasiala <kpaasial (at) gmail.com> MFC after: 10 days
* Loosen restrictions for quoted strings. Now we can use more complex stringsjkim2013-03-261-2/+10
| | | | | | and "escaped" quote characters. MFC after: 1 month
* Fix world after byacc import:bapt2012-05-221-0/+1
| | | | | | | | - old yacc(1) use to magicially append stdlib.h, while new one don't - new yacc(1) do declare yyparse by itself, fix redundant declaration of 'yyparse' Approved by: des (mentor)
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | 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.
* Improve portability of config(8).ed2011-07-031-4/+5
| | | | | | | | | | | | - Use strlen(dp->d_name) instead of the unportable dp->d_namlen. Rename i to len to make it slightly more descriptive and prevent negative indexing of the array. - Replace index() by strchr(). This supposedly fixes compilation on GNU systems. Submitted by: Robert Millan <rmh debian org> (original patch) MFC after: 3 weeks
* Remove support for creating the 'machine' symlink as well as creating thejhb2010-10-291-27/+0
| | | | | | | | | extra MACHINE_ARCH symlink for certain platforms (such as pc98). The support for creating these symlinks was added to sys/conf/kern.post.mk in changeset 152964. The intention of that commit was to remove this code from config(8), but config(8) was never updated. Approved by: imp
* Enhance config to handle MACHINEs with multiple architectures:nwhitehorn2010-07-131-9/+20
| | | | | | | | | | | | | - Passing -m to config will now print the MACHINE and MACHINE_ARCH given in the passed kernel configuration file and then exit. - If an option is defined in options.MACHINE with the same name as the architecture of the kernel being configured, that option will be considered set. This allows conditional compilation based on CPU architecture. Config version is now 600010. Reviewed by: imp
* sparc64, and possibly other architectures, pads the length of theimp2010-05-011-7/+11
| | | | | | | | section holding the config file to sh_addralign bytes using NULs. This bogusly triggers an assert. Break out of the loop when we hit an NUL within that many bytes of the end. MFC after: 3 days
* Move checking the version up from Makefile generation to just afterimp2010-04-271-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | 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
* - Handle calloc() allocation failures.ru2010-03-301-9/+11
| | | | | | | | | - Fixed a comment. - 2 -> EXIT_FAILURE in some places. - errx() -> err() where appropriate. PR: 144644 Submitted by: Garrett Cooper
* Move the comment to it's correct place.wkoszek2009-02-071-5/+5
|
* Remove leftover of alpha support for config(8)--we have MAP_FAILEDwkoszek2009-02-071-3/+0
| | | | globally defined.
* Make config -x <kernel> only return non-zero characters,wkoszek2009-02-061-2/+13
| | | | | | | | | | so that: config -x <kernel> | grep <something> just works. Reported by: Danny Braniss <danny@cs.huji.ac.il>
* Fix a bug introduced by DEFAULTS feature. When the config fileimp2008-04-101-0/+2
| | | | | | | doesn't exist, we make a directory and then say "oops, that file isn't there" leaving the directory behind. Add a stat for the config file so that we detect this before making the directory. This is semi-lame, but less lame than having this bug.
* Honour the logical current working directory ($PWD) when using config'semaste2008-01-081-0/+18
| | | | | | | | -d destdir option. For an automounted src tree using the logical cwd in the Makefile keeps amd(8)'s mount timeout refreshed. Code to check $PWD's validity cribbed from pwd(1). Discussed on hackers@.
* Fix some problems that affect multiple file inclusion. Bruce foundimp2007-05-171-9/+8
| | | | | | | | | | | | | | this bug and submitted these patches to dunstan@. He sent them to me to test, and I discovered they were needed for the atmel kernel config files. Since we were playing with them in the terminal room after the developer's summit today, I thought I'd go ahead and commit them to allow those folks that now have atmel hardware (thanks Andre) a chance to try it out w/o my help. Since dunstan@ is asleep right now, risk stepping on his toes a little by going ahead and committing this change. Submitted by: dunstan@, bde@ Tested by: bde@
* This is loser's commit message:wkoszek2007-05-121-1/+12
| | | | | | | | | | | Remember about tricky cases, where options contain unfriendly characters, from the ANSI-C string point of view ('"' in this case). The x09 build breakage was caused by SC_CUT_SEPCHARS options. I did test this patch number of times; each time unprofessionally and inappropriately. OKed by: cognet (mentor)
* Improve INCLUDE_CONFIG_FILE support.wkoszek2007-05-121-46/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change will let us to have full configuration of a running kernel available in sysctl: sysctl -b kern.conftxt The same configuration is also contained within the kernel image. It can be obtained with: config -x <kernelfile> Current functionality lets you to quickly recover kernel configuration, by simply redirecting output from commands presented above and starting kernel build procedure. "include" statements are also honored, which means options and devices from included files are also included. Please note that comments from configuration files are not preserved by default. In order to preserve them, you can use -C flag for config(8). This will bring configuration file and included files literally; however, redirection to a file no longer works directly. This commit was followed by discussion, that took place on freebsd-current@. For more details, look here: http://lists.freebsd.org/pipermail/freebsd-current/2007-March/069994.html http://lists.freebsd.org/pipermail/freebsd-current/2007-May/071844.html Development of this patch took place in Perforce, hierarchy: //depot/user/wkoszek/wkoszek_kconftxt/ Support from: freebsd-current@ (links above) Reviewed by: imp@ Approved by: imp@
* End my resistance to jmg's multiple hints files and bring in supportimp2006-10-241-0/+1
| | | | | for having multiple hints files generate a correct hints.c (eg, with all the specified ones catenated together).
* Use calloc() instead of zeroing the memory our own.delphij2006-06-071-2/+1
|
* - Change the exit message from "make cleandepend; make depend" toflz2006-01-141-1/+1
| | | | | | | | | "make cleandepend && make depend". PR: bin/91765 Submitted by: Soeren Straarup <xride@x12.dk> Approved by: cpercival MFC after: 3 days
* Clean up most of the "XXX"-tagged items:ru2005-12-301-0/+15
| | | | | | | | | | | - 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>
* Style: use S_ISDIR() (submitted by bde@) and eq() where appropriate.ru2005-11-301-4/+3
|
* The DEFAULTS changes caused the user specified config file to be openedpeter2005-11-291-0/+5
| | | | | | | | | | | | | | | much later than before, and it is now after we do a mkdir ../compile/FILE. As a result, if you do 'config DOESNOTEXIST', it now creates the directory ../config/DOESNOTEXIST. It did not do that before. If DEFAULTS does not exist, it still fails early before any permanent changes. This shameless hack restores the old behavior of ensuring the config file actually exists before mkdiring its counterpart directory. Now I can rmdir ../compile/D and it will stay dead, after my fingers keep sabotaging me with 'config D<tab><enter>'. (Some of my kernel names started with D, which used to be 1-character unique and my fingers knew this very well...)
* Optionally include a DEFAULTS config file if it is present in the currentjhb2005-10-271-3/+10
| | | | | | | | | | | | | directory before the specified config file. This is implemented by opening DEFAULTS as stdin if it exists, and if so resetting stdin to the actual config file when DEFAULTS is fully parsed via yywrap(). In short, this lets us create DEFAULTS kernel configs in /sys/<arch>/conf that can enable certain options or devices by default and allow users to disable them via 'nooptions' or 'nodevice' rather than having to create kludge NO_FOO options. Requested by: scottl Reviewed by: scottl
* Put rev. 1.65 into usage().obrien2005-08-111-1/+1
|
* Add an option to tell what version of config(8) this is.obrien2005-08-101-1/+5
|
* Ask that "make cleandepend" be run before "make depend", now thatru2005-04-221-1/+1
| | | | | | we don't do this automatically. Suggested by: bde
* Allow one to specify a second parameter to the machine line. Thisimp2005-04-011-0/+14
| | | | | | | | | | | allows us to specify the machine_arch as well as machine. If specified then a second link will be made, similar to machine, from $MACHINE_ARCH to $S/$MACHINE_ARCH/include. This is for ports where MACHINE != MACHINE_ARCH (pc98 today, others in the future?). Reviewed by: arch@, nyan@
* style(9) nitsimp2005-03-301-2/+3
|
* Unstaticize config. It was being optimized away.des2005-03-271-1/+1
| | | | MFC after: 3 days
* Per letter dated July 22, 1999, delete clause 3 from code directlyimp2004-08-071-4/+0
| | | | from Berkeley.
* Add a new "files" directive, which allows to include a files.foo file directlycognet2004-05-091-0/+2
| | | | | from a kernel config file. Bump config version to reflect this change.
* Check the return values of opendir() and unlink() in cleanheaders().tmm2003-06-121-2/+4
| | | | If unlink() fails, just print a warning for now.
* Convert to using <sys/queue.h> macros.ru2003-02-151-2/+3
|
* We don't need to hit the user over the head so strong now that we'veobrien2002-07-061-1/+0
| | | | | | fixed all the known warnings suffiently to not require NO_WERROR. Ok'ed by: peter
* Add a hint about -DNO_WERRORpeter2002-02-251-0/+1
|
* Remove the old machine symlink first.peter2001-07-141-3/+2
|
* Introduce an "include" directive. It takes one argument, a filenamedd2001-07-121-0/+1
| | | | | | | | | | | | | | to be included into this one. This works the same way as #include does in C; as far as the user is concerned, the included file is inlined into the current one. Since config(8) is no longer limited to working on one user-supplied file, printing just a line number in an error message is not sufficient. The new global variable yyfile represents the file currently being parsed, and must be printed as well. Reviewed by: imp Obtained from: OpenBSD
* Move kernel compile directory from sys/compile/FOO toimp2001-06-301-3/+2
| | | | | | sys/compile/${MACHINE}/FOO. Reviewed by: obrien, peter and the USENIX terminal room secret kernel cabal
* Move the 'dont forget "make depend"' to be the last thing that people see,peter2001-02-231-0/+1
| | | | after the warnings.
* ${BDECFLAGS} work. And fix a real error in the process. A "MAXUSERS"peter2001-02-191-5/+4
| | | | | 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.
* Remove the need to list each and every cpu platform. Config will nowpeter2001-02-041-10/+1
| | | | take your word for the 'machine' switch.
* Redo the stray header file cleanup code to not depend on timestampspeter2001-01-311-27/+44
| | | | | or access times or anything. Just bite the bullet and keep a list of header files that we know about.
* AARGH! This does not mix too well with the -o noatime mount option.peter2001-01-291-1/+6
| | | | :-(
* I confess. This is a truely nasty hack. I am so ashamed!peter2001-01-291-0/+57
| | | | | | | | (I think config(8) source does bad things to your brain :-) Clean up likely stray *.h files in the build directory. Eg: if isa.h ceases being generated, zap it. The heuristics to figure out a 'likely' file are pretty revolting.
* Add support for configuring PowerPC kernels.benno2001-01-221-0/+1
| | | | Reviewed by: peter
* Clean up some obsolete stuff. config -r has not been needed since aroundpeter2001-01-221-27/+3
| | | | | | 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. :-(
* Try and stop config(8) from freaking out due to unnecessary paranoiapeter2001-01-041-13/+2
| | | | | | | when using -d. Use realpath(3) to locate the top of the tree rather than trying to manually trim back the results of a getcwd(). Requested by: alfred
* Fix buffer overflows in filenames. If you had a path > 80 charactersimp2000-11-211-11/+9
| | | | | | | | | | 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.
OpenPOWER on IntegriCloud