TODO revision 1.5
11.5Suebayasio Call module as module. 21.5Suebayasi 31.5Suebayasi Until now, everything is called as attribute. Separate module from it: 41.5Suebayasi 51.5Suebayasi - Module is a collection of code (*.[cSo]), and provides a function. 61.5Suebayasi Module can depend on other modules. 71.5Suebayasi 81.5Suebayasi - Attribute provides metadata for modules. One module can have 91.5Suebayasi multiple attributes. Attribute doesn't generate a module (*.o, 101.5Suebayasi *.ko). 111.5Suebayasi 121.1Suebayasio Emit everything (ioconf.*, Makefile, ...) per-attribute. 131.1Suebayasi 141.1Suebayasio Generate modular(9) related information. Especially module dependency. 151.1Suebayasi 161.1Suebayasio Rename "interface attribute" to "bus". 171.1Suebayasi 181.1Suebayasi Instead of 191.1Suebayasi 201.1Suebayasi define audiobus {} 211.1Suebayasi attach audio at audiobus 221.1Suebayasi 231.1Suebayasi Do like this 241.1Suebayasi 251.1Suebayasi defbus audiobus {} 261.1Suebayasi attach audio at audiobus 271.1Suebayasi 281.1Suebayasio Sort objects in more reasonable order. 291.1Suebayasi 301.1Suebayasi Put machdep.ko in the lowest address. uvm.ko and kern.ko follow. 311.1Suebayasi 321.1Suebayasi Kill alphabetical sort (${OBJS:O} in sys/conf/Makefile.inc.kern. 331.1Suebayasi 341.1Suebayasi Use ldscript. Do like this 351.1Suebayasi 361.1Suebayasi .text : 371.1Suebayasi AT (ADDR(.text) & 0x0fffffff) 381.1Suebayasi { 391.1Suebayasi *(.text.machdep.locore.entry) 401.1Suebayasi *(.text.machdep.locore) 411.1Suebayasi *(.text.machdep) 421.1Suebayasi *(.text) 431.1Suebayasi *(.text.*) 441.1Suebayasi : 451.1Suebayasi 461.1Suebayasi Kill linker definitions in sys/conf/Makefile.inc.kern. 471.2Suebayasi 481.3Swizo Differentiate "options" and "flags"/"params". 491.2Suebayasi 501.3Swiz "options" enables features by adding *.c files (via attributes). 511.2Suebayasi 521.2Suebayasi "flags" and "params" are to change contents of *.c files. These don't add 531.3Swiz *.c files to the result kernel, or don't build attributes (modules). 541.2Suebayasi 551.2Suebayasio Make flags/params per attributes (modules). 561.2Suebayasi 571.2Suebayasi Basically flags and params are cpp(1) #define's generated in opt_*.h. Make 581.2Suebayasi them local to one attributes (modules). Flags/params which affects files 591.2Suebayasi across attributes (modules) are possible, but should be discouraged. 601.2Suebayasi 611.2Suebayasio Generate things only by definitions. 621.2Suebayasi 631.2Suebayasi In the ideal dynamically modular world, "selection" will be done not at 641.2Suebayasi compile time but at runtime. Users select their wanted modules, by 651.2Suebayasi dynamically loading them. 661.2Suebayasi 671.2Suebayasi This means that the system provides all choices; that is, build all modules 681.2Suebayasi in the source tree. Necessary information is defined in the "definition" 691.2Suebayasi part. 701.2Suebayasi 711.2Suebayasio Split cfdata. 721.2Suebayasi 731.2Suebayasi cfdata is pattern matching rules to enable devices at runtime device 741.3Swiz auto-configuration. It is pure data and can (should) be generated separately 751.2Suebayasi from the code. 761.4Sapb 771.4Sapbo Allow easier adding and removing of options. 781.4Sapb 791.4Sapb It should be possible to add or remove options, flags, etc., 801.4Sapb without regard to whether or not they are already defined. 811.4Sapb For example, a configuration like this: 821.4Sapb 831.4Sapb include GENERIC 841.4Sapb options FOO 851.4Sapb no options BAR 861.4Sapb 871.4Sapb should work regardless of whether or not options FOO and/or 881.4Sapb options BAR were defined in GENERIC. It should not give 891.4Sapb errors like "options BAR was already defined" or "options FOO 901.4Sapb was not defined". 911.4Sapb 921.5Suebayasio Introduce "class". 931.5Suebayasi 941.5Suebayasi Every module should be classfied as at least one class, as modular(9) 951.5Suebayasi modules already do. For example, filesystems are marked as "vfs", network 961.5Suebayasi protocols are "netproto". 971.5Suebayasi 981.5Suebayasi Consider to merge "devclass" into "class". 991.5Suebayasi 1001.5Suebayasi For syntax clarity, class names could be used as a keyword to select the 1011.5Suebayasi class's instance module: 1021.5Suebayasi 1031.5Suebayasi # Define net80211 module as netproto class 1041.5Suebayasi class netproto 1051.5Suebayasi define net80211: netproto 1061.5Suebayasi 1071.5Suebayasi # Select net80211 to be builtin 1081.5Suebayasi netproto net80211 1091.5Suebayasi 1101.5Suebayasi Accordingly device/attach selection syntax should be revisited. 1111.5Suebayasi 1121.5Suebayasio Support kernel constructor/destructor (.ctors/.dtors) 1131.5Suebayasi 1141.5Suebayasi Initialization and finalization should be called via constructors and 1151.5Suebayasi destructors. Don't hardcode those sequences as sys/kern/init_main.c:main() 1161.5Suebayasi does. 1171.5Suebayasi 1181.5Suebayasi The order of .ctors/.dtors is resolved by dependency. The difference from 1191.5Suebayasi userland is that in kernel depended ones are located in lower addresses; 1201.5Suebayasi "machdep" module is the lowest. Thus the lowest entry in .ctors must be 1211.5Suebayasi executed the first. 1221.5Suebayasi 1231.5Suebayasio Replace linkset. 1241.5Suebayasi 1251.5Suebayasi Don't allow kernel subsystems create random ELF sections (with potentially 1261.5Suebayasi long names) in the final kernel. To collect some data in statically linked 1271.5Suebayasi modules, creating intermediate sections (e.g. .data.linkset.sysctl) and 1281.5Suebayasi exporting the start/end symbols (e.g. _data_linkset_sysctl_{start,end}) 1291.5Suebayasi using linker script should be fine. 1301.5Suebayasi 1311.5Suebayasi Dynamically loaded modules have to register those entries via constructors 1321.5Suebayasi (functions). This means that dynamically loaded modules are flexible but 1331.5Suebayasi come with overhead. 134