Commit Graph

308 Commits

Author SHA1 Message Date
simonb 1bee87041f Add CWARNFLAGS+=-Wno-format-y2k so this builds again with the pc532
toolchain.
2002-11-20 05:33:58 +00:00
atatat 15d85dcb14 Alter config so that it emits a config_time.src file (the source file
for config_time.h) that contains, for example:

/* Sun Nov 17 05:37:51 2002 GMT */
#define CONFIG_TIME     1037511471
#define CONFIG_YEAR     2002
#define CONFIG_MONTH    11
#define CONFIG_DATE     17
#define CONFIG_HOUR      5
#define CONFIG_MINS     37
#define CONFIG_SECS     51

These values represent the current time as of when config was last
run, so that functions (eg, inittodr()) can use these values instead
of being updated once every year or so with the "current" time.

The associated modification to Makefile.kern.inc makes config_time.h
depend on this depend on this and the kernel Makefile, so that
granularity of kernel builds is not reduced.
2002-11-19 04:29:19 +00:00
atatat 399c5e40ce Define KERNEL_BUILD at the top of the emitted kernel Makefile. This
means that the appropriate combination of checking for KERNEL_BUILD,
RELEASEDIR, DESTDIR, and/or BSD_PKG_MK, can allow the setting of COPTS
or CFLAGS (or anything else) depending on the specific task at hand.
Personally, I think that per-kernel install rules are the best part.
2002-11-19 04:24:16 +00:00
thorpej 42ea935cff Add a "package" keyword, which makes it somewhat easier to add 3rd
party software packages to the kernel.  The statment:

package "../path/to/some/directory/files.package"

is equivalent to the sequence:

prefix "../path/to/some/directory"
include "files.package"
prefix
2002-11-17 23:36:19 +00:00
thorpej aceaa7e184 When emitting -I directives for prefix'd paths, use EXTRA_INCLUDES
rathern than INCLUDES, so that it works with sys/conf/Makefile.kern.inc.
2002-11-17 22:10:05 +00:00
jrf 2547287233 Corrected the comment and error message. 2002-11-07 21:06:04 +00:00
jrf fb826ed9ad Detect NULL characters in a config file and error out. 2002-11-07 20:07:07 +00:00
thorpej 93854e538b Allow devices to be orphaned, but emit an informational message when
this occurs.
2002-10-11 02:02:24 +00:00
thorpej a27b30b1f8 Oops, fix editor mistake. 2002-10-11 01:54:50 +00:00
thorpej bd86bbe5e9 Add support for specifying attributes as option-dependencies,
allowing for the following:

file foo.c	foobar | bar

defflag BAR

device foobar

...to be expressed in the following (more natural) way:

define foo
file foo.c	foo

defflag BAR: foo

device foobar: foo
2002-10-11 01:48:25 +00:00
thorpej 1f5fa983ab Add support for specifiying attribute dependencies on attributes. This
allows for the following:

define foo
define bar { }: foo

device foobar: bar

An instance of "foobar" will select "bar", which will in turn select
"foo" due to "bar"'s dependency on "foo".

Circular dependencies are not allowed, and a dependency may also not
be an interface attribute.
2002-10-09 20:17:00 +00:00
thorpej 9b10cf346e Use DVUNIT_ANY. 2002-10-09 03:10:19 +00:00
thorpej d90d300b7b Overhaul the way cfattach structures are looked up. The cfdata entry
now carries the name of the attachment (e.g. "tlp_pci" or "audio"),
and cfattach structures are registered at boot time on a per-driver
basis.  The cfdriver and cfattach pointers are cached in the device
structure when attached.
2002-10-04 01:50:53 +00:00
thorpej ab0f429042 Add a trailing ; to CFDRIVER_DECL. 2002-10-02 16:49:03 +00:00
thorpej f4a263573b Use CFDRIVER_DECL(). 2002-09-30 18:54:36 +00:00
thorpej bf97c13c6c Declare all cfattach structures const. 2002-09-27 20:41:46 +00:00
thorpej d1ad2ac4f2 Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver.  The cfdriver is then looked
up in a list which is built at run-time.
2002-09-27 02:24:06 +00:00
thorpej 09354b26ef Fix an uninitialized pointer bug in emitcfdata(). 2002-09-26 21:07:49 +00:00
thorpej fc0fe0347d Overhaul the way parent attachments are specified; instead of using
a vector of indices into the cfdata table to specify potential parents,
record the interface attributes that devices have and add a new "parent
spec" structure which lists the iattr, as well as optionally listing
specific parent device instances.

