Home | History | Annotate | Line # | Download | only in config
      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.9  uebayasi   config(9) related metadata (cfdriver, cfattach, cfdata, ...) should be
     15   1.9  uebayasi   collected using linker.  Create ELF sections like
     16   1.9  uebayasi   .{rodata,data}.config.{cfdriver,cfattach,cfdata}.  Provide reference
     17   1.9  uebayasi   symbols (e.g. cfdriverinit[]) using linker script.  Sort entries by name
     18   1.9  uebayasi   to lookup entries by binary search in kernel.
     19   1.9  uebayasi 
     20   1.1  uebayasi o Generate modular(9) related information.  Especially module dependency.
     21   1.1  uebayasi 
     22   1.9  uebayasi   At this moment modular(9) modules hardcode dependency in *.c using the
     23   1.9  uebayasi   MODULE() macro:
     24   1.9  uebayasi 
     25   1.9  uebayasi 	MODULE(MODULE_CLASS_DRIVER, hdaudio, "pci");
     26   1.9  uebayasi 
     27   1.9  uebayasi   This information already exists in config(5) definitions (files.*).
     28   1.9  uebayasi   Extend config(5) to be able to specify module's class.
     29   1.9  uebayasi 
     30   1.9  uebayasi   Ideally these module metadata are kept somewhere in ELF headers, so that
     31   1.9  uebayasi   loaders (e.g. boot(8)) can easily read.  One idea is to abuse DYNAMIC
     32   1.9  uebayasi   sections to record dependency, as shared library does.  (Feasibility
     33   1.9  uebayasi   unknown.)
     34   1.9  uebayasi 
     35   1.1  uebayasi o Rename "interface attribute" to "bus".
     36   1.1  uebayasi 
     37   1.1  uebayasi   Instead of
     38   1.1  uebayasi 
     39   1.1  uebayasi 	define	audiobus {}
     40   1.1  uebayasi 	attach	audio at audiobus
     41   1.1  uebayasi 
     42   1.1  uebayasi   Do like this
     43   1.1  uebayasi 
     44   1.1  uebayasi 	defbus	audiobus {}
     45   1.1  uebayasi 	attach	audio at audiobus
     46   1.1  uebayasi 
     47  1.15  uebayasi   Always provide xxxbusprint() (and xxxbussubmatch if multiple children).
     48  1.15  uebayasi   Extend struct cfiattrdata like:
     49  1.15  uebayasi 
     50  1.15  uebayasi 	struct cfiattrdata {
     51  1.15  uebayasi 		const char *ci_name;
     52  1.15  uebayasi 		cfprint_t ci_print;
     53  1.15  uebayasi 		cfsubmatch_t ci_submatch;
     54  1.15  uebayasi 		int ci_loclen;
     55  1.15  uebayasi 		const struct cflocdesc ci_locdesc[];
     56  1.15  uebayasi 	};
     57  1.15  uebayasi 
     58  1.15  uebayasi o Simplify child configuration API
     59  1.15  uebayasi 
     60  1.15  uebayasi   With said struct cfiattrdata extension, config_found*() can omit
     61  1.15  uebayasi   print/submatch args.  If the found child is known (e.g., "pcibus" creating
     62  1.15  uebayasi   "pci"):
     63  1.15  uebayasi 
     64  1.16  uebayasi 	config_found(self, "pcibus");
     65  1.15  uebayasi 
     66  1.15  uebayasi   If finding unknown children (e.g. "pci" finding pci devices):
     67  1.15  uebayasi 
     68  1.15  uebayasi 	config_find(self, "pci", locs, aux);
     69  1.15  uebayasi 
     70   1.8  uebayasi o Retire "attach foo at bar with foo_bar.c"
     71   1.8  uebayasi 
     72   1.8  uebayasi   Most of these should be rewritten by defining a common interface attribute
     73   1.8  uebayasi   "foobus", instead of writing multiple attachments.  com(4), ld(4), ehci(4)
     74   1.8  uebayasi   are typical examples.  For ehci(4), EHCI-capable controller drivers implement
     75   1.8  uebayasi   "ehcibus" interface, like:
     76   1.8  uebayasi 
     77  1.33    andvar 	define	ehcibus {}
     78   1.8  uebayasi 	device	imxehci: ehcibus
     79   1.8  uebayasi 
     80   1.8  uebayasi   These drivers' attach functions call config_found() to attach ehci(4) via
     81   1.8  uebayasi   the "ehcibus" interface attribute, instead of calling ehci_init() directly.
     82   1.8  uebayasi   Same for com(4) (com_attach_subr()) and ld(4) (ldattach()).
     83   1.8  uebayasi 
     84   1.1  uebayasi o Sort objects in more reasonable order.
     85   1.1  uebayasi 
     86   1.1  uebayasi   Put machdep.ko in the lowest address.  uvm.ko and kern.ko follow.
     87   1.1  uebayasi 
     88   1.1  uebayasi   Kill alphabetical sort (${OBJS:O} in sys/conf/Makefile.inc.kern.
     89   1.1  uebayasi 
     90   1.1  uebayasi   Use ldscript.  Do like this
     91   1.1  uebayasi 
     92   1.1  uebayasi 	.text :
     93   1.1  uebayasi 	AT (ADDR(.text) & 0x0fffffff)
     94   1.1  uebayasi 	{
     95   1.1  uebayasi 	  *(.text.machdep.locore.entry)
     96   1.1  uebayasi 	  *(.text.machdep.locore)
     97   1.1  uebayasi 	  *(.text.machdep)
     98   1.1  uebayasi 	  *(.text)
     99   1.1  uebayasi 	  *(.text.*)
    100   1.1  uebayasi 	  :
    101   1.1  uebayasi 
    102   1.1  uebayasi   Kill linker definitions in sys/conf/Makefile.inc.kern.
    103   1.2  uebayasi 
    104   1.3       wiz o Differentiate "options" and "flags"/"params".
    105   1.2  uebayasi 
    106   1.3       wiz   "options" enables features by adding *.c files (via attributes).
    107   1.2  uebayasi 
    108   1.2  uebayasi   "flags" and "params" are to change contents of *.c files.  These don't add
    109   1.3       wiz   *.c files to the result kernel, or don't build attributes (modules).
    110   1.2  uebayasi 
    111   1.2  uebayasi o Make flags/params per attributes (modules).
    112   1.2  uebayasi 
    113   1.2  uebayasi   Basically flags and params are cpp(1) #define's generated in opt_*.h.  Make
    114   1.2  uebayasi   them local to one attributes (modules).  Flags/params which affects files
    115   1.2  uebayasi   across attributes (modules) are possible, but should be discouraged.
    116   1.2  uebayasi 
    117   1.2  uebayasi o Generate things only by definitions.
    118   1.2  uebayasi 
    119   1.2  uebayasi   In the ideal dynamically modular world, "selection" will be done not at
    120   1.2  uebayasi   compile time but at runtime.  Users select their wanted modules, by
    121   1.2  uebayasi   dynamically loading them.
    122   1.2  uebayasi 
    123   1.2  uebayasi   This means that the system provides all choices; that is, build all modules
    124   1.2  uebayasi   in the source tree.  Necessary information is defined in the "definition"
    125   1.2  uebayasi   part.
    126   1.2  uebayasi 
    127   1.2  uebayasi o Split cfdata.
    128   1.2  uebayasi 
    129   1.8  uebayasi   cfdata is a set of pattern matching rules to enable devices at runtime device
    130   1.3       wiz   auto-configuration.  It is pure data and can (should) be generated separately
    131   1.2  uebayasi   from the code.
    132   1.4       apb 
    133   1.4       apb o Allow easier adding and removing of options.
    134   1.4       apb 
    135   1.4       apb   It should be possible to add or remove options, flags, etc.,
    136   1.4       apb   without regard to whether or not they are already defined.
    137   1.4       apb   For example, a configuration like this:
    138   1.4       apb 
    139   1.4       apb 	include GENERIC
    140   1.4       apb 	options FOO
    141   1.4       apb 	no options BAR
    142   1.4       apb 
    143   1.4       apb   should work regardless of whether or not options FOO and/or
    144   1.4       apb   options BAR were defined in GENERIC.  It should not give
    145   1.4       apb   errors like "options BAR was already defined" or "options FOO
    146   1.4       apb   was not defined".
    147   1.4       apb 
    148   1.5  uebayasi o Introduce "class".
    149   1.5  uebayasi 
    150   1.7       wiz   Every module should be classified as at least one class, as modular(9)
    151   1.7       wiz   modules already do.  For example, file systems are marked as "vfs", network
    152   1.5  uebayasi   protocols are "netproto".
    153   1.5  uebayasi 
    154   1.5  uebayasi   Consider to merge "devclass" into "class".
    155   1.5  uebayasi 
    156   1.5  uebayasi   For syntax clarity, class names could be used as a keyword to select the
    157   1.5  uebayasi   class's instance module:
    158   1.5  uebayasi 
    159   1.5  uebayasi 	# Define net80211 module as netproto class
    160   1.5  uebayasi 	class netproto
    161   1.5  uebayasi 	define net80211: netproto
    162   1.5  uebayasi 
    163   1.5  uebayasi 	# Select net80211 to be builtin
    164   1.5  uebayasi 	netproto net80211
    165   1.5  uebayasi 
    166   1.5  uebayasi   Accordingly device/attach selection syntax should be revisited.
    167   1.5  uebayasi 
    168   1.6  uebayasi o Support kernel constructor/destructor (.kctors/.kdtors)
    169   1.5  uebayasi 
    170   1.5  uebayasi   Initialization and finalization should be called via constructors and
    171   1.5  uebayasi   destructors.  Don't hardcode those sequences as sys/kern/init_main.c:main()
    172   1.5  uebayasi   does.
    173   1.5  uebayasi 
    174   1.6  uebayasi   The order of .kctors/.kdtors is resolved by dependency.  The difference from
    175   1.5  uebayasi   userland is that in kernel depended ones are located in lower addresses;
    176   1.5  uebayasi   "machdep" module is the lowest.  Thus the lowest entry in .ctors must be
    177   1.5  uebayasi   executed the first.
    178   1.5  uebayasi 
    179   1.6  uebayasi   The .kctors/.kdtors entries are executed by kernel's main() function, unlike
    180   1.6  uebayasi   userland where start code executes .ctors/.dtors before main().  The hardcoded
    181   1.6  uebayasi   sequence of various subsystem initializations in init_main.c:main() will be
    182   1.7       wiz   replaced by an array of .kctors invocations, and #ifdef's there will be gone.
    183   1.6  uebayasi 
    184  1.12  uebayasi o Hide link-set in the final kernel.
    185   1.5  uebayasi 
    186  1.12  uebayasi   Link-set is used to collect references (pointers) at link time.  It relys on
    187  1.12  uebayasi   the ld(1) behavior that it automatically generates `__start_X' and `__stop_X'
    188  1.12  uebayasi   symbols for the section `X' to reduce coding.
    189  1.12  uebayasi 
    190  1.12  uebayasi   Don't allow kernel subsystems create random ELF sections.
    191  1.12  uebayasi 
    192  1.12  uebayasi   Pre-define all the available link-set names and pre-generate a linker script
    193  1.12  uebayasi   to merge them into .rodata.
    194  1.12  uebayasi 
    195  1.12  uebayasi   (For modular(9) modules, `link_set_modules' is looked up by kernel loader.
    196  1.12  uebayasi   Provide only it.)
    197  1.12  uebayasi 
    198  1.12  uebayasi   Provide a way for 3rd party modules to declare extra link-set.
    199   1.6  uebayasi 
    200   1.6  uebayasi o Shared kernel objects.
    201   1.6  uebayasi 
    202   1.7       wiz   Since NetBSD has not established a clear kernel ABI, every single kernel
    203   1.6  uebayasi   has to build all the objects by their own.  As a result, similar kernels
    204   1.6  uebayasi   (e.g. evbarm kernels) repeatedly compile similar objects, that is waste of
    205   1.6  uebayasi   energy & space.
    206   1.6  uebayasi 
    207   1.6  uebayasi   Share them if possible.  For evb* ports, ideally everything except machdep.ko
    208   1.6  uebayasi   should be shared.
    209   1.6  uebayasi 
    210   1.6  uebayasi   While leaving optimizations as options (CPU specific optimizations, inlined
    211   1.6  uebayasi   bus_space(9) operations, etc.) for users, the official binaries build
    212   1.6  uebayasi   provided by TNF should be as portable as possible.
    213  1.10  uebayasi 
    214  1.23  uebayasi o Always use explicit kernel linker script.
    215  1.23  uebayasi 
    216  1.23  uebayasi   ld(1) has an option -T <ldscript> to use a given linker script.  If not
    217  1.23  uebayasi   specified, a default, built-in linker script, mainly meant for userland
    218  1.23  uebayasi   programs, is used.
    219  1.23  uebayasi 
    220  1.23  uebayasi   Currently m68k, sh3, and vax don't have kernel linker scripts.  These work
    221  1.23  uebayasi   because these have no constraints about page boundary; they map and access
    222  1.23  uebayasi   kernel .text/.data in the same way.
    223  1.23  uebayasi 
    224  1.27  uebayasi o Pass input files to ${LD} via linker script.
    225  1.27  uebayasi 
    226  1.27  uebayasi   Instead of passing input files on command-line, output "INPUT(xxx.o)"
    227  1.27  uebayasi   commands, and include it from generated linker scripts.
    228  1.27  uebayasi 
    229  1.31  uebayasi o Directly generate `*.d' files.
    230  1.27  uebayasi 
    231  1.27  uebayasi   Output source/object files in raw texts instead of `Makefile'.  Generate
    232  1.27  uebayasi   `*.d' (make(1) depend) files.  make(1) knows which object files are to be
    233  1.27  uebayasi   compiled.  With "INPUT(xxx.o)" linker scripts, either generated `Makefile'
    234  1.27  uebayasi   or `Makefile.kern.inc' don't need to keep source/object files in variables.
    235  1.27  uebayasi 
    236  1.10  uebayasi o Control ELF sections using linker script.
    237  1.10  uebayasi 
    238  1.10  uebayasi   Now kernel is linked and built directly from object files (*.o).  Each port
    239  1.10  uebayasi   has an MD linker script, which does everything needed to be done at link
    240  1.10  uebayasi   time.  As a result, they do from MI alignment restriction (read_mostly,
    241  1.10  uebayasi   cacheline_aligned) to load address specification for external boot loaders.
    242  1.10  uebayasi 
    243  1.10  uebayasi   Make this into multiple stages to make linkage more structural.  Especially,
    244  1.11  uebayasi   reserve the final link for purely MD purpose.  Note that in modular build,
    245  1.11  uebayasi   *.ko are shared between build of kernel and modular(9) modules (*.kmod).
    246  1.10  uebayasi 
    247  1.10  uebayasi 	Monolithic build:
    248  1.10  uebayasi 		     *.o  ---> netbsd.ko	Generic MI linkage
    249  1.10  uebayasi 		netbsd.ko ---> netbsd.ro	Kernel MI linkage
    250  1.10  uebayasi 		netbsd.ro ---> netbsd		Kernel MD linkage
    251  1.10  uebayasi 
    252  1.10  uebayasi 	Modular build (kernel):
    253  1.10  uebayasi 		     *.o  --->      *.ko	Generic + Per-module MI linkage
    254  1.10  uebayasi 		     *.ko ---> netbsd.ro	Kernel MI linkage
    255  1.10  uebayasi 		netbsd.ro ---> netbsd		Kernel MD linkage
    256  1.10  uebayasi 
    257  1.10  uebayasi 	Modular build (module):
    258  1.10  uebayasi 		     *.o  --->      *.ko	Generic + Per-module MI linkage
    259  1.10  uebayasi 		     *.ko --->      *.ro	Modular MI linkage
    260  1.10  uebayasi 		     *.ro --->      *.kmod	Modular MD linkage
    261  1.10  uebayasi 
    262  1.32       wiz   Generic MI linkage is for processing MI linkage that can be applied generally.
    263  1.10  uebayasi   Data section alignment (.data.read_mostly and .data.cacheline_aligned) is
    264  1.10  uebayasi   processed here.
    265  1.10  uebayasi 
    266  1.10  uebayasi   Per-module MI linkage is for modules that want some ordering.  For example,
    267  1.10  uebayasi   machdep.ko wants to put entry code at the top of .text and .data.
    268  1.10  uebayasi 
    269  1.10  uebayasi   Kernel MI linkage is for collecting kernel global section data, that is what
    270  1.10  uebayasi   link-set is used for now.  Once they are collected and symbols to the ranges
    271  1.10  uebayasi   are assigned, those sections are merged into the pre-existing sections
    272  1.10  uebayasi   (.rodata) because link-set sections in "netbsd" will never be interpreted by
    273  1.10  uebayasi   external loaders.
    274  1.10  uebayasi 
    275  1.10  uebayasi   Kernel MD linkage is used purely for MD purposes, that is, how kernels are
    276  1.10  uebayasi   loaded by external loaders.  It might be possible that one kernel relocatable
    277  1.34    andvar   (netbsd.ro) is linked into multiple final kernel image (netbsd) for different
    278  1.10  uebayasi   load addresses.
    279  1.10  uebayasi 
    280  1.11  uebayasi   Modular MI linkage is to prepare a module to be loadable as modular(9).  This
    281  1.11  uebayasi   may add some extra sections and/or symbols.
    282  1.11  uebayasi 
    283  1.11  uebayasi   Modular MD linkage is again for pure MD purposes like kernel MD linkage.
    284  1.11  uebayasi   Adjustment and/or optimization may be done.
    285  1.11  uebayasi 
    286  1.11  uebayasi   Kernel and modular MI linkages may change behavior depending on existence
    287  1.11  uebayasi   of debug information.  In the future .symtab will be copied using linker
    288  1.11  uebayasi   during this stage.
    289  1.13  uebayasi 
    290  1.24  uebayasi o Fix db_symtab copying (COPY_SYMTAB)
    291  1.24  uebayasi 
    292  1.24  uebayasi   o Collect all objects and create a relocatable (netbsd.ro).  At this point,
    293  1.24  uebayasi     the number of symbols is known.
    294  1.24  uebayasi 
    295  1.24  uebayasi   o Relink and allocate .rodata.symtab with the calculated size of .symtab.
    296  1.24  uebayasi     Linker recalculates symbol addresses.
    297  1.24  uebayasi 
    298  1.24  uebayasi   o Embed the .symtab into .rodata.symtab.
    299  1.24  uebayasi 
    300  1.24  uebayasi   o Link the final netbsd ELF.
    301  1.24  uebayasi 
    302  1.24  uebayasi   The make(1) rule (dependency graph) should be identical with/without
    303  1.24  uebayasi   COPY_SYMTAB.  Kill .ifdef COPY_SYMTAB from $S/conf/Makefile.kern.inc.
    304  1.24  uebayasi 
    305  1.19  uebayasi o Preprocess and generate linker scripts dynamically.
    306  1.19  uebayasi 
    307  1.19  uebayasi   Include opt_xxx.h and replace some constant values (e.g. COHERENCY_UNIT,
    308  1.19  uebayasi   PAGE_SIZE, KERNEL_BASE_PHYS, KERNEL_BASE_VIRT, ...) with cpp(1).
    309  1.19  uebayasi 
    310  1.19  uebayasi   Don't unnecessarily define symbols.  Don't use sed(1).
    311  1.19  uebayasi 
    312  1.19  uebayasi o Clean up linker scripts.
    313  1.19  uebayasi 
    314  1.19  uebayasi   o Don't specify OUTPUT_FORMAT()/OUTPUT_ARCH()
    315  1.19  uebayasi 
    316  1.19  uebayasi     These are basically set in compilers/linkers.  If non-default ABI is used,
    317  1.19  uebayasi     command-line arguments should be specified.
    318  1.19  uebayasi 
    319  1.19  uebayasi   o Remove .rel/.rela handlings.
    320  1.19  uebayasi 
    321  1.19  uebayasi     These are set in relocatable objects, and handled by dynamic linkers.
    322  1.33    andvar     Totally irrelevant for kernels.
    323  1.19  uebayasi 
    324  1.19  uebayasi   o Clean up debug section handlings.
    325  1.19  uebayasi 
    326  1.19  uebayasi   o Document (section boundary) symbols set in linker scripts.
    327  1.19  uebayasi 
    328  1.19  uebayasi     There must be a reason why symbols are defined and exported.
    329  1.19  uebayasi 
    330  1.19  uebayasi     PROVIDE() is to define internal symbols.
    331  1.19  uebayasi 
    332  1.19  uebayasi   o Clean up load addresses.
    333  1.19  uebayasi 
    334  1.19  uebayasi   o Program headers.
    335  1.19  uebayasi 
    336  1.19  uebayasi   o According to matt@, .ARM.extab/.ARM.exidx sections are no longer needed.
    337  1.19  uebayasi 
    338  1.13  uebayasi o Redesign swapnetbsd.c (root/swap device specification)
    339  1.13  uebayasi 
    340  1.13  uebayasi   Don't build a whole kernel only to specify root/swap devices.
    341  1.13  uebayasi 
    342  1.13  uebayasi   Make these parameter re-configurable afterwards.
    343  1.14  uebayasi 
    344  1.14  uebayasi o Namespace.
    345  1.14  uebayasi 
    346  1.14  uebayasi   Investigate namespace of attributes/modules/options.  Figure out the hidden
    347  1.14  uebayasi   design about these, document it, then re-design it.
    348  1.14  uebayasi 
    349  1.14  uebayasi   At this moment, all of them share the single "selecttab", which means their
    350  1.14  uebayasi   namespaces are common, but they also have respective tables (attrtab,
    351  1.14  uebayasi   opttab, etc.).
    352  1.14  uebayasi 
    353  1.14  uebayasi   Selecting an option (addoption()), that is also a module name, works only if
    354  1.14  uebayasi   the module doesn't depend on anything, because addoption() doesn't select
    355  1.14  uebayasi   module and its dependencies (selectattr()).  In other words, an option is
    356  1.14  uebayasi   only safely converted to a module (define), only if it doesn't depend on
    357  1.14  uebayasi   anything.  (One example is DDB.)
    358  1.17  uebayasi 
    359  1.17  uebayasi o Convert pseudo(dev) attach functions to take (void) (== kernel ctors).
    360  1.17  uebayasi 
    361  1.17  uebayasi   The pseudo attach function was originally designed to take `int n' as
    362  1.17  uebayasi   the number of instances of the pseudo device.  Now most of pseudo
    363  1.17  uebayasi   devices have been converted to be `cloneable', meaning that their
    364  1.17  uebayasi   instances are dynamically allocated at run-time, because guessing how
    365  1.17  uebayasi   much instances are needed for users at compile time is almost impossible.
    366  1.17  uebayasi   Restricting such a pure software resource at compile time is senseless,
    367  1.17  uebayasi   considering that the rest of the world is dynamic.
    368  1.17  uebayasi 
    369  1.17  uebayasi   If pseudo attach functions once become (void), config(1) no longer
    370  1.17  uebayasi   has to generate iteration to call those functions, by making them part
    371  1.17  uebayasi   of kernel constructors, that are a list of (void) functions.
    372  1.17  uebayasi 
    373  1.17  uebayasi   Some pseudo devices may have dependency/ordering problems, because
    374  1.17  uebayasi   pseudo attach functions have no choice when to be called.  This could
    375  1.17  uebayasi   be solved by converting to kctors, where functions are called in order
    376  1.17  uebayasi   by dependency.
    377  1.18  pgoyette 
    378  1.18  pgoyette o Enhance ioconf behavior for pseudo-devices
    379  1.18  pgoyette 
    380  1.18  pgoyette   See "bin/48571: config(1) ioconf is insufficient for pseudo-devices" for
    381  1.18  pgoyette   more details.  In a nutshell, it would be "useful" for config to emit
    382  1.18  pgoyette   the necessary stuff in the generated ioconf.[ch] to enable use of
    383  1.18  pgoyette   config_{init,fini}_component() for attaching and detaching pseudodev's.
    384  1.18  pgoyette 
    385  1.18  pgoyette   Currently, you need to manually construct your own data structures, and
    386  1.18  pgoyette   manually "attach" them, one at a time.  This leads to duplication of
    387  1.18  pgoyette   code (where multiple drivers contain the same basic logic), and doesn't
    388  1.18  pgoyette   necessarily handle all of the "frobbing" of the kernel lists.
    389  1.20  uebayasi 
    390  1.22  uebayasi o Don't use -Ttext ${TEXTADDR}.
    391  1.22  uebayasi 
    392  1.22  uebayasi   Although ld(1)'s `-Ttext ${TEXTADDR}' is an easy way to specify the virtual
    393  1.22  uebayasi   base address of .text at link time, it needs to change command-line; in
    394  1.22  uebayasi   kernel build, Makefile needs to change to reflect kernel's configuration.
    395  1.33    andvar   It is simpler to reflect kernel configuration using linker script via assym.h.
    396  1.22  uebayasi 
    397  1.20  uebayasi o Convert ${DIAGNOSTIC} and ${DEBUG} as flags (defflag).
    398  1.20  uebayasi 
    399  1.20  uebayasi   Probably generate opt_diagnostic.h/opt_debug.h and include them in
    400  1.20  uebayasi   sys/param.h.
    401  1.20  uebayasi 
    402  1.20  uebayasi o Strictly define DIAGNOSTIC.
    403  1.20  uebayasi 
    404  1.20  uebayasi   It is possible to make DIAGNOSTIC kernel and modules binary-compatible with
    405  1.33    andvar   non-DIAGNOSTIC ones.  In that case, debug type information should match
    406  1.20  uebayasi   theoretically (not confirmed).
    407  1.23  uebayasi 
    408  1.25  uebayasi o Use suffix rules.
    409  1.25  uebayasi 
    410  1.25  uebayasi   Build objects following suffix rules.  Source files are defined as relative to
    411  1.25  uebayasi   $S (e.g. sys/kern/init_main.c) and objects are generated in the corresponding
    412  1.25  uebayasi   subdirectories under kernel build directories (e.g.
    413  1.25  uebayasi   .../compile/GENERIC/sys/kern/init_main.o).  Dig subdirectories from within
    414  1.25  uebayasi   config(1).
    415  1.25  uebayasi 
    416  1.25  uebayasi   Debugging (-g) and profiling (-pg) objects could be generated with *.go/*.po
    417  1.25  uebayasi   suffixes as userland libraries do.  Maybe something similar for
    418  1.25  uebayasi   DIAGNOSTIC/DEBUG.
    419  1.25  uebayasi 
    420  1.25  uebayasi   genassym(1) definitions will be split into per-source instead of the single
    421  1.33    andvar   assym.h.  Dependencies are corrected and some of mysterious dependencies on
    422  1.25  uebayasi   `Makefile' in sys/conf/Makefile.kern.inc can go away.
    423  1.25  uebayasi 
    424  1.23  uebayasi o Define genassym(1) symbols per file.
    425  1.23  uebayasi 
    426  1.23  uebayasi   Have each file define symbols that have to be generated by genassym(1) so
    427  1.23  uebayasi   that more accurate dependency is reflected.
    428  1.23  uebayasi 
    429  1.23  uebayasi   For example, if foo.S needs some symbols, it defines them in foo.assym,
    430  1.23  uebayasi   declaring that foo.S depends on foo.assym.h, and includes foo.assym.h.
    431  1.23  uebayasi   foo.assym.h is generated by following the suffix rule of .assym -> .assym.h.
    432  1.23  uebayasi   When one header is updated, only related *.assym.h files are regenerated,
    433  1.23  uebayasi   instead of rebuilding all MD/*.S files that depend on the global, single
    434  1.23  uebayasi   assym.h.
    435  1.27  uebayasi 
    436  1.27  uebayasi o Support library.
    437  1.27  uebayasi 
    438  1.27  uebayasi   Provide a consistent way to build library either as .o or .a.
    439  1.27  uebayasi 
    440  1.30  uebayasi   Build libraries in sub-make.  Don't include library makefiles.  Don't
    441  1.30  uebayasi   pollute search path (.PATH).  libkern does too much.
    442  1.30  uebayasi 
    443  1.27  uebayasi o Accept `.a' suffix.
    444  1.27  uebayasi 
    445  1.27  uebayasi   Make "file" command accept `.a' suffix.  Handle it the same way as `.o'.
    446  1.28  uebayasi 
    447  1.28  uebayasi o Clean up ${MD_OBJS} and friends in Makefile.${MACHINE}.
    448  1.28  uebayasi 
    449  1.28  uebayasi   Don't use ${MD_OBJS}, ${MD_LIBS}, ${MD_SFILES}, and ${MD_CFILES}.
    450  1.28  uebayasi 
    451  1.33    andvar   List files in config(5)'s "file".  Override build rules only when necessary.
    452  1.28  uebayasi 
    453  1.28  uebayasi   Rely on the fact that config(1) parses files.${MACHINE} first, outputs
    454  1.28  uebayasi   files in the order it parses files.* (actually include depth), and
    455  1.28  uebayasi   `Makefile.kern.inc' preserve file order to pass to ${LD}.
    456  1.29  uebayasi 
    457  1.29  uebayasi o Clean up CTF-related rules.
    458  1.29  uebayasi 
    459  1.29  uebayasi   Don't overwrite compile/link rules conditionally by existence of
    460  1.29  uebayasi   ${CTFCONVERT}/${CTFMERGE}.  Give a separate suffix (*.ctfo) and define its
    461  1.29  uebayasi   rules (.c -> .ctfo).
    462  1.31  uebayasi 
    463  1.31  uebayasi o Consider using cpp -MD instead of ${MKDEP}.
    464  1.31  uebayasi 
    465  1.31  uebayasi o Make "make depend" mandatory.
    466  1.31  uebayasi 
    467  1.31  uebayasi   Automatically execute "make depend".
    468