Home | History | Annotate | Line # | Download | only in config
TODO revision 1.8
      1 o Call module as module.
      2 
      3   Until now, everything is called as attribute.  Separate module from it:
      4 
      5 	- Module is a collection of code (*.[cSo]), and provides a function.
      6 	  Module can depend on other modules.
      7 
      8 	- Attribute provides metadata for modules.  One module can have
      9 	  multiple attributes.  Attribute doesn't generate a module (*.o,
     10 	  *.ko).
     11 
     12 o Emit everything (ioconf.*, Makefile, ...) per-attribute.
     13 
     14 o Generate modular(9) related information.  Especially module dependency.
     15 
     16 o Rename "interface attribute" to "bus".
     17 
     18   Instead of
     19 
     20 	define	audiobus {}
     21 	attach	audio at audiobus
     22 
     23   Do like this
     24 
     25 	defbus	audiobus {}
     26 	attach	audio at audiobus
     27 
     28 o Retire "attach foo at bar with foo_bar.c"
     29 
     30   Most of these should be rewritten by defining a common interface attribute
     31   "foobus", instead of writing multiple attachments.  com(4), ld(4), ehci(4)
     32   are typical examples.  For ehci(4), EHCI-capable controller drivers implement
     33   "ehcibus" interface, like:
     34 
     35 	defne	ehcibus {}
     36 	device	imxehci: ehcibus
     37 
     38   These drivers' attach functions call config_found() to attach ehci(4) via
     39   the "ehcibus" interface attribute, instead of calling ehci_init() directly.
     40   Same for com(4) (com_attach_subr()) and ld(4) (ldattach()).
     41 
     42 o Sort objects in more reasonable order.
     43 
     44   Put machdep.ko in the lowest address.  uvm.ko and kern.ko follow.
     45 
     46   Kill alphabetical sort (${OBJS:O} in sys/conf/Makefile.inc.kern.
     47 
     48   Use ldscript.  Do like this
     49 
     50 	.text :
     51 	AT (ADDR(.text) & 0x0fffffff)
     52 	{
     53 	  *(.text.machdep.locore.entry)
     54 	  *(.text.machdep.locore)
     55 	  *(.text.machdep)
     56 	  *(.text)
     57 	  *(.text.*)
     58 	  :
     59 
     60   Kill linker definitions in sys/conf/Makefile.inc.kern.
     61 
     62 o Differentiate "options" and "flags"/"params".
     63 
     64   "options" enables features by adding *.c files (via attributes).
     65 
     66   "flags" and "params" are to change contents of *.c files.  These don't add
     67   *.c files to the result kernel, or don't build attributes (modules).
     68 
     69 o Make flags/params per attributes (modules).
     70 
     71   Basically flags and params are cpp(1) #define's generated in opt_*.h.  Make
     72   them local to one attributes (modules).  Flags/params which affects files
     73   across attributes (modules) are possible, but should be discouraged.
     74 
     75 o Generate things only by definitions.
     76 
     77   In the ideal dynamically modular world, "selection" will be done not at
     78   compile time but at runtime.  Users select their wanted modules, by
     79   dynamically loading them.
     80 
     81   This means that the system provides all choices; that is, build all modules
     82   in the source tree.  Necessary information is defined in the "definition"
     83   part.
     84 
     85 o Split cfdata.
     86 
     87   cfdata is a set of pattern matching rules to enable devices at runtime device
     88   auto-configuration.  It is pure data and can (should) be generated separately
     89   from the code.
     90 
     91 o Allow easier adding and removing of options.
     92 
     93   It should be possible to add or remove options, flags, etc.,
     94   without regard to whether or not they are already defined.
     95   For example, a configuration like this:
     96 
     97 	include GENERIC
     98 	options FOO
     99 	no options BAR
    100 
    101   should work regardless of whether or not options FOO and/or
    102   options BAR were defined in GENERIC.  It should not give
    103   errors like "options BAR was already defined" or "options FOO
    104   was not defined".
    105 
    106 o Introduce "class".
    107 
    108   Every module should be classified as at least one class, as modular(9)
    109   modules already do.  For example, file systems are marked as "vfs", network
    110   protocols are "netproto".
    111 
    112   Consider to merge "devclass" into "class".
    113 
    114   For syntax clarity, class names could be used as a keyword to select the
    115   class's instance module:
    116 
    117 	# Define net80211 module as netproto class
    118 	class netproto
    119 	define net80211: netproto
    120 
    121 	# Select net80211 to be builtin
    122 	netproto net80211
    123 
    124   Accordingly device/attach selection syntax should be revisited.
    125 
    126 o Support kernel constructor/destructor (.kctors/.kdtors)
    127 
    128   Initialization and finalization should be called via constructors and
    129   destructors.  Don't hardcode those sequences as sys/kern/init_main.c:main()
    130   does.
    131 
    132   The order of .kctors/.kdtors is resolved by dependency.  The difference from
    133   userland is that in kernel depended ones are located in lower addresses;
    134   "machdep" module is the lowest.  Thus the lowest entry in .ctors must be
    135   executed the first.
    136 
    137   The .kctors/.kdtors entries are executed by kernel's main() function, unlike
    138   userland where start code executes .ctors/.dtors before main().  The hardcoded
    139   sequence of various subsystem initializations in init_main.c:main() will be
    140   replaced by an array of .kctors invocations, and #ifdef's there will be gone.
    141 
    142 o Replace linkset.
    143 
    144   Don't allow kernel subsystems create random ELF sections (with potentially
    145   long names) in the final kernel.  To collect some data in statically linked
    146   modules, creating intermediate sections (e.g. .data.linkset.sysctl) and
    147   exporting the start/end symbols (e.g. _data_linkset_sysctl_{start,end})
    148   using linker script should be fine.
    149 
    150   Dynamically loaded modules have to register those entries via constructors
    151   (functions).  This means that dynamically loaded modules are flexible but
    152   come with overhead.
    153 
    154 o Shared kernel objects.
    155 
    156   Since NetBSD has not established a clear kernel ABI, every single kernel
    157   has to build all the objects by their own.  As a result, similar kernels
    158   (e.g. evbarm kernels) repeatedly compile similar objects, that is waste of
    159   energy & space.
    160 
    161   Share them if possible.  For evb* ports, ideally everything except machdep.ko
    162   should be shared.
    163 
    164   While leaving optimizations as options (CPU specific optimizations, inlined
    165   bus_space(9) operations, etc.) for users, the official binaries build
    166   provided by TNF should be as portable as possible.
    167