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