See:

    http://mail-index.netbsd.org/tech-kern/2002/09/25/0014.html

...for a detailed description.

While here, const poison some things, as suggested by Matt Thomas.
2002-09-26 04:07:35 +00:00
dbj df3f757254 add mkdevsw.o to OBJS 2002-09-22 06:22:50 +00:00
enami 78948a7123 Salvage pre-devsw config support so that one can config such as other
branch's kernel.
2002-09-11 06:20:09 +00:00
junyoung b255e80b6f Make this compile. 2002-09-06 13:59:09 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
ross 6a36d10f0d Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.

Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.

Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 02:09:12 +00:00
ross 5ac0b7aefd Return new terminal QSTRING for quoted strings, instead of the
usual symbol name type WORD; quoted strings can now only be used
where they appear in the (revised) grammar. See gram.y 1.34.
2002-06-22 02:04:28 +00:00
lukem 90028da4e1 Functionality improvements:
- Add `no' keyword, which can be used in the following ways:
	no file-system SOMEFS
	no makeoptions FOO
	no options OPT1[,OPT2[,...]]
	no pseudo-device somepseudo
  This turns off a previous file-system/makeoptions/options/pseudo-device
  entry for the same item.
  Grammar support for 'no device DEV at ATTACH' added, but not
  implemented yet.

Code changes:
- Convert many simple lists to TAILQs
- Convert prefix to SLIST
- Remove argument names from prototypes.
- Don't bother with custom alloc code for hashtables; just use emalloc()
  like everything else.
- Implement ht_remove(), to remove an entry from a hash table.
  Add removed entries to a freelist for later reuse.
- Don't selectbase() devices and pseudo-devices at definition time; instead
  do it at one pass after the config file has been parsed in fixdevis().
- Rename nvhead to nvfreelist; a more apt name...
- Minor code cleanups.
2002-06-05 10:56:17 +00:00
pk 5f8328c032 Serialize gram.y -> gram.[ch] transformation. 2002-03-05 15:00:07 +00:00
atatat 714a76fd97 Avoid needlessly recreating the Makefile, ioconf.c, or any of the
swap*.c files if they haven't changed from the last time config was
run, so that less stuff will need to be rebuilt (ie, assym.h, upon
which many other things depend) each time config is rerun.
2002-02-12 23:20:11 +00:00
tv 9fbd88883c Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
  sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
2002-01-31 22:43:33 +00:00
tv a328e34106 Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
2002-01-29 10:20:28 +00:00
wiz c43de8bde2 Include err.h for err(3) prototype. 2002-01-19 17:07:51 +00:00
mjl 7ea8665c72 Catch open failure and exit with error instead of crashing. 2002-01-19 06:10:13 +00:00
thorpej e6d41917cc Newlines in string literals are not supported by ANSI C, and some
preprocessors complain bitterly when they are encountered.

For now, terminate all lines with \n (and make each line its own
string literal).  The author of this code can figure out how to
do the sed trick another way.
2001-12-23 22:41:27 +00:00
atatat 65ace4b729 Properly use $TMPDIR or /tmp for the temporary config file stuff,
instead of ".".  Read-only source trees are "good".
2001-12-21 19:09:43 +00:00
atatat eb0a09d704 Teach config how to store the config in a .h file such that it can be
embedded in the resulting kernel binary.
2001-12-17 15:39:43 +00:00
wiz 2f3bcd9810 Comment out now-empty .Rs/.Re. 2001-12-14 12:32:50 +00:00
gmcgarry 367be6a153 Sprinkle around the term "machine description file", since this is
the term used in config(9), autoconf(9) and in Torek's paper.

Also remove (comment out) reference to the 4.4BSD config docs,
since they are not installed in usr/share/doc/smm/02.config and
possibly aren't relevant any longer.  From comments made on
tech-kern by jhawk and tls.
2001-12-13 19:47:19 +00:00
atatat 6dce2e2bec Make the kernel depend on `vers.o' instead of `newvers'. This
eliminates the need to unconditionally rebuild vers.o and subsequently
to relink the kernel every time you type make, even if you just
finished one.
2001-12-09 16:04:03 +00:00
wiz 6a71504b07 Add a ',' between two Xrefs. 2001-12-06 10:57:20 +00:00
atatat 42e4429bad Since defopt has been totally eradicated from the tree and is
considered "bad form", let's tell people they shouldn't use it.
2001-12-05 23:42:37 +00:00
jhawk 22fc75e3b6 Xr config.9 2001-12-05 20:58:04 +00:00
atatat 73aae2a161 Stuff the target names (the kernel names) into a make variable so that
ports that build "alternate" versions of the same target can clean up
properly.
2001-12-04 17:53:40 +00:00
lukem 0e59a7f124 revert previous revert previous. now back to rev 1.27 behaviour:
- Don't bother emitting "#define NFOO 0" for defflag foo (whether or
  not "options FOO" was given); it's really useful as is.

  Until I recently started converting stuff from defopt to defflag,
  nothing used defflag, and because defopt doesn't provide NFOO for FOO,
  the NFOO behaviour shouldn't be missed. The NFOO stuff also added
  a lot of #define namespace pollution that we'd rather avoid.

