Commit Graph

387 Commits

Author SHA1 Message Date
pgoyette b0e637a9da Insert comment regarding PR/48571 so it doesn't get lost.
config(1) ioconf is insufficient for pseudo-devices

config_{init,fini}_component
2015-08-19 03:39:45 +00:00
uebayasi 3dbb19470d + pseudo(dev) attach 2015-08-19 03:23:34 +00:00
shm 13fc423c66 Add missed munmap(2) in extract_config 2015-08-08 15:52:41 +00:00
dholland 7fee31e593 Document previously secret -d debug option. Bump date. 2015-07-16 08:42:53 +00:00
christos b921b70209 remove stray newlines from errors/warnings 2015-06-16 21:12:19 +00:00
uebayasi c59f84ea6d Typo in previous. 2015-04-10 03:51:44 +00:00
uebayasi e29416eeae More about attribute -> bus, and child configuration. 2015-04-10 03:30:09 +00:00
christos 93da4522d3 appease gcc-4.5.4 2015-01-22 20:01:22 +00:00
uebayasi d8aa702d35 Revert debug code. Simplify. 2014-12-15 15:49:25 +00:00
uebayasi fc1f7728b8 config(1): Fix build of old trees (bin/49389) (take 2)
Look into sys/conf/Makefile.kern.inc to check if "build_kernel" .USE target
is defined.  If not (== old source trees), generate one on the fly.
2014-12-15 15:41:18 +00:00
uebayasi 10b064f35c config(1): Fix build of old tree (bin/49389)
Define the default, empty "build_kernel" target, so that old source trees,
whose sys/conf/Makefile.kern.inc don't have "build_kernel" .USE target, can
be built.

