Changes between Version 26 and Version 27 of BuildSystem
- Timestamp:
- Dec 18, 2012, 12:54:57 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BuildSystem
v26 v27 2 2 = Introduction = 3 3 4 This document describes the MutekH build system invocation and base features and is intended for beginnersand application developers.5 6 The build system takes care of features dependencies, file modifications, ... but is still simple to use for the beginner.4 This page describes the MutekH build system invocation and base features and is intended for MutekH user and application developers. 5 6 The build system is responsible for building MutekH with requested features configuration. 7 7 MutekH source code is highly configurable, this implies the application developer 8 8 has to provide a '''build configuration file''' along with the application source code. 9 9 10 Available features, tweakable values and associated constraints are represented by '''configuration tokens''' 11 and described by kernel developers through '''configuration description files''' (.config) in the source tree. 12 The configuration description syntax is detailed on the BuildSystemDev page which cover more advanced topics. 13 10 Available features, options and associated constraints are represented by '''configuration tokens''' 11 which are declared by kernel developers in '''configuration description files''' (.config) in the kernel source tree. 12 These files define set the set of configuration tokens which can be assigned in a '''build configuration file'''. 13 The configuration description syntax is detailed on the BuildSystemDev page which cover more advanced topics related to kernel developpment. 14 15 This page focus on the build system invocation and the format of the build configuration file. 14 16 Reading the BuildingExamples page may be of some interest too. 15 17 … … 17 19 18 20 == Building == 21 22 Invocation of the build system is performed by running GNU make at the root of the MutekH source tree. 19 23 20 24 When building MutekH, several options may be used to change the behavior of the build system. … … 25 29 }}} 26 30 27 Real build process invocation just need to specify build configuration to use: 28 29 When using a flat build configuration file: 30 {{{ 31 $ make CONF=examples/hello/config_soclib_mipsel 32 }}} 33 34 When using a sectioned build configuration files, you need to specify which sections must be considered for the build: 35 {{{ 36 $ make CONF=examples/hello/config BUILD=soclib-mips32el 37 $ make CONF=examples/hello/config BUILD=soclib-arm:debug 38 }}} 39 40 Depending on the target architecture, the binary output file may be an ELF (.out), a plain binary file (.bin), an intel-hex file (.hex) or an object file (.o). 31 Build process invocation actually require the user to specify a build configuration file to use. 32 33 Using a flat build configuration file which contains the whole kernel configuration, 34 including supported hardware and device drivers definitions, is the most simple way to invoke the build system: 35 {{{ 36 $ make CONF=path/to/config.build 37 }}} 38 39 This however requires the user to write a long build configuration file which is target specific. 40 Relying on a sectioned build configuration files (see below) make this file short and easier to write. 41 We then need to specify which sections of the file must be considered for the build: 42 {{{ 43 $ make CONF=path/to/config.build BUILD=ibmpc-x86 44 $ make CONF=path/to/config.build BUILD=gaisler-leon3 45 $ make CONF=path/to/config.build BUILD=soclib-mips32el:pf-tutorial 46 }}} 41 47 42 48 == Configuration display == 43 49 44 This section explains how to display information about MutekH configuration being used.50 This section explains how to display information about the MutekH configuration being used. 45 51 46 52 You can display a list of relevant tokens with their value for a given configuration: 47 53 {{{ 48 $ make CONF=path/to/config_file listconfig 49 }}} 50 51 You can display a list of '''all''' tokens with their value for a given configuration: 52 {{{ 53 $ make CONF=path/to/config_file listallconfig 54 }}} 55 56 To display help about a specific token: 57 {{{ 58 $ make CONF=path/to/config_file showconfig TOKEN=CONFIG_PTHREAD 59 }}} 54 $ make CONF=path/to/config.build BUILD=... listconfig 55 }}} 56 57 You can display a detailed description of initializations which take place during KernelStartUp; this also depend on the build configuration in use: 58 {{{ 59 $ make CONF=path/to/config.build BUILD=... listinit 60 }}} 61 62 More targets are available, see below. 63 64 == Build log == 65 66 When the compilation process ran successfully, a build log is written to a `.log` file named after the generated kernel file. 67 This file contains various information about the configuration used for the build which can be useful to developpers. 60 68 61 69 = Main variables = … … 72 80 `VERBOSE=1`:: 73 81 Prints all the commands executed 82 `TARGET_EXT=`:: 83 Generate a kernel image in various formats: `out` (elf), `o` (object), `bin` (flat binary), `hex` or `srec`. 74 84 75 85 The following options are useful when building out of the source tree: … … 95 105 96 106 `showpaths`:: 97 This prints the modules that will be built , their paths, …107 This prints the modules that will be built along with associated paths. 98 108 `cflags`:: 99 This prints the flags used for compilation 109 This prints the flags used for compilation. 100 110 101 111 The following targets are available to get help about configuration. 102 112 103 113 `listconfig`:: 104 Prints the current configuration as expanded by MutekH build system. It also prints available --- but currently undefined --- configuration tokens.114 Prints values of configuration tokens which would be used to build MutekH according to current build configuration. 105 115 `listallconfig`:: 106 Prints all the configuration tokens, even the ones incompatible with the current configuration. 107 `showconfig`:: 108 This prints detailed information about a given configuration token. Token must be specified with `TOKEN=` variable argument. 116 Prints all the configuration tokens, including internal tokens and tokens with undefined parents. 117 `listflatconfig`:: 118 Prints the content of a minimal flat configuration file which could be used to define current configuration. 119 `listinit`:: 120 Prints initialization tokens and initilization function calls which will take place during KernelStartUp according to current build configuration. 109 121 110 122 See usage below. … … 114 126 == Content == 115 127 116 MutekH build configuration files contain token values pairs defining the kernel we are currently building. Theymust contain:128 The MutekH build configuration file defines token values describing feature included in the kernel which is being built. It must contain: 117 129 118 130 * the license for the application, enforcing license compatibility between some kernel parts and your code, 119 131 * the target architecture 120 * the libraries used, and their configurations121 * the useddrivers132 * libraries to build, and related options 133 * device drivers 122 134 * some global compilation switches (optimization, debugging, …) 123 135 * ... … … 127 139 Syntax is `token` '''space''' `value`. Tokens begin with `CONFIG_`. Value may be omitted thus defaults to `defined`. e.g. 128 140 {{{ 141 ... 142 129 143 CONFIG_LICENSE_APP_LGPL 130 144 … … 147 161 }}} 148 162 149 Most common values are `defined` and `undefined` to enable and disables features, but some tokens may need numerical or string values. 150 151 The easiest way to write a configuration file is to rely on and include common sectioned configuration files and 152 just write the minimal application related configuration yourself. See below. 153 154 Have a look to [source:hg/examples/hello] for examples of working build configuration files. 163 Most common values are `defined` and `undefined` to enable and disables features, but some tokens may take numerical or string values. 164 165 The easiest way to describe your configuration is to rely on sectioned '''build configuration files''' which are provided in the kernel source tree. 166 These files are split in multiple sections which are conditionnaly parsed depending on the value of the `BUILD` variable passed to the build system. 167 168 They provide default configurations for supported processors and platforms so that you just have to write a minimal file which take care of enabling 169 modules and features which are needed by your application. This way, all configuration token related to target hardware will get their value from those files. 170 This do not prevent the user to override a token value after inclusion of one of those files. 171 The user can also define its own sections on its build configuration, see syntax at the end of this page. 172 173 {{{ 174 ... 175 176 CONFIG_LICENSE_APP_LGPL 177 178 CONFIG_PTHREAD 179 180 %include platforms.build 181 182 CONFIG_CPU_MAXCOUNT 4 183 }}} 184 185 Have a look to [source:hg/examples/hello] for examples of real build configuration files. 155 186 156 187 The [http://www.mutekh.org/www/mutekh_api/ MutekH API reference manual] describes all available configuration tokens. … … 160 191 MutekH has a modular and component-based architecture. 161 192 162 A build configuration file m aydeclare a new module for the application.193 A build configuration file must declare a new module for the application. 163 194 Modules can be located anywhere outside of the main source tree. 164 We must tell the build system the directory where the configuration lies.195 We must tell the build system the directory where the configuration file is located. 165 196 The path to the module directory is usually the same as its configuration file and the `CONFIGPATH` special variable is well suited: 166 197 {{{ … … 180 211 == Advanced syntax == 181 212 182 Basic configuration is really simple. Complex applications or multiple target architectures require 213 As explained previoudly, basic build configuration format is simple. 214 Complex applications or support for multiple target architectures require 183 215 maintaining multiple configuration files which can be difficult and annoying. 184 The directives presented here are used to make things easier. They are mainly used in common build configuration files found in [source:hg/examples/build].216 The directives presented here can be used to define conditional sections in build configuration files. 185 217 186 218 Sectioning directives are useful to consider a set of configuration definitions depending on the `BUILD` variable of `make` invocation: … … 229 261 The `default` section name is in use when no section name is passed through the `BUILD` variable. 230 262 231 Some build configuration files are available in [source:examples/common] and can be included to 232 target common platforms without having to deals with all configuration token. This helps keeping application 233 configuration file short. Configuration tokens can be redefined multiple times, 234 allowing to override values set in included files. 235 263 Some build configuration files are provided in the kernel source tree and can be included to 264 target hardware platforms without having to deals with all related configuration token. 265 Configuration tokens can be assigned multiple times, this allows overriding values previously assigned in included files. 266