- Remove a couple of unused vars
2001-11-28 09:02:16 +00:00
lukem 7b844b40dc ensure that enabled defflag options get a default value of "1" too 2001-11-28 05:03:31 +00:00
lukem 49379a0a84 revert previous (instead i'll work out why defflag isn't DTRT with Nxxx) 2001-11-28 03:23:35 +00:00
lukem cbe4dece17 - Don't bother emitting "#define NFOO 0" for defflag foo (whether or
not foo was provided); it's unnecessary #define namespace pollution
- Remove a couple of unused vars
2001-11-28 02:47:42 +00:00
atatat 3b7ac0bb5f Stuff the "swapxxx.o" object name into a make variable that can be
used in build rules.
2001-11-27 14:04:05 +00:00
thorpej b2cb6c26ef Don't set TARGET_MACHINE, set MACHINE, instead. MACHINE is consistent
with what other Makefiles use, and as a result, make cross-compiling
kernels a little easier.
2001-10-23 18:56:42 +00:00
tv 47ab6193ba Make this a little more portable to other NetBSD versions without
MAKE_BOOTSTRAP -- use our hand-rolled [gs]etprogname() at all times (er,
actually, the single time we need it...).
2001-10-02 21:31:01 +00:00
simonb c6d44b5eb4 ANSIfy the output of config(8). 2001-10-01 04:22:00 +00:00
tv 6042281606 Don't override the definition of LEX. 2001-09-25 01:40:09 +00:00
enami 54d0f0cc4b Fix off-by-one error; root on sd0i shoule be rejected if maxpartition is 8. 2001-09-11 05:11:59 +00:00
tv dba5d44670 Add hooks to allow toolchain bits to be reachover-built at the top level. 2001-08-14 10:18:26 +00:00
itojun a42562635c sync .Fl with reality 2001-07-03 08:52:00 +00:00
gmcgarry 32fc55d6d2 Don't pack locators. Introduce a new commandline option to
restore the previous behaviour of packing locators.