(When "build_kernel" is defined, the target is overriden, as far as
sys/conf/Makefile.kern.inc is included later than the "netbsd: ..." definition
in sys/arch/*/conf/Makefile.*.)

This should address PR bin/49389.
2014-12-15 10:10:24 +00:00
christos c8da6eb49b Use proper index types, delete casts, use correct sizeof() in allocations. 2014-11-21 20:46:56 +00:00
uebayasi 57751c8485 Pre-calc file path len/suffix. Misc. clean up. 2014-11-17 00:53:15 +00:00
uebayasi 9eb1865390 Fix oops in r1.30. 2014-11-16 15:10:54 +00:00
uebayasi d2824e0952 Simpfily code by assuming suffix is a single character. 2014-11-16 14:57:59 +00:00
uebayasi 8a0d672c53 Refactor. 2014-11-16 14:49:12 +00:00
uebayasi 20fd8a9d0f Consistently wrap long lines in ioconf.c. 2014-11-16 14:26:14 +00:00
uebayasi 73810e5d00 config(1): TODO about namespace (esp. options vs. module) 2014-11-16 07:12:34 +00:00
uebayasi 79fcd6c2d2 config(1): TODO item about swapnetbsd.c 2014-11-16 04:28:09 +00:00
uebayasi dfd51da465 config(1): Avoid buffer overrun (modular build) 2014-11-15 12:18:55 +00:00
uebayasi 70dd8e7d2a config(1): Sort objects by weight in modular build
Sort per-module kernel objects (*.ko) by dependency weight.  Important modules
are placed in lower addresses.  The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*).  Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)
2014-11-15 08:21:38 +00:00
uebayasi 2f06dcafd4 Revise a plan about link-set.
(I was ignorant 2 weeks ago.)
2014-11-13 15:25:48 +00:00
christos b552d112cd merge a bit of duplicated code. 2014-11-10 21:13:04 +00:00
uebayasi 28fcb3ecde config(1): Note a little more about linkage 2014-11-08 05:57:41 +00:00
christos 727f236228 - simplify string parsing
- emalloc + sprintf = easprintf
2014-11-07 17:50:14 +00:00
uebayasi 701e371cb2 config(1): TODO about kernel linkage 2014-11-07 16:41:17 +00:00
uebayasi 7710d317bc config(1): Rename internal flag to enable modular build 2014-11-06 11:40:32 +00:00
joerg 4e288682c2 nv_num is not a dev_t, so add explicit cast for the sake of
-Wconversion.
2014-11-04 23:02:14 +00:00
joerg fdcb5b3398 makedev returns ~uint64_t, but val is int64_t. Cast for -Wconversion. 2014-11-04 23:01:23 +00:00
joerg e7051a1953 To make -Wconversion happy, cast return value of tolower/toupper to
char.
2014-11-04 23:00:35 +00:00
uebayasi e8a6d4b70c config(1): Start calling module as module 2014-11-01 14:24:45 +00:00
uebayasi 6c852b2895 config(1): More TODO description. 2014-11-01 14:15:31 +00:00
uebayasi fe2a50734b config(1): Don't emit unused empty loc[] 2014-11-01 11:02:41 +00:00
uebayasi c62ce2631a config(1): One more TODO about retiring direct attachment 2014-11-01 08:13:11 +00:00
uebayasi 6c283bdad1 config(1): Emit pdevinit[] into .rodata 2014-11-01 07:26:11 +00:00
uebayasi def3cecb48 config(1): Set NULL to unused cfdata::cf_loc 2014-11-01 06:20:24 +00:00
uebayasi e1a6328057 config(1): KNF 2014-11-01 04:34:27 +00:00
uebayasi 304be40991 config(1): Better indent of cfdata in ioconf.c 2014-10-31 18:26:06 +00:00
uebayasi 084f527f2d config(1): KNF generated ioconf.c 2014-10-31 17:58:02 +00:00
uebayasi 374e86cbe4 config(1): Emit only referenced interface attributes in ioconf.c 2014-10-31 17:43:55 +00:00
uebayasi c42523f496 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.
2014-10-31 07:38:36 +00:00
wiz 75f5ef0d24 Spelling fixes. 2014-10-30 23:18:02 +00:00
christos b89e3b087d remove overflow test that triggered for negative values; we only care
about the hash here.
2014-10-30 15:13:11 +00:00
uebayasi bd3d598f54 config(1): More TODO 2014-10-30 08:20:15 +00:00
christos 5dcabc490b print more info about the overflow 2014-10-30 01:36:13 +00:00
uebayasi c5c18c905b config(1): More TODO items 2014-10-30 01:26:20 +00:00
christos 584127132b put back scanner warnings now that flex produces clean code. 2014-10-29 19:10:49 +00:00
christos 1ed33bc5b9 cast to signed, since that's all we have. 2014-10-29 19:10:18 +00:00
christos d12b0036c5 - add RCSID's
- fix -Wconversion (except scanner)
2014-10-29 17:14:50 +00:00
uebayasi 023c161bb6 Keep track of attribute (module) dependency using hash2. 2014-10-18 06:36:40 +00:00
uebayasi 1af1e581aa Revert implicit attribute (module) declaration for options (flag/param).
Flag and param are to change contents of attributes (modules).  These don't
have code (*.[coS]).

Filesystem definition still defines an attribute (module) implicitly.
2014-10-14 08:00:27 +00:00
apb e010c72036 Allow easier adding/removing of options without regard to
whether or not they were already defined.
2014-10-12 15:54:19 +00:00
uebayasi 6e01290960 Don't shadow global 'devname' on macppc. 2014-10-12 15:35:40 +00:00
wiz 891aaa4d83 Spelling. 2014-10-12 08:04:30 +00:00
uebayasi ab6c1d8a5a Fix typos in previous. 2014-10-12 05:25:21 +00:00
uebayasi a38ec9b5de Make hash capable of taking two key strings. 2014-10-12 05:20:54 +00:00
uebayasi 0819fb14f9 More TODOs. 2014-10-12 04:23:46 +00:00
martin db3a752aed Remove a set but not used variable 2014-10-11 17:27:42 +00:00
uebayasi 6d52c530bb More debug messages. 2014-10-11 15:47:38 +00:00
uebayasi 77259bf204 On second thought, resolving "device" dependency in enddefs() is correct.
The problem was to select things.  So put back the code to record dependency
as attributes.

While here, sprinkle more debug messages.
2014-10-11 15:20:36 +00:00
uebayasi d1bb5c1f69 Don't conplain devclass redifition to the same value; it can happen while
resolving dependency.
2014-10-11 09:27:51 +00:00
uebayasi 0e6a39b020 After yyparse() is done, print not file but stage for debug. 2014-10-11 09:09:19 +00:00
uebayasi 984251350e Redo "device" dependency. It was completely wrong to select things just
after definitions at enddefs().  Resolve dependency in selectbase().
2014-10-11 09:06:29 +00:00
uebayasi 1140e58262 Pass stricter build. 2014-10-11 06:18:29 +00:00
uebayasi 84fb961fd3 Resolve "device" definition dependency lazily. 2014-10-11 06:07:20 +00:00
uebayasi 93405beec9 Enable debug for tools. 2014-10-11 03:17:40 +00:00
uebayasi bb4851f85c Remove an unsed var. 2014-10-10 16:17:27 +00:00
uebayasi 9a2063bca6 Revert a mistakenly added, superflous attribute match test that caused some
valid options to get lost.
2014-10-10 15:35:08 +00:00
uebayasi 92b86764e1 Bump config(1) version.
config(1) still keeps backward-compatibility; it is more permissive than
before.  The tree, however, needs the updated config(1), mainly to strictly
define attribute ("module") ownership and dependencies.
2014-10-10 12:10:02 +00:00
wiz c8fb5a2e0f Fix two typos. 2014-10-10 11:58:59 +00:00
uebayasi b0d108d368 Document -M. 2014-10-10 11:49:15 +00:00
uebayasi eac891b935 Put TODO ideas (to keep your fun). 2014-10-10 11:38:42 +00:00
uebayasi d23bf64337 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
2014-10-10 11:09:50 +00:00
uebayasi 680ed4abc8 Select attributes for filesystem options too. 2014-10-10 10:46:05 +00:00
uebayasi 861847ab35 If an option is selected, select the matching (lowercased) attribute. Handle
dependencies too.
2014-10-10 10:22:49 +00:00
uebayasi 7a01ec4b08 If an attribute is selected, select its dependencies too. 2014-10-10 10:16:19 +00:00
uebayasi c24abed7e6 Implicitly define attribute for device. 2014-10-10 08:14:47 +00:00
uebayasi 6903e7639b Implicitly define attribute for options. 2014-10-10 07:48:50 +00:00
uebayasi d88f6cad14 Implicitly define attribute for filesystem. 2014-10-10 07:08:26 +00:00
uebayasi 82e22e6766 Implicitly define empty "attribute" for "device attachment". Much less
troublesome than "device" and "interface attribute".
2014-10-10 06:59:38 +00:00
uebayasi bd3d511493 Split plain/interface/devclass attribute initializers. 2014-10-10 06:13:30 +00:00
uebayasi b4d3dfc64a Refactor attr definition and initialization a little. 2014-10-10 05:27:28 +00:00
uebayasi 1c89d26524 Style. 2014-10-09 19:33:43 +00:00
uebayasi b35679c08e FIT_FORCESELECT is never set anywhere. 2014-10-09 19:27:04 +00:00
uebayasi 9a04781594 FIT_NOPROLOGUE is never set anywhere. 2014-10-09 19:24:36 +00:00
uebayasi eb981efe66 Kill more unused indent code in emitfiles(). 2014-10-09 19:22:31 +00:00
uebayasi 7603d666f0 Steal -M to enable "modular" build. 2014-10-09 19:20:56 +00:00
uebayasi aeeeb994e8 Print one file per line. Simplify code. 2014-10-09 17:36:10 +00:00
uebayasi 745a9de44a Correct inverted logic. 2014-10-09 17:22:55 +00:00
uebayasi ae77717cc7 Implement code to generate Makefile to build netbsd via intermediate relocatable
object files.  Disabled for now.  Commit this for further experiments.

Kernel (netbsd) has been built as:

	netbsd: *.o
		ld -o netbsd *.o

Change this to:

	netbsd: *.ko
		ld -o netbsd *.ko
	acpica.ko: ${OBJS.acpica}
		ld -r acpica.ko ${OBJS.acpica}
	:

You can call *.ko as a module, but this is not only beneficial for loadable
module, but also localize related text/data.  Various options/flags/params
will be able to be per-ko.  Unnecessary symbols can be hidden.  Many ideas
will follow.
2014-10-09 17:00:15 +00:00
uebayasi 3586467df2 Always select the fallback allattr. 2014-10-09 16:08:36 +00:00
uebayasi adf6a4556b Define an implicit attribute "netbsd" internally to collect files that don't
belong to any specific attribute.

Eventually, all operations doing "foreach (files)" can be rewritten as "foreach
(attributes) foreach (files)".
2014-10-09 15:25:26 +00:00
uebayasi fa3d850434 If a file is marked by an atom expression, like "file a.c foo", and if the
specified expression is an attribute, mark the file as belonging to the
attribute.

At this moment this information is not used for any purpose, but can be
traced by config -ddd.
2014-10-09 10:29:36 +00:00
uebayasi 567430ccec Sort definition/selection rules to clarify which is which. 2014-10-09 09:39:24 +00:00
martin 012985802d Provide a CFGDBG version for the tools build. 2014-10-09 07:43:55 +00:00
uebayasi fc2a41ac40 The word "configuration" is too ambiguous; use "selection" meaning that
user selects some of provided "definitions".
2014-10-09 07:05:01 +00:00
uebayasi 2820acceff Debug print where things are selected (by user). 2014-10-09 06:49:53 +00:00
uebayasi 99af41ba8d Add debug print function. 2014-10-09 06:45:31 +00:00
joerg aa44bc3b18 Bump CONFIG_VERSION. 2014-08-24 20:22:18 +00:00
joerg 6616828fd2 Restore explicit rule for swap*.o. 2014-08-18 08:07:02 +00:00
joerg a26164117a Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
2014-08-17 21:17:43 +00:00
bad 2a950d2831 Treat an undefined option as a warning instead of an error when undoing an
option.

Allows one to win with declarations like:
no options 	MSGBUFSIZE
options 	MSGBUFSIZE="128*1024"

Briefly discussed with cube@, lukem@ and martin@.
2014-08-09 12:40:14 +00:00
wiz 910ba5f05b Bump date for previous. 2014-05-29 08:13:17 +00:00
mrg ebf7669ed7 implement "no ident". 2014-05-29 07:47:45 +00:00
dholland d8da1d6013 avoid error path SIGSEGV 2014-05-21 05:25:34 +00:00
wiz 9237f38b59 Sort options in usage. 2014-05-05 21:04:09 +00:00
wiz 5f345558c9 Sort SYNOPSIS. Bump date for previous. 2014-05-05 20:52:45 +00:00
martin 1957b5eaba Add two new options, -U and -D, that can be used to define "makeoptions"
on the config command line. While there, rename the undocumented (internal)
parser debug option from -D to -d.
Discussed on tech-toolchain.
2014-05-05 19:08:13 +00:00
riastradh da030fc8bd `Controller' takes two l's. 2014-03-06 15:00:21 +00:00
wiz 26dba06cb7 Fix some typos found by Rich Neswold and reported in PR 48597. 2014-02-13 22:36:28 +00:00
christos 6fce9f6ad7 go back to using file:line: from uwe. 2013-11-01 21:39:13 +00:00
christos 8ae3ff1668 make config errors look more like other programs: <file>,<line>:
instead of <file>:<line>:
2013-11-01 17:09:59 +00:00
pooka 26b4d3d169 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.
2013-08-11 10:37:08 +00:00
christos fbb3db86f7 Don't support sysctl for the tools version of config. It is too complicated
to do so, and config -x is not used during the build.
2012-08-31 01:23:49 +00:00
wiz 686e48a4a3 Use more markup. Wording. 2012-08-30 12:42:41 +00:00
christos c9ffe47f54 bump date. 2012-08-30 12:32:07 +00:00
christos 8aaed51273 make config -x look at the booted kernel first. 2012-08-30 12:31:25 +00:00
martin fcbf6c86a2 If we build several kernel (variants) within the same build directory, bad
things may happen in a parallel build - especially with rules like the
automatic size adjustment for SYMTAB_SPACE, see long standing failure of
evbarm on the build cluster.
Easy fix: .WAIT for each config to complete, before going on with the
next. Low impact, only minor loss of paralellism, and only in cases where
needed.
2012-06-08 08:56:45 +00:00
matt d34c2845b8 Use C89 function definitions 2012-03-20 20:34:57 +00:00
dholland 471d829aae Remove the NV_OBSOLETE flag, which is no longer needed. While here,
update an outdated comment about condition expressions.
2012-03-12 03:04:56 +00:00
dholland cb79ede2d1 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)
2012-03-12 02:58:55 +00:00
dholland a883398ef5 Introduce type-safe wrappers around the hash tables. Use them for a
selected set of tables affected by the next nvlist cleanup in the
works.
2012-03-12 00:20:30 +00:00
dholland f5d4142b2d 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.
2012-03-11 21:16:07 +00:00
dholland 25c56bd707 Add some organizational comments 2012-03-11 20:02:55 +00:00
dholland 237116305d More naming improvements. 2012-03-11 19:27:26 +00:00
dholland a551c5e8b7 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.)
2012-03-11 08:21:53 +00:00
dholland 4fbb702df0 Rename a few more things; try to use the same terminology as config(5). 2012-03-11 07:46:47 +00:00
dholland bbe96a5ad8 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.)
2012-03-11 07:32:41 +00:00
dholland 720c7fbc2a 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.
2012-03-11 07:27:02 +00:00
dholland 285c15fc92 Remove cf_swap, which hasn't been used in a long time. 2012-03-11 05:31:37 +00:00
dholland cfffb8a2c1 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.
2012-03-11 02:56:25 +00:00
dholland 6df4c5ae47 Sort productions in grammar. No functional change. 2012-03-11 02:43:33 +00:00
dholland 70f2148fe7 Simplify some things. Rename some productions for clarity. 2012-03-11 02:21:04 +00:00
dholland 60c605bb74 A bit more of previous. 2012-03-11 01:09:42 +00:00
dholland 540fdf9f5e Reformat according to (my) basic standards for yacc grammars.
No functional change.
2012-03-11 00:57:44 +00:00
dholland f3063ae30c Comments. 2012-03-11 00:14:20 +00:00
dholland 671dbef5d6 Use __printflike. Build products unchanged. 2012-03-10 21:53:38 +00:00
matt 105471657d When making the symlink for machine -> arch/foo/include
also make foo -> arch/foo/include.  This allows one to include <foo/bar.h>
include <machine/bar.h> which can be handy.
2011-07-09 08:01:58 +00:00
nakayama c09c2a7b34 Fix build on Solaris 10. 2011-03-03 14:53:01 +00:00
cube 3f1dd008b1 Emit compatible struct devsw_conv when version is older than 20100430. 2010-07-30 16:23:49 +00:00
pooka 00ed8a38a3 Prefer a real device for pseudoroot and only create a fake device
in the case we are attaching to a pure attribute.  Otherwise we
end up creating a fake device instance every time ...
2010-05-02 15:35:00 +00:00
pooka 145a3f9eec ignore mainbus in previous for now 2010-05-01 23:54:35 +00:00
pooka 194e1c80bc Support interface attributes as pseudoroots. This makes things like
"pseudo-root audiobus*" possible.
2010-05-01 22:17:58 +00:00
pooka 3da3ab250b 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)
2010-04-30 20:47:17 +00:00
pooka 3718acd4b5 output __arraycount instead of homegrown macro 2010-04-15 12:35:57 +00:00
pooka b7a2b071f9 Put cfdata* in a similar namespace with cfdriver** cfattachinit*.
This was nagging me already yesterday, but I decided to leave it
alone for better compat with old ioconf.c builds.  But as it turns
out, new code depends on newly built ioconf.c with a new config(1)
anyway, so renaming is not an issue (at least not at this stage).

While renaming, namespace cfdriver and cfattach in "ioconf" rather
than "comp", since the former reflects the config(5) keyword.
2010-03-26 15:51:17 +00:00
pooka abc34bd561 Generate cfdriver and cfattach lists for ioconf configs. 2010-03-25 19:39:05 +00:00
pooka d0e5d93744 Some drivers want to include ioconf.h, so generate it if doing
"ioconf" config.
2010-03-22 14:40:54 +00:00
pooka 523c21179c print ioconf WARNING in caps too 2010-03-08 11:12:32 +00:00
pooka 90ac64de16 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.
2010-03-08 10:19:14 +00:00