Changes between Version 9 and Version 10 of BuildSystemDev
- Timestamp:
- Dec 18, 2012, 4:20:23 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BuildSystemDev
v9 v10 139 139 Having all modules and features initialized in proper order is challenging in a modular and configurable project like MutekH. 140 140 141 The configuration tool offers a way to specify initialization code ordering constraints and to optionallyassociate them to configuration tokens.141 The configuration tool offers a way to specify initialization code ordering constraints and to associate them to configuration tokens. 142 142 This has several advantages: 143 143 * It allows inserting external modules initialization code in the right place without patching the main tree. 144 144 * It avoids the burdensome work of maintaining initialization function calls and associated `#ifdef` directives. 145 * It ensures initialization function invocations do not get badly reordered to satisfy a new constraint, while ignoring an older constraint .145 * It ensures initialization function invocations do not get badly reordered to satisfy a new constraint, while ignoring an older constraints. 146 146 147 147 Initialization tokens can be declared for that purpose, each specifying a different stage in the MutekH initialization process. 148 These tokens live in a separate name space from configuration tokens and are not exported in the configuration output.148 These tokens live in a separate name space from configuration tokens and are not exported in the configuration header output. 149 149 Instead a set of function prototypes and properly ordered function calls code are written as C macros which can then be invoked at the right place in the kernel code. 150 150 An error will be emitted if constraints can not be satisfied. 151 151 152 The MutekH startup process based on this tool is described in the KernelStartUp page. 153 152 154 === Constraint tags === 153 155 154 156 For each configuration token, one may use the following tags: 155 157 `parent CONFIG_TOKEN`:: 156 When this tag is present, the initialization rules described in the block are ignored if the associated configuration token is undefined. 158 Defines the parent configuration token associated to the initialization token. The initialization is disabled if the associated configuration token is not defined. 159 `condition CONFIG_TOKEN_CONDITION […]`:: 160 This tag can be used to define some conditions which have to be true for the initialization to actually take place. When Multiple condition tag lines are specified, the initialization token is enabled if at least one of lines define a set of conditions which are all true. 157 161 `after INIT_TOKEN`:: 158 162 This tag imposes the requirement that the code from current token be executed '''after''' the code associated with INIT_TOKEN. … … 160 164 This tag imposes the requirement that the code from current token be executed '''before''' the code associated with INIT_TOKEN. 161 165 `during INIT_TOKEN`:: 162 This tag makes the current token inherits from constraints expressed for the given INIT_TOKEN. This t oken must be a place holder token and can not have associated functions.163 `function sinit_function_name cleanup_function_name`::164 This tag associates some initialization and cleanup C function names to the token. The cleanup function is optional. 166 This tag makes the current token inherits from constraints expressed for the given INIT_TOKEN. This tag is used to define a hierarchy between initialization tokens. 167 `function init_function_name cleanup_function_name`:: 168 This tag associates some initialization and cleanup C function names to the token. The cleanup function is optional. When this tag is not present, the token is a place holder token. 165 169 `prototype type arg0, type *arg1`:: 166 This tag sets a list of arguments used in init and cleanup functions prototypes. It must be used on the root place holder tokens so that the prototype is valid for all functions of children tokens. 167 170 This tag sets a list of arguments used as init and cleanup functions prototype. It may be used on place holder tokens so that the prototype is valid for all function provided by inheriting tokens in the hierarchy. 171 `flags calls`:: 172 This flag specifies that C macros with names such as `token_PROTOTYPES`, `token_INIT` and `token_CLEANUP` must be generated. The generated macros contain prototypes and function calls for all enabled inheriting tokens. 173 `flags notempty`:: 174 This flag can be used to prevent an initialization stage to be empty. When this flag is present and the token is enabled, at least one function call must be generated by an other enabled inheriting token in the hierachy. 168 175 === Example === 169 176 … … 171 178 {{{ 172 179 %init INIT_LIBRARIES 180 parent CONFIG_MUTEK 173 181 after INIT_SCHEDULER 174 182 before INIT_APPLICATION 183 flags calls 175 184 %init end 176 185 }}} … … 180 189 during INIT_LIBRARIES 181 190 after INIT_LIBC_STDIO # an explanation why this is needed 182 function sgreat_feature_init great_feature_cleanup191 function great_feature_init great_feature_cleanup 183 192 %init end 184 193 }}} 185 194 186 This will generate the following macros for use in MutekH source code, provided that the CONFIG_FEATURE token is defined inbuild configuration:195 This will generate the following C macros for use in the kernel source code, provided that the CONFIG_FEATURE token is defined in the build configuration: 187 196 188 197 {{{ … … 197 206 great_feature_claenup(__VA_ARGS__); \ 198 207 }}} 208 209 The BuildSystem page describes how to display active intialization tokens for a given configuration along with function calls order and tokens hierarchy. 199 210 200 211 = Source tree `Makefile` syntax and rules =