Results in a 2.5KB increase in size for the current i386 GENERIC
kernel.  My custom kernel resulted in a 12-byte increase.
2001-07-01 02:46:47 +00:00
fredette de800ed660 Added support for listing multiple additional names on
a `machine' line.  For each of these subarches, its
arch/${SUBARCH}/conf/files.${SUBARCH} is included, and
a symlink ${SUBARCH} -> arch/${SUBARCH}/include is made.
This will for a "richer structure" and easier code
sharing under sys/arch.
2001-06-08 12:47:06 +00:00
minoura 81e8dc3cac Correct a typo.
Pointed out by MAEKAWA Masahide <maekawa@kbug.gr.jp>.
2001-05-18 07:48:07 +00:00
cgd c2bdafab79 use getprogname() 2001-02-20 23:51:59 +00:00
bjh21 a9e45dc961 Put both .S and .s files in SFILES. Fixes bin/12051. Patch from Richard
Earnshaw via Chris Gilbert.

The right solution here is to have every port use .S, but that might take a
while...
2001-01-31 00:15:40 +00:00
thorpej ed7ec7c142 Make this work again for the case where there are devices
configured, but none of those devices happen to have locators.
2001-01-18 07:09:47 +00:00
cgd fdfcf1962d labels (even default:) _must_ be followed by statements! usr.bin/fgen/fgen.l 2001-01-16 02:43:37 +00:00
lukem 1d0a6f62b8 revert 1.51 and 1.52 (_KERNEL_foo stuff), due to loud objections from
a couple of people.  we'll just have to go back to adding this manually
to our config files...
2000-12-14 22:14:45 +00:00
lukem ea03d7ba8e change KERNEL_foo -> _KERNEL_foo, as suggested by matt green 2000-12-12 17:49:20 +00:00
lukem f125ced5a1 Add option `KERNEL_foo', where `foo' is the basename of the build directory.
This will get added to the Makefile's IDENT= as -DKERNEL_foo.
2000-12-12 08:46:02 +00:00
matt a2877b394c Don't emit MACHINE/MACHINE_ARCH. Instead emit a TARGET_MACHINE=machine
instead.
2000-12-03 07:06:15 +00:00
matt 5cde4cf735 If a port-specific Makefile.<port> doesn't exist, try a arch-specific
Makefile.<arch>.
Emit MACHINE=<port> and MACHINE_ARCH=<arch> to the emitted Makefile.
2000-12-02 23:01:54 +00:00
cgd a1a91fd28f if there are no locators or parent, don't output those arrays. (Sometimes
you really want no devices whatsoever.  In that case, you get unused
static var warnings from the compile.)  Reviewed by sommerfeld.
2000-11-18 00:51:29 +00:00
is d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
bjh21 23dc98ae44 Don't try to use yydebug when we're building on a foreign system. Not all
yaccs provide it (notably GNU Bison 1.28).
Fixes the final part of PR#9112 (building under GNU/Linux).
2000-10-08 11:33:40 +00:00
cgd 1e69382368 clean up dev_t-related portability defines (and actually #define dev_t now).
Make major() et al match current NetBSD implementation.  In reality,
the code here in config which plays with these bits should be cleaned up
to treat major and minor separately.  (They only reason they're being mashed
together is storage convenience.)
2000-10-02 19:59:42 +00:00
cgd da723c733f include copyright notice in binary even if bootstrapping. 2000-10-02 19:57:23 +00:00
cgd 506c287193 bump ALIGNBYTES up to 7 -- that way this'll have more of a hope
of working on non-NetBSD systems with 64-bit pointers.  (affects only
the MAKE_BOOTSTRAP case, and then only if BSD not defied.)
2000-10-02 19:51:07 +00:00
cgd 463d864ef0 nuke __P, and convert all functions to use ANSI-style declarations.
Also, do a few trivial KNF cleanups (e.g. newline at start of fn if no
locals).  Verified to have no effect via diff on new and old compiled
binaries.
2000-10-02 19:48:34 +00:00
cgd a755a0d943 remove vestiges of checks for __STDC__ 2000-10-02 18:59:03 +00:00
cgd c026189f76 do that previous differently. only allow redefinitions if: in different
file, make command specified, and no flags or attrs-which-cause-inclusion
are spec'd.  The notion is, if you change either of the last 2, it will
probably have very undesirable results, so only allow the make command to
be changed.  override by clobbering the make command in the previous entry.
also, fix a bug where line number of original entry would get clobbered on
dup entry, so that if you had multiple dups the later ones would get bogus
initial definition info.
2000-06-09 05:06:12 +00:00
eeh e5cf411171 Allow MD files files to override settings in MI files files. (From Chris Torek). 2000-06-08 21:22:55 +00:00
hubertf 13afcc6b33 If maxusers is out of bounds, show the allowed bounts in the error msg. 2000-05-09 00:34:58 +00:00
simonb fd4ede242b Don't declare 'extern opt*' getopt variables. 2000-04-14 06:26:52 +00:00
enami 1b1b19c5c5 Emit `.MAIN: all' to force the target `all' as default target. 2000-02-01 05:13:17 +00:00
enami 0d45936ccf Please pay an attention to the existing code and not to introduce
different coding style.
2000-01-25 01:16:00 +00:00
hubertf 764307a5a1 Keeping my kernel config files under RCS control, I always wished to
have a way to embed the revision number into the kernel's "uname -v"
output. The patch below does this, by generating a new keyword "ident"
that can be followed by any string, e.g.

        ident   "NOON-$Revision$"

will lead to
                                           vvvvvvvvvvvvvvvvvvvvvv
        char version[] =     "NetBSD 1.4P (NOON-$Revision: 1.21 $) #37: Thu Jan
20 02:01:23 MET 2000\n    feyrer@noon:/usr/cvs.local/src-current/sys/arch/i386/c
ompile/NOON\n";

This will lead to a version of "MYMACHINE-$Revision$" instead of the
kernel config file name. If "ident" is not present, the current behaviour
of using the kernel config file's name as identifier is used.

Implement by writing the ident to a file ("ident") in the compile dir,
which newvers.sh will pick up for generating the ident.
2000-01-23 23:37:42 +00:00
thorpej aa1aaac03e Allow abolute pathnames as prefixes. 2000-01-20 00:08:08 +00:00
drochner 4b3a806e80 print a warning if a "cinclude"d file cannot be opened and the -v flag
is given
2000-01-05 11:24:02 +00:00
nathanw 19d95c5d43 Fix typo in comment. 1999-12-20 17:19:13 +00:00
enami 8e1cda20c6 Fix the path of ioconf.incl.$MACHINE using sourcepath(). This is part
of PR#8369.  Also, make sure that the file pointer ifp is always closed.
1999-09-24 04:48:37 +00:00
enami 532da8eb1c Remove redundant declaration of firstfile(). 1999-09-24 04:23:36 +00:00
ws b17a1042ba Allow mutual dependencies.
Output string-valued options reasonably to option files.
1999-09-22 14:23:03 +00:00
is 54e4d2fc26 Fix grammar, as pointed out by Olaf Seibert. 1999-09-21 15:50:19 +00:00
hubertf f3269a6dee Clean up flex output (gram.[ch]).
Reported in PR 8232 by Andrew Cagney <ac131313@cygnus.com>
1999-08-19 02:27:02 +00:00
thorpej 8c134b93a0 If unlink() fails w/ ENOENT, don't display an error message. 1999-07-31 05:22:05 +00:00
hubertf b0f5059f43 Don't ignore the return value of two unlink() commands, and print
some warnings instead, if unlinking fails.

Fixes PR 4634 by myself.
1999-07-29 20:08:59 +00:00
thorpej 95a36e1425 Fix bug in previous; allprefixes didn't work if there were multiple prefixes. 1999-07-09 18:46:09 +00:00
thorpej 64f20db21b Make the outputted INCLUDES directives a bit more cosmetically appealing. 1999-07-09 18:45:31 +00:00
mrg ecdad0ec33 clean up a bit after jason :)
- fix emitrules() like emitfiles() to deal with the prefix (otherwise it
  would attempt to find the file in the normal base for the NORMAL_C rule).
