diff options
author | Scott Rifenbark <srifenbark@gmail.com> | 2018-05-16 15:07:08 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-05-24 17:16:35 +0100 |
commit | 9a37a3d568a04319cece45edfa04e787e06c4399 (patch) | |
tree | 8b5ba82adfcaf99d242f0e7ed6b04b56f41cdfc5 /documentation/dev-manual | |
parent | bd4438f4a4c945458fa9e373d0fe51886af8f49c (diff) | |
download | poky-9a37a3d568a04319cece45edfa04e787e06c4399.tar.gz |
dev-manual: Moved "Speeding Up the Build" and renamed it.
Renamed to "Speeding Up a Build" and moved out of the setting up
chapter to the common tasks chapter. Fixed a couple links in the
ref-manual.
(From yocto-docs rev: c53fddd353230c8ef1abc21c7a2d2b1f492f034a)
Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual')
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 161 | ||||
-rw-r--r-- | documentation/dev-manual/dev-manual-start.xml | 160 |
2 files changed, 158 insertions, 163 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index d4b99bc69f..9e8dd5fa92 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
@@ -6224,11 +6224,166 @@ | |||
6224 | 6224 | ||
6225 | 6225 | ||
6226 | 6226 | ||
6227 | <section id='speeding-up-a-build'> | ||
6228 | <title>Speeding Up a Build</title> | ||
6227 | 6229 | ||
6230 | <para> | ||
6231 | Build time can be an issue. | ||
6232 | By default, the build system uses simple controls to try and maximize | ||
6233 | build efficiency. | ||
6234 | In general, the default settings for all the following variables | ||
6235 | result in the most efficient build times when dealing with single | ||
6236 | socket systems (i.e. a single CPU). | ||
6237 | If you have multiple CPUs, you might try increasing the default | ||
6238 | values to gain more speed. | ||
6239 | See the descriptions in the glossary for each variable for more | ||
6240 | information: | ||
6241 | <itemizedlist> | ||
6242 | <listitem><para> | ||
6243 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename>:</ulink> | ||
6244 | The maximum number of threads BitBake simultaneously executes. | ||
6245 | </para></listitem> | ||
6246 | <listitem><para> | ||
6247 | <ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename>:</ulink> | ||
6248 | The number of threads BitBake uses during parsing. | ||
6249 | </para></listitem> | ||
6250 | <listitem><para> | ||
6251 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename>:</ulink> | ||
6252 | Extra options passed to the <filename>make</filename> command | ||
6253 | during the | ||
6254 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-compile'><filename>do_compile</filename></ulink> | ||
6255 | task in order to specify parallel compilation on the | ||
6256 | local build host. | ||
6257 | </para></listitem> | ||
6258 | <listitem><para> | ||
6259 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKEINST'><filename>PARALLEL_MAKEINST</filename>:</ulink> | ||
6260 | Extra options passed to the <filename>make</filename> command | ||
6261 | during the | ||
6262 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> | ||
6263 | task in order to specify parallel installation on the | ||
6264 | local build host. | ||
6265 | </para></listitem> | ||
6266 | </itemizedlist> | ||
6267 | As mentioned, these variables all scale to the number of processor | ||
6268 | cores available on the build system. | ||
6269 | For single socket systems, this auto-scaling ensures that the build | ||
6270 | system fundamentally takes advantage of potential parallel operations | ||
6271 | during the build based on the build machine's capabilities. | ||
6272 | </para> | ||
6228 | 6273 | ||
6229 | 6274 | <para> | |
6230 | 6275 | Following are additional factors that can affect build speed: | |
6231 | 6276 | <itemizedlist> | |
6277 | <listitem><para> | ||
6278 | File system type: | ||
6279 | The file system type that the build is being performed on can | ||
6280 | also influence performance. | ||
6281 | Using <filename>ext4</filename> is recommended as compared | ||
6282 | to <filename>ext2</filename> and <filename>ext3</filename> | ||
6283 | due to <filename>ext4</filename> improved features | ||
6284 | such as extents. | ||
6285 | </para></listitem> | ||
6286 | <listitem><para> | ||
6287 | Disabling the updating of access time using | ||
6288 | <filename>noatime</filename>: | ||
6289 | The <filename>noatime</filename> mount option prevents the | ||
6290 | build system from updating file and directory access times. | ||
6291 | </para></listitem> | ||
6292 | <listitem><para> | ||
6293 | Setting a longer commit: | ||
6294 | Using the "commit=" mount option increases the interval | ||
6295 | in seconds between disk cache writes. | ||
6296 | Changing this interval from the five second default to | ||
6297 | something longer increases the risk of data loss but decreases | ||
6298 | the need to write to the disk, thus increasing the build | ||
6299 | performance. | ||
6300 | </para></listitem> | ||
6301 | <listitem><para> | ||
6302 | Choosing the packaging backend: | ||
6303 | Of the available packaging backends, IPK is the fastest. | ||
6304 | Additionally, selecting a singular packaging backend also | ||
6305 | helps. | ||
6306 | </para></listitem> | ||
6307 | <listitem><para> | ||
6308 | Using <filename>tmpfs</filename> for | ||
6309 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
6310 | as a temporary file system: | ||
6311 | While this can help speed up the build, the benefits are | ||
6312 | limited due to the compiler using | ||
6313 | <filename>-pipe</filename>. | ||
6314 | The build system goes to some lengths to avoid | ||
6315 | <filename>sync()</filename> calls into the | ||
6316 | file system on the principle that if there was a significant | ||
6317 | failure, the | ||
6318 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> | ||
6319 | contents could easily be rebuilt. | ||
6320 | </para></listitem> | ||
6321 | <listitem><para> | ||
6322 | Inheriting the | ||
6323 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-rm-work'><filename>rm_work</filename></ulink> | ||
6324 | class: | ||
6325 | Inheriting this class has shown to speed up builds due to | ||
6326 | significantly lower amounts of data stored in the data | ||
6327 | cache as well as on disk. | ||
6328 | Inheriting this class also makes cleanup of | ||
6329 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
6330 | faster, at the expense of being easily able to dive into the | ||
6331 | source code. | ||
6332 | File system maintainers have recommended that the fastest way | ||
6333 | to clean up large numbers of files is to reformat partitions | ||
6334 | rather than delete files due to the linear nature of | ||
6335 | partitions. | ||
6336 | This, of course, assumes you structure the disk partitions and | ||
6337 | file systems in a way that this is practical. | ||
6338 | </para></listitem> | ||
6339 | </itemizedlist> | ||
6340 | Aside from the previous list, you should keep some trade offs in | ||
6341 | mind that can help you speed up the build: | ||
6342 | <itemizedlist> | ||
6343 | <listitem><para> | ||
6344 | Remove items from | ||
6345 | <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_FEATURES'><filename>DISTRO_FEATURES</filename></ulink> | ||
6346 | that you might not need. | ||
6347 | </para></listitem> | ||
6348 | <listitem><para> | ||
6349 | Exclude debug symbols and other debug information: | ||
6350 | If you do not need these symbols and other debug information, | ||
6351 | disabling the <filename>*-dbg</filename> package generation | ||
6352 | can speed up the build. | ||
6353 | You can disable this generation by setting the | ||
6354 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INHIBIT_PACKAGE_DEBUG_SPLIT'><filename>INHIBIT_PACKAGE_DEBUG_SPLIT</filename></ulink> | ||
6355 | variable to "1". | ||
6356 | </para></listitem> | ||
6357 | <listitem><para> | ||
6358 | Disable static library generation for recipes derived from | ||
6359 | <filename>autoconf</filename> or <filename>libtool</filename>: | ||
6360 | Following is an example showing how to disable static | ||
6361 | libraries and still provide an override to handle exceptions: | ||
6362 | <literallayout class='monospaced'> | ||
6363 | STATICLIBCONF = "--disable-static" | ||
6364 | STATICLIBCONF_sqlite3-native = "" | ||
6365 | EXTRA_OECONF += "${STATICLIBCONF}" | ||
6366 | </literallayout> | ||
6367 | <note><title>Notes</title> | ||
6368 | <itemizedlist> | ||
6369 | <listitem><para> | ||
6370 | Some recipes need static libraries in order to work | ||
6371 | correctly (e.g. <filename>pseudo-native</filename> | ||
6372 | needs <filename>sqlite3-native</filename>). | ||
6373 | Overrides, as in the previous example, account for | ||
6374 | these kinds of exceptions. | ||
6375 | </para></listitem> | ||
6376 | <listitem><para> | ||
6377 | Some packages have packaging code that assumes the | ||
6378 | presence of the static libraries. | ||
6379 | If so, you might need to exclude them as well. | ||
6380 | </para></listitem> | ||
6381 | </itemizedlist> | ||
6382 | </note> | ||
6383 | </para></listitem> | ||
6384 | </itemizedlist> | ||
6385 | </para> | ||
6386 | </section> | ||
6232 | 6387 | ||
6233 | <section id="platdev-working-with-libraries"> | 6388 | <section id="platdev-working-with-libraries"> |
6234 | <title>Working With Libraries</title> | 6389 | <title>Working With Libraries</title> |
diff --git a/documentation/dev-manual/dev-manual-start.xml b/documentation/dev-manual/dev-manual-start.xml index 201cbe7340..d8726b4857 100644 --- a/documentation/dev-manual/dev-manual-start.xml +++ b/documentation/dev-manual/dev-manual-start.xml | |||
@@ -1080,166 +1080,6 @@ | |||
1080 | </section> | 1080 | </section> |
1081 | </section> | 1081 | </section> |
1082 | 1082 | ||
1083 | <section id='speeding-up-the-build'> | ||
1084 | <title>Speeding Up the Build</title> | ||
1085 | |||
1086 | <para> | ||
1087 | Build time can be an issue. | ||
1088 | By default, the build system uses simple controls to try and maximize | ||
1089 | build efficiency. | ||
1090 | In general, the default settings for all the following variables | ||
1091 | result in the most efficient build times when dealing with single | ||
1092 | socket systems (i.e. a single CPU). | ||
1093 | If you have multiple CPUs, you might try increasing the default | ||
1094 | values to gain more speed. | ||
1095 | See the descriptions in the glossary for each variable for more | ||
1096 | information: | ||
1097 | <itemizedlist> | ||
1098 | <listitem><para> | ||
1099 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename>:</ulink> | ||
1100 | The maximum number of threads BitBake simultaneously executes. | ||
1101 | </para></listitem> | ||
1102 | <listitem><para> | ||
1103 | <ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename>:</ulink> | ||
1104 | The number of threads BitBake uses during parsing. | ||
1105 | </para></listitem> | ||
1106 | <listitem><para> | ||
1107 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename>:</ulink> | ||
1108 | Extra options passed to the <filename>make</filename> command | ||
1109 | during the | ||
1110 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-compile'><filename>do_compile</filename></ulink> | ||
1111 | task in order to specify parallel compilation on the | ||
1112 | local build host. | ||
1113 | </para></listitem> | ||
1114 | <listitem><para> | ||
1115 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKEINST'><filename>PARALLEL_MAKEINST</filename>:</ulink> | ||
1116 | Extra options passed to the <filename>make</filename> command | ||
1117 | during the | ||
1118 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> | ||
1119 | task in order to specify parallel installation on the | ||
1120 | local build host. | ||
1121 | </para></listitem> | ||
1122 | </itemizedlist> | ||
1123 | As mentioned, these variables all scale to the number of processor | ||
1124 | cores available on the build system. | ||
1125 | For single socket systems, this auto-scaling ensures that the build | ||
1126 | system fundamentally takes advantage of potential parallel operations | ||
1127 | during the build based on the build machine's capabilities. | ||
1128 | </para> | ||
1129 | |||
1130 | <para> | ||
1131 | Following are additional factors that can affect build speed: | ||
1132 | <itemizedlist> | ||
1133 | <listitem><para> | ||
1134 | File system type: | ||
1135 | The file system type that the build is being performed on can | ||
1136 | also influence performance. | ||
1137 | Using <filename>ext4</filename> is recommended as compared | ||
1138 | to <filename>ext2</filename> and <filename>ext3</filename> | ||
1139 | due to <filename>ext4</filename> improved features | ||
1140 | such as extents. | ||
1141 | </para></listitem> | ||
1142 | <listitem><para> | ||
1143 | Disabling the updating of access time using | ||
1144 | <filename>noatime</filename>: | ||
1145 | The <filename>noatime</filename> mount option prevents the | ||
1146 | build system from updating file and directory access times. | ||
1147 | </para></listitem> | ||
1148 | <listitem><para> | ||
1149 | Setting a longer commit: | ||
1150 | Using the "commit=" mount option increases the interval | ||
1151 | in seconds between disk cache writes. | ||
1152 | Changing this interval from the five second default to | ||
1153 | something longer increases the risk of data loss but decreases | ||
1154 | the need to write to the disk, thus increasing the build | ||
1155 | performance. | ||
1156 | </para></listitem> | ||
1157 | <listitem><para> | ||
1158 | Choosing the packaging backend: | ||
1159 | Of the available packaging backends, IPK is the fastest. | ||
1160 | Additionally, selecting a singular packaging backend also | ||
1161 | helps. | ||
1162 | </para></listitem> | ||
1163 | <listitem><para> | ||
1164 | Using <filename>tmpfs</filename> for | ||
1165 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
1166 | as a temporary file system: | ||
1167 | While this can help speed up the build, the benefits are | ||
1168 | limited due to the compiler using | ||
1169 | <filename>-pipe</filename>. | ||
1170 | The build system goes to some lengths to avoid | ||
1171 | <filename>sync()</filename> calls into the | ||
1172 | file system on the principle that if there was a significant | ||
1173 | failure, the | ||
1174 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> | ||
1175 | contents could easily be rebuilt. | ||
1176 | </para></listitem> | ||
1177 | <listitem><para> | ||
1178 | Inheriting the | ||
1179 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-rm-work'><filename>rm_work</filename></ulink> | ||
1180 | class: | ||
1181 | Inheriting this class has shown to speed up builds due to | ||
1182 | significantly lower amounts of data stored in the data | ||
1183 | cache as well as on disk. | ||
1184 | Inheriting this class also makes cleanup of | ||
1185 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
1186 | faster, at the expense of being easily able to dive into the | ||
1187 | source code. | ||
1188 | File system maintainers have recommended that the fastest way | ||
1189 | to clean up large numbers of files is to reformat partitions | ||
1190 | rather than delete files due to the linear nature of | ||
1191 | partitions. | ||
1192 | This, of course, assumes you structure the disk partitions and | ||
1193 | file systems in a way that this is practical. | ||
1194 | </para></listitem> | ||
1195 | </itemizedlist> | ||
1196 | Aside from the previous list, you should keep some trade offs in | ||
1197 | mind that can help you speed up the build: | ||
1198 | <itemizedlist> | ||
1199 | <listitem><para> | ||
1200 | Remove items from | ||
1201 | <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_FEATURES'><filename>DISTRO_FEATURES</filename></ulink> | ||
1202 | that you might not need. | ||
1203 | </para></listitem> | ||
1204 | <listitem><para> | ||
1205 | Exclude debug symbols and other debug information: | ||
1206 | If you do not need these symbols and other debug information, | ||
1207 | disabling the <filename>*-dbg</filename> package generation | ||
1208 | can speed up the build. | ||
1209 | You can disable this generation by setting the | ||
1210 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INHIBIT_PACKAGE_DEBUG_SPLIT'><filename>INHIBIT_PACKAGE_DEBUG_SPLIT</filename></ulink> | ||
1211 | variable to "1". | ||
1212 | </para></listitem> | ||
1213 | <listitem><para> | ||
1214 | Disable static library generation for recipes derived from | ||
1215 | <filename>autoconf</filename> or <filename>libtool</filename>: | ||
1216 | Following is an example showing how to disable static | ||
1217 | libraries and still provide an override to handle exceptions: | ||
1218 | <literallayout class='monospaced'> | ||
1219 | STATICLIBCONF = "--disable-static" | ||
1220 | STATICLIBCONF_sqlite3-native = "" | ||
1221 | EXTRA_OECONF += "${STATICLIBCONF}" | ||
1222 | </literallayout> | ||
1223 | <note><title>Notes</title> | ||
1224 | <itemizedlist> | ||
1225 | <listitem><para> | ||
1226 | Some recipes need static libraries in order to work | ||
1227 | correctly (e.g. <filename>pseudo-native</filename> | ||
1228 | needs <filename>sqlite3-native</filename>). | ||
1229 | Overrides, as in the previous example, account for | ||
1230 | these kinds of exceptions. | ||
1231 | </para></listitem> | ||
1232 | <listitem><para> | ||
1233 | Some packages have packaging code that assumes the | ||
1234 | presence of the static libraries. | ||
1235 | If so, you might need to exclude them as well. | ||
1236 | </para></listitem> | ||
1237 | </itemizedlist> | ||
1238 | </note> | ||
1239 | </para></listitem> | ||
1240 | </itemizedlist> | ||
1241 | </para> | ||
1242 | </section> | ||
1243 | </chapter> | 1083 | </chapter> |
1244 | <!-- | 1084 | <!-- |
1245 | vim: expandtab tw=80 ts=4 | 1085 | vim: expandtab tw=80 ts=4 |