- add emitincludes() which adds include directives for each prefix to the
  $INCLUDES variable in the makefile.
- add %INCLUDES to each Makefile.arch to deal with the above.

this makes "prefix" actually work in a usable manner, and now i can move
on to fixing compiler warnings (errors) in the ESP code. :)
1999-07-09 09:52:55 +00:00
thorpej 152af09e65 Add a mechanism to specify prefixes that are transparently prepended
to file specifications.  The prefixes are arranged in a stack, and
nest, so that file, object, and include specifications are normalized,
and all end up relative to the kernel compile directory.

For example, in the kernel config file:

# Pull in config fragments for kernel crypto
prefix ../crypto-us/sys 			# push it
cinclude "conf/files.crypto-us"			# include it if it's there
prefix						# pop it

and in files.crypto-us:

file netinet6/esp_core.c                ipsec & ipsec_esp
file netinet6/esp_output.c              ipsec & ipsec_esp
file netinet6/esp_input.c               ipsec & ipsec_esp

...generates the following in the kernel Makefile:

        $S/../crypto-us/sys/netinet6/esp_core.c \
        $S/../crypto-us/sys/netinet6/esp_output.c \
        $S/../crypto-us/sys/netinet6/esp_input.c \

By placing this all in the kernel config file, all the magic involved in
reaching into non-standard kernel source directories is placed into a file
that the user is expected to edit anyway, and reasonable examples (and
sane defaults, for typical source checkouts) can be provided.
1999-07-09 06:44:58 +00:00
thorpej 02a4ec93e9 Nuke the work-around for non-normalized include paths. They have all
been fixed up.
1999-07-09 02:37:26 +00:00
thorpej 0ee6c639c7 Add a mechanism for files.* files to be included, in the kernel configuration
file, conditional on their existence.  For example:

[ in ../conf/GENERIC ]
cinclude "../crypto-intl/sys/conf/files.crypto-intl"

This required a change to the files.* grammar; pseudo-device in that
context has been changed to defpseudo, to avoid a conflicting rule
for pseudo-device in the kernel config files.

The same grammar change allows vendors to ship files.* files for
commercial drivers, rather than diffs to e.g. files.pci, i.e.:

include "arch/i386/pci/files.zap"
zap* at pci? device ? function ?

Where files.zap might contain:

device zap: ether, ifnet, arp, mii
attach zap at pci
object	arch/i386/pci/zap.o	zap
1999-07-07 00:02:09 +00:00
mycroft 01e0430cea Allow absolute path names for `object' files. 1999-05-23 19:30:30 +00:00
gwr 5a4e7b6de7 Make this build on Solaris (make -f Makefile.boot) 1999-04-02 06:36:30 +00:00
mycroft afd308129a Output a dependency on `newvers' for *every* kernel. It only gets run at most
once per make(1) invocation anyway, and not doing this screwed up parallel
makes.
1999-03-30 12:36:50 +00:00