blob: 4851a645602627ebf8de5b0e94676b3a6f3d662a [file] [log] [blame]
Simon Glass74df4912022-11-09 19:14:43 -07001.. SPDX-License-Identifier: GPL-2.0+
2
3Buildman build tool
4===================
5
Simon Glass74df4912022-11-09 19:14:43 -07006Quick-start
7-----------
8
9If you just want to quickly set up buildman so you can build something (for
10example Raspberry Pi 2):
11
12.. code-block:: bash
13
14 cd /path/to/u-boot
15 PATH=$PATH:`pwd`/tools/buildman
16 buildman --fetch-arch arm
17 buildman -k rpi_2
18 ls ../current/rpi_2
19 # u-boot.bin is the output image
20
21
22What is this?
23-------------
24
25This tool handles building U-Boot to check that you have not broken it
26with your patch series. It can build each individual commit and report
27which boards fail on which commits, and which errors come up. It aims
28to make full use of multi-processor machines.
29
30A key feature of buildman is its output summary, which allows warnings,
31errors or image size increases in a particular commit or board to be
32quickly identified and the offending commit pinpointed. This can be a big
33help for anyone working with >10 patches at a time.
34
35
36Caveats
37-------
38
39Buildman can be stopped and restarted, in which case it will continue
40where it left off. This should happen cleanly and without side-effects.
41If not, it is a bug, for which a patch would be welcome.
42
43Buildman gets so tied up in its work that it can ignore the outside world.
44You may need to press Ctrl-C several times to quit it. Also it will print
45out various exceptions when stopped. You may have to kill it since the
46Ctrl-C handling is somewhat broken.
47
48
49Theory of Operation
50-------------------
51
52(please read this section in full twice or you will be perpetually confused)
53
54Buildman is a builder. It is not make, although it runs make. It does not
55produce any useful output on the terminal while building, except for
56progress information (but see -v below). All the output (errors, warnings and
57binaries if you ask for them) is stored in output directories, which you can
58look at from a separate 'buildman -s' instance while the build is progressing,
59or when it is finished.
60
61Buildman is designed to build entire git branches, i.e. muliple commits. It
62can be run repeatedly on the same branch after making changes to commits on
63that branch. In this case it will automatically rebuild commits which have
64changed (and remove its old results for that commit). It is possible to build
65a branch for one board, then later build it for another board. This adds to
66the output, so now you have results for two boards. If you want buildman to
67re-build a commit it has already built (e.g. because of a toolchain update),
68use the -f flag.
69
70Buildman produces a concise summary of which boards succeeded and failed.
71It shows which commit introduced which board failure using a simple
72red/green colour coding (with yellow/cyan for warnings). Full error
73information can be requested, in which case it is de-duped and displayed
74against the commit that introduced the error. An example workflow is below.
75
76Buildman stores image size information and can report changes in image size
77from commit to commit. An example of this is below.
78
79Buildman starts multiple threads, and each thread builds for one board at
80a time. A thread starts at the first commit, configures the source for your
81board and builds it. Then it checks out the next commit and does an
82incremental build (i.e. not using 'make xxx_defconfig' unless you use -C).
83Eventually the thread reaches the last commit and stops. If a commit causes
84an error or warning, buildman will try it again after reconfiguring (but see
85-Q). Thus some commits may be built twice, with the first result silently
86discarded. Lots of errors and warnings will causes lots of reconfigures and your
87build will be very slow. This is because a file that produces just a warning
88would not normally be rebuilt in an incremental build. Once a thread finishes
89building all the commits for a board, it starts on the commits for another
90board.
91
92Buildman works in an entirely separate place from your U-Boot repository.
93It creates a separate working directory for each thread, and puts the
94output files in the working directory, organised by commit name and board
95name, in a two-level hierarchy (but see -P).
96
97Buildman is invoked in your U-Boot directory, the one with the .git
98directory. It clones this repository into a copy for each thread, and the
99threads do not affect the state of your git repository. Any checkouts done
100by the thread affect only the working directory for that thread.
101
102Buildman automatically selects the correct tool chain for each board. You
103must supply suitable tool chains (see --fetch-arch), but buildman takes care
104of selecting the right one.
105
106Buildman generally builds a branch (with the -b flag), and in this case
107builds the upstream commit as well, for comparison. So even if you have one
108commit in your branch, two commits will be built. Put all your commits in a
109branch, set the branch's upstream to a valid value, and all will be well.
110Otherwise buildman will perform random actions. Use -n to check what the
111random actions might be.
112
113Buildman effectively has two modes: without -s it builds, with -s it
114summarises the results of previous (or active) builds.
115
116If you just want to build the current source tree, leave off the -b flag.
117This will display results and errors as they happen. You can still look at
118them later using -se. Note that buildman will assume that the source has
119changed, and will build all specified boards in this case.
120
121Buildman is optimised for building many commits at once, for many boards.
122On multi-core machines, Buildman is fast because it uses most of the
123available CPU power. When it gets to the end, or if you are building just
124a few commits or boards, it will be pretty slow. As a tip, if you don't
125plan to use your machine for anything else, you can use -T to increase the
126number of threads beyond the default.
127
128
129Selecting which boards to build
130-------------------------------
131
132Buildman lets you build all boards, or a subset. Specify the subset by passing
133command-line arguments that list the desired build target, architecture,
134CPU, board name, vendor, SoC or options. Multiple arguments are allowed. Each
135argument will be interpreted as a regular expression, so behaviour is a superset
136of exact or substring matching. Examples are:
137
138- 'tegra20' - all boards with a Tegra20 SoC
139- 'tegra' - all boards with any Tegra Soc (Tegra20, Tegra30, Tegra114...)
140- '^tegra[23]0$' - all boards with either Tegra20 or Tegra30 SoC
141- 'powerpc' - all PowerPC boards
142
143While the default is to OR the terms together, you can also make use of
144the '&' operator to limit the selection:
145
146- 'freescale & arm sandbox' - all Freescale boards with ARM architecture, plus
147 sandbox
148
149You can also use -x to specifically exclude some boards. For example:
150
151 buildman arm -x nvidia,freescale,.*ball$
152
153means to build all arm boards except nvidia, freescale and anything ending
154with 'ball'.
155
156For building specific boards you can use the --boards (or --bo) option, which
157takes a comma-separated list of board target names and be used multiple times
158on the command line:
159
160.. code-block:: bash
161
162 buildman --boards sandbox,snow --boards
163
164It is convenient to use the -n option to see what will be built based on
165the subset given. Use -v as well to get an actual list of boards.
166
167Buildman does not store intermediate object files. It optionally copies
168the binary output into a directory when a build is successful (-k). Size
169information is always recorded. It needs a fair bit of disk space to work,
170typically 250MB per thread.
171
172
173Setting up
174----------
175
176#. Get the U-Boot source. You probably already have it, but if not these
177 steps should get you started with a repo and some commits for testing.
178
179 .. code-block:: bash
180
181 cd /path/to/u-boot
182 git clone git://git.denx.de/u-boot.git .
183 git checkout -b my-branch origin/master
184 # Add some commits to the branch, reading for testing
185
186#. Create ~/.buildman to tell buildman where to find tool chains (see
187 buildman_settings_ for details). As an example::
188
189 # Buildman settings file
190
191 [toolchain]
192 root: /
193 rest: /toolchains/*
194 eldk: /opt/eldk-4.2
195 arm: /opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux
196 aarch64: /opt/linaro/gcc-linaro-aarch64-none-elf-4.8-2013.10_linux
197
Simon Glassce592522022-11-09 19:14:45 -0700198 [toolchain-prefix]
199 arc = /opt/arc/arc_gnu_2021.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-
200
Simon Glass74df4912022-11-09 19:14:43 -0700201 [toolchain-alias]
Simon Glass3da04ff2022-11-09 19:14:46 -0700202 riscv = riscv32
203 sh = sh4
Simon Glass74df4912022-11-09 19:14:43 -0700204 x86: i386
205 blackfin: bfin
206 openrisc: or1k
207
208
209 This selects the available toolchain paths. Add the base directory for
210 each of your toolchains here. Buildman will search inside these directories
211 and also in any '/usr' and '/usr/bin' subdirectories.
212
213 Make sure the tags (here root: rest: and eldk:) are unique.
214
215 The toolchain-alias section indicates that the i386 toolchain should be used
216 to build x86 commits.
217
218 Note that you can also specific exactly toolchain prefixes if you like::
219
220 [toolchain-prefix]
221 arm: /opt/arm-eabi-4.6/bin/arm-eabi-
222
223 or even::
224
225 [toolchain-prefix]
226 arm: /opt/arm-eabi-4.6/bin/arm-eabi-gcc
227
228 This tells buildman that you want to use this exact toolchain for the arm
229 architecture. This will override any toolchains found by searching using the
230 [toolchain] settings.
231
232 Since the toolchain prefix is an explicit request, buildman will report an
233 error if a toolchain is not found with that prefix. The current PATH will be
234 searched, so it is possible to use::
235
236 [toolchain-prefix]
237 arm: arm-none-eabi-
238
239 and buildman will find arm-none-eabi-gcc in /usr/bin if you have it
240 installed.
241
242 Another example::
243
244 [toolchain-wrapper]
245 wrapper: ccache
246
247 This tells buildman to use a compiler wrapper in front of CROSS_COMPILE. In
248 this example, ccache. It doesn't affect the toolchain scan. The wrapper is
249 added when CROSS_COMPILE environtal variable is set. The name in this
250 section is ignored. If more than one line is provided, only the last one
251 is taken.
252
253#. Make sure you have the require Python pre-requisites
254
255 Buildman uses multiprocessing, Queue, shutil, StringIO, ConfigParser and
256 urllib2. These should normally be available, but if you get an error like
257 this then you will need to obtain those modules::
258
259 ImportError: No module named multiprocessing
260
261
262#. Check the available toolchains
263
264 Run this check to make sure that you have a toolchain for every architecture::
265
266 $ ./tools/buildman/buildman --list-tool-chains
267 Scanning for tool chains
268 - scanning prefix '/opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-'
269 Tool chain test: OK, arch='x86', priority 1
270 - scanning prefix '/opt/arm-eabi-4.6/bin/arm-eabi-'
271 Tool chain test: OK, arch='arm', priority 1
272 - scanning path '/toolchains/gcc-4.9.0-nolibc/i386-linux'
273 - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/.'
274 - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin'
275 - found '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc'
276 - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/usr/bin'
277 Tool chain test: OK, arch='i386', priority 4
278 - scanning path '/toolchains/gcc-4.9.0-nolibc/aarch64-linux'
279 - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/.'
280 - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin'
281 - found '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc'
282 - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/usr/bin'
283 Tool chain test: OK, arch='aarch64', priority 4
284 - scanning path '/toolchains/gcc-4.9.0-nolibc/microblaze-linux'
285 - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/.'
286 - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin'
287 - found '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc'
288 - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/usr/bin'
289 Tool chain test: OK, arch='microblaze', priority 4
290 - scanning path '/toolchains/gcc-4.9.0-nolibc/mips64-linux'
291 - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/.'
292 - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin'
293 - found '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc'
294 - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/usr/bin'
295 Tool chain test: OK, arch='mips64', priority 4
296 - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc64-linux'
297 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/.'
298 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin'
299 - found '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc'
300 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/usr/bin'
301 Tool chain test: OK, arch='sparc64', priority 4
302 - scanning path '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi'
303 - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/.'
304 - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin'
305 - found '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc'
306 - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/usr/bin'
307 Tool chain test: OK, arch='arm', priority 3
308 Toolchain '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc' at priority 3 will be ignored because another toolchain for arch 'arm' has priority 1
309 - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc-linux'
310 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/.'
311 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin'
312 - found '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc'
313 - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/usr/bin'
314 Tool chain test: OK, arch='sparc', priority 4
315 - scanning path '/toolchains/gcc-4.9.0-nolibc/mips-linux'
316 - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/.'
317 - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin'
318 - found '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc'
319 - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/usr/bin'
320 Tool chain test: OK, arch='mips', priority 4
321 - scanning path '/toolchains/gcc-4.9.0-nolibc/x86_64-linux'
322 - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/.'
323 - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin'
324 - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc'
325 - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc'
326 - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/usr/bin'
327 Tool chain test: OK, arch='x86_64', priority 4
328 Tool chain test: OK, arch='x86_64', priority 4
329 Toolchain '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4
330 - scanning path '/toolchains/gcc-4.9.0-nolibc/m68k-linux'
331 - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/.'
332 - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin'
333 - found '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc'
334 - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/usr/bin'
335 Tool chain test: OK, arch='m68k', priority 4
336 - scanning path '/toolchains/gcc-4.9.0-nolibc/powerpc-linux'
337 - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/.'
338 - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin'
339 - found '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc'
340 - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/usr/bin'
341 Tool chain test: OK, arch='powerpc', priority 4
342 - scanning path '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux'
343 - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/.'
344 - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin'
345 - found '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc'
346 - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/usr/bin'
347 Tool chain test: OK, arch='bfin', priority 6
348 - scanning path '/toolchains/gcc-4.6.3-nolibc/sparc-linux'
349 - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/.'
350 - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin'
351 - found '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc'
352 - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/usr/bin'
353 Tool chain test: OK, arch='sparc', priority 4
354 Toolchain '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'sparc' has priority 4
355 - scanning path '/toolchains/gcc-4.6.3-nolibc/mips-linux'
356 - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/.'
357 - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin'
358 - found '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc'
359 - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/usr/bin'
360 Tool chain test: OK, arch='mips', priority 4
361 Toolchain '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'mips' has priority 4
362 - scanning path '/toolchains/gcc-4.6.3-nolibc/m68k-linux'
363 - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/.'
364 - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin'
365 - found '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc'
366 - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/usr/bin'
367 Tool chain test: OK, arch='m68k', priority 4
368 Toolchain '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'm68k' has priority 4
369 - scanning path '/toolchains/gcc-4.6.3-nolibc/powerpc-linux'
370 - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/.'
371 - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin'
372 - found '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc'
373 - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/usr/bin'
374 Tool chain test: OK, arch='powerpc', priority 4
375 Tool chain test: OK, arch='or32', priority 4
376 - scanning path '/'
377 - looking in '/.'
378 - looking in '/bin'
379 - looking in '/usr/bin'
380 - found '/usr/bin/i586-mingw32msvc-gcc'
381 - found '/usr/bin/c89-gcc'
382 - found '/usr/bin/x86_64-linux-gnu-gcc'
383 - found '/usr/bin/gcc'
384 - found '/usr/bin/c99-gcc'
385 - found '/usr/bin/arm-linux-gnueabi-gcc'
386 - found '/usr/bin/aarch64-linux-gnu-gcc'
387 - found '/usr/bin/winegcc'
388 - found '/usr/bin/arm-linux-gnueabihf-gcc'
389 Tool chain test: OK, arch='i586', priority 11
390 Tool chain test: OK, arch='c89', priority 11
391 Tool chain test: OK, arch='x86_64', priority 4
392 Toolchain '/usr/bin/x86_64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4
393 Tool chain test: OK, arch='sandbox', priority 11
394 Tool chain test: OK, arch='c99', priority 11
395 Tool chain test: OK, arch='arm', priority 4
396 Toolchain '/usr/bin/arm-linux-gnueabi-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1
397 Tool chain test: OK, arch='aarch64', priority 4
398 Toolchain '/usr/bin/aarch64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'aarch64' has priority 4
399 Tool chain test: OK, arch='sandbox', priority 11
400 Toolchain '/usr/bin/winegcc' at priority 11 will be ignored because another toolchain for arch 'sandbox' has priority 11
401 Tool chain test: OK, arch='arm', priority 4
402 Toolchain '/usr/bin/arm-linux-gnueabihf-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1
403 List of available toolchains (34):
404 aarch64 : /toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc
405 alpha : /toolchains/gcc-4.9.0-nolibc/alpha-linux/bin/alpha-linux-gcc
406 am33_2.0 : /toolchains/gcc-4.9.0-nolibc/am33_2.0-linux/bin/am33_2.0-linux-gcc
407 arm : /opt/arm-eabi-4.6/bin/arm-eabi-gcc
408 bfin : /toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc
409 c89 : /usr/bin/c89-gcc
410 c99 : /usr/bin/c99-gcc
411 frv : /toolchains/gcc-4.9.0-nolibc/frv-linux/bin/frv-linux-gcc
412 h8300 : /toolchains/gcc-4.9.0-nolibc/h8300-elf/bin/h8300-elf-gcc
413 hppa : /toolchains/gcc-4.9.0-nolibc/hppa-linux/bin/hppa-linux-gcc
414 hppa64 : /toolchains/gcc-4.9.0-nolibc/hppa64-linux/bin/hppa64-linux-gcc
415 i386 : /toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc
416 i586 : /usr/bin/i586-mingw32msvc-gcc
417 ia64 : /toolchains/gcc-4.9.0-nolibc/ia64-linux/bin/ia64-linux-gcc
418 m32r : /toolchains/gcc-4.9.0-nolibc/m32r-linux/bin/m32r-linux-gcc
419 m68k : /toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc
420 microblaze: /toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc
421 mips : /toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc
422 mips64 : /toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc
423 or32 : /toolchains/gcc-4.5.1-nolibc/or32-linux/bin/or32-linux-gcc
424 powerpc : /toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc
425 powerpc64 : /toolchains/gcc-4.9.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc
426 ppc64le : /toolchains/gcc-4.9.0-nolibc/ppc64le-linux/bin/ppc64le-linux-gcc
427 s390x : /toolchains/gcc-4.9.0-nolibc/s390x-linux/bin/s390x-linux-gcc
428 sandbox : /usr/bin/gcc
429 sh4 : /toolchains/gcc-4.6.3-nolibc/sh4-linux/bin/sh4-linux-gcc
430 sparc : /toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc
431 sparc64 : /toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc
432 tilegx : /toolchains/gcc-4.6.2-nolibc/tilegx-linux/bin/tilegx-linux-gcc
433 x86 : /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-gcc
434 x86_64 : /toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
435
436
437 You can see that everything is covered, even some strange ones that won't
438 be used (c88 and c99). This is a feature.
439
440
441#. Install new toolchains if needed
442
443 You can download toolchains and update the [toolchain] section of the
444 settings file to find them.
445
446 To make this easier, buildman can automatically download and install
447 toolchains from kernel.org. First list the available architectures::
448
449 $ ./tools/buildman/buildman --fetch-arch list
450 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/
451 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/
452 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/
453 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.2.4/
454 Available architectures: alpha am33_2.0 arm bfin cris crisv32 frv h8300
455 hppa hppa64 i386 ia64 m32r m68k mips mips64 or32 powerpc powerpc64 s390x sh4
456 sparc sparc64 tilegx x86_64 xtensa
457
458 Then pick one and download it::
459
460 $ ./tools/buildman/buildman --fetch-arch or32
461 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/
462 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/
463 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/
464 Downloading: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1//x86_64-gcc-4.5.1-nolibc_or32-linux.tar.xz
465 Unpacking to: /home/sjg/.buildman-toolchains
466 Testing
467 - looking in '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/.'
468 - looking in '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/bin'
469 - found '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/bin/or32-linux-gcc'
470 Tool chain test: OK
471
472 Or download them all from kernel.org and move them to /toolchains directory:
473
474 .. code-block:: bash
475
476 ./tools/buildman/buildman --fetch-arch all
477 sudo mkdir -p /toolchains
478 sudo mv ~/.buildman-toolchains/*/* /toolchains/
479
480 For those not available from kernel.org, download from the following links:
481
482 - `Arc Toolchain`_
483 - `Blackfin Toolchain`_
484 - `Nios2 Toolchain`_
485 - `SH Toolchain`_
486
487 Note openrisc kernel.org toolchain is out of date. Download the latest one
488 from `OpenRISC Toolchains`_, e.g. `OpenRISC 4.8.1`_.
489
490 Buildman should now be set up to use your new toolchain.
491
492 At the time of writing, U-Boot has these architectures:
493
494 arc, arm, blackfin, m68k, microblaze, mips, nios2, openrisc
495 powerpc, sandbox, sh, sparc, x86
496
497 Of these, only arc is not available at kernel.org.
498
499
500How to run it
501-------------
502
503First do a dry run using the -n flag: (replace <branch> with a real, local
504branch with a valid upstream):
505
506.. code-block:: bash
507
508 ./tools/buildman/buildman -b <branch> -n
509
510If it can't detect the upstream branch, try checking out the branch, and
511doing something like 'git branch --set-upstream-to upstream/master'
512or something similar. Buildman will try to guess a suitable upstream branch
513if it can't find one (you will see a message like "Guessing upstream as ...").
514You can also use the -c option to manually specify the number of commits to
515build.
516
517As an example::
518
519 Dry run, so not doing much. But I would do this:
520
521 Building 18 commits for 1059 boards (4 threads, 1 job per thread)
522 Build directory: ../lcd9b
523 5bb3505 Merge branch 'master' of git://git.denx.de/u-boot-arm
524 c18f1b4 tegra: Use const for pinmux_config_pingroup/table()
525 2f043ae tegra: Add display support to funcmux
526 e349900 tegra: fdt: Add pwm binding and node
527 424a5f0 tegra: fdt: Add LCD definitions for Tegra
528 0636ccf tegra: Add support for PWM
529 a994fe7 tegra: Add SOC support for display/lcd
530 fcd7350 tegra: Add LCD driver
531 4d46e9d tegra: Add LCD support to Nvidia boards
532 991bd48 arm: Add control over cachability of memory regions
533 54e8019 lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment
534 d92aff7 lcd: Add support for flushing LCD fb from dcache after update
535 dbd0677 tegra: Align LCD frame buffer to section boundary
536 0cff9b8 tegra: Support control of cache settings for LCD
537 9c56900 tegra: fdt: Add LCD definitions for Seaboard
538 5cc29db lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
539 cac5a23 tegra: Enable display/lcd support on Seaboard
540 49ff541 wip
541
542 Total boards to build for each commit: 1059
543
544This shows that it will build all 1059 boards, using 4 threads (because
545we have a 4-core CPU). Each thread will run with -j1, meaning that each
546make job will use a single CPU. The list of commits to be built helps you
547confirm that things look about right. Notice that buildman has chosen a
548'base' directory for you, immediately above your source tree.
549
550Buildman works entirely inside the base directory, here ../lcd9b,
551creating a working directory for each thread, and creating output
552directories for each commit and board.
553
554
555Suggested Workflow
556------------------
557
558To run the build for real, take off the -n:
559
560.. code-block:: bash
561
562 ./tools/buildman/buildman -b <branch>
563
564Buildman will set up some working directories, and get started. After a
565minute or so it will settle down to a steady pace, with a display like this::
566
567 Building 18 commits for 1059 boards (4 threads, 1 job per thread)
568 528 36 124 /19062 -18374 1:13:30 : SIMPC8313_SP
569
570This means that it is building 19062 board/commit combinations. So far it
571has managed to successfully build 528. Another 36 have built with warnings,
572and 124 more didn't build at all. It has 18374 builds left to complete.
573Buildman expects to complete the process in around an hour and a quarter.
574Use this time to buy a faster computer.
575
576
577To find out how the build went, ask for a summary with -s. You can do this
578either before the build completes (presumably in another terminal) or
579afterwards. Let's work through an example of how this is used::
580
581 $ ./tools/buildman/buildman -b lcd9b -s
582 ...
583 01: Merge branch 'master' of git://git.denx.de/u-boot-arm
584 powerpc: + galaxy5200_LOWBOOT
585 02: tegra: Use const for pinmux_config_pingroup/table()
586 03: tegra: Add display support to funcmux
587 04: tegra: fdt: Add pwm binding and node
588 05: tegra: fdt: Add LCD definitions for Tegra
589 06: tegra: Add support for PWM
590 07: tegra: Add SOC support for display/lcd
591 08: tegra: Add LCD driver
592 09: tegra: Add LCD support to Nvidia boards
593 10: arm: Add control over cachability of memory regions
594 11: lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment
595 12: lcd: Add support for flushing LCD fb from dcache after update
596 arm: + lubbock
597 13: tegra: Align LCD frame buffer to section boundary
598 14: tegra: Support control of cache settings for LCD
599 15: tegra: fdt: Add LCD definitions for Seaboard
600 16: lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
601 17: tegra: Enable display/lcd support on Seaboard
602 18: wip
603
604This shows which commits have succeeded and which have failed. In this case
605the build is still in progress so many boards are not built yet (use -u to
606see which ones). But already we can see a few failures. The galaxy5200_LOWBOOT
607never builds correctly. This could be a problem with our toolchain, or it
608could be a bug in the upstream. The good news is that we probably don't need
609to blame our commits. The bad news is that our commits are not tested on that
610board.
611
612Commit 12 broke lubbock. That's what the '+ lubbock', in red, means. The
613failure is never fixed by a later commit, or you would see lubbock again, in
614green, without the +.
615
616To see the actual error::
617
618 $ ./tools/buildman/buildman -b <branch> -se
619 ...
620 12: lcd: Add support for flushing LCD fb from dcache after update
621 arm: + lubbock
622 +common/libcommon.o: In function `lcd_sync':
623 +common/lcd.c:120: undefined reference to `flush_dcache_range'
624 +arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 2.19.51.20090709 assertion fail /scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12572
625 +make: *** [build/u-boot] Error 139
626 13: tegra: Align LCD frame buffer to section boundary
627 14: tegra: Support control of cache settings for LCD
628 15: tegra: fdt: Add LCD definitions for Seaboard
629 16: lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
630 -common/lcd.c:120: undefined reference to `flush_dcache_range'
631 +common/lcd.c:125: undefined reference to `flush_dcache_range'
632 17: tegra: Enable display/lcd support on Seaboard
633 18: wip
634
635So the problem is in lcd.c, due to missing cache operations. This information
636should be enough to work out what that commit is doing to break these
637boards. (In this case pxa did not have cache operations defined).
638
639Note that if there were other boards with errors, the above command would
640show their errors also. Each line is shown only once. So if lubbock and snow
641produce the same error, we just see::
642
643 12: lcd: Add support for flushing LCD fb from dcache after update
644 arm: + lubbock snow
645 +common/libcommon.o: In function `lcd_sync':
646 +common/lcd.c:120: undefined reference to `flush_dcache_range'
647 +arm-none-linux-gnueabi-ld: BFD (Sourcery G++ Lite 2010q1-202) 2.19.51.20090709 assertion fail /scratch/julian/2010q1-release-linux-lite/obj/binutils-src-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:12572
648 +make: *** [build/u-boot] Error 139
649
650But if you did want to see just the errors for lubbock, use:
651
652.. code-block:: bash
653
654 ./tools/buildman/buildman -b <branch> -se lubbock
655
656If you see error lines marked with '-', that means that the errors were fixed
657by that commit. Sometimes commits can be in the wrong order, so that a
658breakage is introduced for a few commits and fixed by later commits. This
659shows up clearly with buildman. You can then reorder the commits and try
660again.
661
662At commit 16, the error moves: you can see that the old error at line 120
663is fixed, but there is a new one at line 126. This is probably only because
664we added some code and moved the broken line further down the file.
665
666As mentioned, if many boards have the same error, then -e will display the
667error only once. This makes the output as concise as possible. To see which
668boards have each error, use -l. So it is safe to omit the board name - you
669will not get lots of repeated output for every board.
670
671Buildman tries to distinguish warnings from errors, and shows warning lines
672separately with a 'w' prefix. Warnings introduced show as yellow. Warnings
673fixed show as cyan.
674
675The full build output in this case is available in::
676
677 ../lcd9b/12_of_18_gd92aff7_lcd--Add-support-for/lubbock/
678
679Files:
680
681done
682 Indicates the build was done, and holds the return code from make. This is 0
683 for a good build, typically 2 for a failure.
684
685err
686 Output from stderr, if any. Errors and warnings appear here.
687
688log
689 Output from stdout. Normally there isn't any since buildman runs in silent
690 mode. Use -V to force a verbose build (this passes V=1 to 'make')
691
692toolchain
693 Shows information about the toolchain used for the build.
694
695sizes
696 Shows image size information.
697
698It is possible to get the build binary output there also. Use the -k option
699for this. In that case you will also see some output files, like:
700
701- System.map
702- toolchain
703- u-boot
704- u-boot.bin
705- u-boot.map
706- autoconf.mk
707- SPL/TPL versions like u-boot-spl and u-boot-spl.bin if available
708
709
710Checking Image Sizes
711--------------------
712
713A key requirement for U-Boot is that you keep code/data size to a minimum.
714Where a new feature increases this noticeably it should normally be put
715behind a CONFIG flag so that boards can leave it disabled and keep the image
716size more or less the same with each new release.
717
718To check the impact of your commits on image size, use -S. For example::
719
720 $ ./tools/buildman/buildman -b us-x86 -sS
721 Summary of 10 commits for 1066 boards (4 threads, 1 job per thread)
722 01: MAKEALL: add support for per architecture toolchains
723 02: x86: Add function to get top of usable ram
724 x86: (for 1/3 boards) text -272.0 rodata +41.0
725 03: x86: Add basic cache operations
726 04: x86: Permit bootstage and timer data to be used prior to relocation
727 x86: (for 1/3 boards) data +16.0
728 05: x86: Add an __end symbol to signal the end of the U-Boot binary
729 x86: (for 1/3 boards) text +76.0
730 06: x86: Rearrange the output input to remove BSS
731 x86: (for 1/3 boards) bss -2140.0
732 07: x86: Support relocation of FDT on start-up
733 x86: + coreboot-x86
734 08: x86: Add error checking to x86 relocation code
735 09: x86: Adjust link device tree include file
736 10: x86: Enable CONFIG_OF_CONTROL on coreboot
737
738
739You can see that image size only changed on x86, which is good because this
740series is not supposed to change any other board. From commit 7 onwards the
741build fails so we don't get code size numbers. The numbers are fractional
742because they are an average of all boards for that architecture. The
743intention is to allow you to quickly find image size problems introduced by
744your commits.
745
746Note that the 'text' region and 'rodata' are split out. You should add the
747two together to get the total read-only size (reported as the first column
748in the output from binutil's 'size' utility).
749
750A useful option is --step which lets you skip some commits. For example
751--step 2 will show the image sizes for only every 2nd commit (so it will
752compare the image sizes of the 1st, 3rd, 5th... commits). You can also use
753--step 0 which will compare only the first and last commits. This is useful
754for an overview of how your entire series affects code size. It will build
755only the upstream commit and your final branch commit.
756
757You can also use -d to see a detailed size breakdown for each board. This
758list is sorted in order from largest growth to largest reduction.
759
760It is even possible to go a little further with the -B option (--bloat). This
761shows where U-Boot has bloated, breaking the size change down to the function
762level. Example output is below::
763
764 $ ./tools/buildman/buildman -b us-mem4 -sSdB
765 ...
766 19: Roll crc32 into hash infrastructure
767 arm: (for 10/10 boards) all -143.4 bss +1.2 data -4.8 rodata -48.2 text -91.6
768 paz00 : all +23 bss -4 rodata -29 text +56
769 u-boot: add: 1/0, grow: 3/-2 bytes: 168/-104 (64)
770 function old new delta
771 hash_command 80 160 +80
772 crc32_wd_buf - 56 +56
773 ext4fs_read_file 540 568 +28
774 insert_var_value_sub 688 692 +4
775 run_list_real 1996 1992 -4
776 do_mem_crc 168 68 -100
777 trimslice : all -9 bss +16 rodata -29 text +4
778 u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
779 function old new delta
780 hash_command 80 160 +80
781 crc32_wd_buf - 56 +56
782 ext4fs_iterate_dir 672 668 -4
783 ext4fs_read_file 568 548 -20
784 do_mem_crc 168 68 -100
785 whistler : all -9 bss +16 rodata -29 text +4
786 u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
787 function old new delta
788 hash_command 80 160 +80
789 crc32_wd_buf - 56 +56
790 ext4fs_iterate_dir 672 668 -4
791 ext4fs_read_file 568 548 -20
792 do_mem_crc 168 68 -100
793 seaboard : all -9 bss -28 rodata -29 text +48
794 u-boot: add: 1/0, grow: 3/-2 bytes: 160/-104 (56)
795 function old new delta
796 hash_command 80 160 +80
797 crc32_wd_buf - 56 +56
798 ext4fs_read_file 548 568 +20
799 run_list_real 1996 2000 +4
800 do_nandboot 760 756 -4
801 do_mem_crc 168 68 -100
802 colibri_t20 : all -9 rodata -29 text +20
803 u-boot: add: 1/0, grow: 2/-3 bytes: 140/-112 (28)
804 function old new delta
805 hash_command 80 160 +80
806 crc32_wd_buf - 56 +56
807 read_abs_bbt 204 208 +4
808 do_nandboot 760 756 -4
809 ext4fs_read_file 576 568 -8
810 do_mem_crc 168 68 -100
811 ventana : all -37 bss -12 rodata -29 text +4
812 u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
813 function old new delta
814 hash_command 80 160 +80
815 crc32_wd_buf - 56 +56
816 ext4fs_iterate_dir 672 668 -4
817 ext4fs_read_file 568 548 -20
818 do_mem_crc 168 68 -100
819 harmony : all -37 bss -16 rodata -29 text +8
820 u-boot: add: 1/0, grow: 2/-3 bytes: 140/-124 (16)
821 function old new delta
822 hash_command 80 160 +80
823 crc32_wd_buf - 56 +56
824 nand_write_oob_syndrome 428 432 +4
825 ext4fs_iterate_dir 672 668 -4
826 ext4fs_read_file 568 548 -20
827 do_mem_crc 168 68 -100
828 medcom-wide : all -417 bss +28 data -16 rodata -93 text -336
829 u-boot: add: 1/-1, grow: 1/-2 bytes: 88/-376 (-288)
830 function old new delta
831 crc32_wd_buf - 56 +56
832 do_fat_read_at 2872 2904 +32
833 hash_algo 16 - -16
834 do_mem_crc 168 68 -100
835 hash_command 420 160 -260
836 tec : all -449 bss -4 data -16 rodata -93 text -336
837 u-boot: add: 1/-1, grow: 1/-2 bytes: 88/-376 (-288)
838 function old new delta
839 crc32_wd_buf - 56 +56
840 do_fat_read_at 2872 2904 +32
841 hash_algo 16 - -16
842 do_mem_crc 168 68 -100
843 hash_command 420 160 -260
844 plutux : all -481 bss +16 data -16 rodata -93 text -388
845 u-boot: add: 1/-1, grow: 1/-3 bytes: 68/-408 (-340)
846 function old new delta
847 crc32_wd_buf - 56 +56
848 do_load_serial_bin 1688 1700 +12
849 hash_algo 16 - -16
850 do_fat_read_at 2904 2872 -32
851 do_mem_crc 168 68 -100
852 hash_command 420 160 -260
853 powerpc: (for 5/5 boards) all +37.4 data -3.2 rodata -41.8 text +82.4
854 MPC8610HPCD : all +55 rodata -29 text +84
855 u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
856 function old new delta
857 hash_command - 176 +176
858 do_mem_crc 184 88 -96
859 MPC8641HPCN : all +55 rodata -29 text +84
860 u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
861 function old new delta
862 hash_command - 176 +176
863 do_mem_crc 184 88 -96
864 MPC8641HPCN_36BIT: all +55 rodata -29 text +84
865 u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
866 function old new delta
867 hash_command - 176 +176
868 do_mem_crc 184 88 -96
869 sbc8641d : all +55 rodata -29 text +84
870 u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
871 function old new delta
872 hash_command - 176 +176
873 do_mem_crc 184 88 -96
874 xpedite517x : all -33 data -16 rodata -93 text +76
875 u-boot: add: 1/-1, grow: 0/-1 bytes: 176/-112 (64)
876 function old new delta
877 hash_command - 176 +176
878 hash_algo 16 - -16
879 do_mem_crc 184 88 -96
880 ...
881
882
883This shows that commit 19 has reduced codesize for arm slightly and increased
884it for powerpc. This increase was offset in by reductions in rodata and
885data/bss.
886
887Shown below the summary lines are the sizes for each board. Below each board
888are the sizes for each function. This information starts with:
889
890add
891 number of functions added / removed
892
893grow
894 number of functions which grew / shrunk
895
896bytes
897 number of bytes of code added to / removed from all functions, plus the total
898 byte change in brackets
899
900The change seems to be that hash_command() has increased by more than the
901do_mem_crc() function has decreased. The function sizes typically add up to
902roughly the text area size, but note that every read-only section except
903rodata is included in 'text', so the function total does not exactly
904correspond.
905
906It is common when refactoring code for the rodata to decrease as the text size
907increases, and vice versa.
908
909
910.. _buildman_settings:
911
912The .buildman settings file
913---------------------------
914
915The .buildman file provides information about the available toolchains and
916also allows build flags to be passed to 'make'. It consists of several
917sections, with the section name in square brackets. Within each section are
918a set of (tag, value) pairs.
919
920'[toolchain]' section
921 This lists the available toolchains. The tag here doesn't matter, but
922 make sure it is unique. The value is the path to the toolchain. Buildman
923 will look in that path for a file ending in 'gcc'. It will then execute
924 it to check that it is a C compiler, passing only the --version flag to
925 it. If the return code is 0, buildman assumes that it is a valid C
926 compiler. It uses the first part of the name as the architecture and
927 strips off the last part when setting the CROSS_COMPILE environment
928 variable (parts are delimited with a hyphen).
929
930 For example powerpc-linux-gcc will be noted as a toolchain for 'powerpc'
931 and CROSS_COMPILE will be set to powerpc-linux- when using it.
932
933'[toolchain-alias]' section
934 This converts toolchain architecture names to U-Boot names. For example,
935 if an x86 toolchains is called i386-linux-gcc it will not normally be
936 used for architecture 'x86'. Adding 'x86: i386 x86_64' to this section
937 will tell buildman that the i386 and x86_64 toolchains can be used for
938 the x86 architecture.
939
940'[make-flags]' section
941 U-Boot's build system supports a few flags (such as BUILD_TAG) which
942 affect the build product. These flags can be specified in the buildman
943 settings file. They can also be useful when building U-Boot against other
944 open source software.
945
946 [make-flags]
947 at91-boards=ENABLE_AT91_TEST=1
948 snapper9260=${at91-boards} BUILD_TAG=442
949 snapper9g45=${at91-boards} BUILD_TAG=443
950
951 This will use 'make ENABLE_AT91_TEST=1 BUILD_TAG=442' for snapper9260
952 and 'make ENABLE_AT91_TEST=1 BUILD_TAG=443' for snapper9g45. A special
953 variable ${target} is available to access the target name (snapper9260
954 and snapper9g20 in this case). Variables are resolved recursively. Note
955 that variables can only contain the characters A-Z, a-z, 0-9, hyphen (-)
956 and underscore (_).
957
958 It is expected that any variables added are dealt with in U-Boot's
959 config.mk file and documented in the README.
960
961 Note that you can pass ad-hoc options to the build using environment
962 variables, for example:
963
964 SOME_OPTION=1234 ./tools/buildman/buildman my_board
965
966
967Quick Sanity Check
968------------------
969
970If you have made changes and want to do a quick sanity check of the
971currently checked-out source, run buildman without the -b flag. This will
972build the selected boards and display build status as it runs (i.e. -v is
973enabled automatically). Use -e to see errors/warnings as well.
974
975
976Building Ranges
977---------------
978
979You can build a range of commits by specifying a range instead of a branch
980when using the -b flag. For example::
981
982 buildman -b upstream/master..us-buildman
983
984will build commits in us-buildman that are not in upstream/master.
985
986
987Building Faster
988---------------
989
990By default, buildman doesn't execute 'make mrproper' prior to building the
991first commit for each board. This reduces the amount of work 'make' does, and
992hence speeds up the build. To force use of 'make mrproper', use -the -m flag.
993This flag will slow down any buildman invocation, since it increases the amount
994of work done on any build.
995
996One possible application of buildman is as part of a continual edit, build,
997edit, build, ... cycle; repeatedly applying buildman to the same change or
998series of changes while making small incremental modifications to the source
999each time. This provides quick feedback regarding the correctness of recent
1000modifications. In this scenario, buildman's default choice of build directory
1001causes more build work to be performed than strictly necessary.
1002
1003By default, each buildman thread uses a single directory for all builds. When a
1004thread builds multiple boards, the configuration built in this directory will
1005cycle through various different configurations, one per board built by the
1006thread. Variations in the configuration will force a rebuild of affected source
1007files when a thread switches between boards. Ideally, such buildman-induced
1008rebuilds would not happen, thus allowing the build to operate as efficiently as
1009the build system and source changes allow. buildman's -P flag may be used to
1010enable this; -P causes each board to be built in a separate (board-specific)
1011directory, thus avoiding any buildman-induced configuration changes in any
1012build directory.
1013
1014U-Boot's build system embeds information such as a build timestamp into the
1015final binary. This information varies each time U-Boot is built. This causes
1016various files to be rebuilt even if no source changes are made, which in turn
1017requires that the final U-Boot binary be re-linked. This unnecessary work can
1018be avoided by turning off the timestamp feature. This can be achieved by
1019setting the SOURCE_DATE_EPOCH environment variable to 0.
1020
1021Combining all of these options together yields the command-line shown below.
1022This will provide the quickest possible feedback regarding the current content
1023of the source tree, thus allowing rapid tested evolution of the code::
1024
1025 SOURCE_DATE_EPOCH=0 ./tools/buildman/buildman -P tegra
1026
1027
1028Checking configuration
1029----------------------
1030
1031A common requirement when converting CONFIG options to Kconfig is to check
1032that the effective configuration has not changed due to the conversion.
1033Buildman supports this with the -K option, used after a build. This shows
1034differences in effective configuration between one commit and the next.
1035
1036For example::
1037
1038 $ buildman -b kc4 -sK
1039 ...
1040 43: Convert CONFIG_SPL_USBETH_SUPPORT to Kconfig
1041 arm:
1042 + u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET=1
1043 + u-boot-spl.cfg: CONFIG_SPL_MMC=1 CONFIG_SPL_NAND_SUPPORT=1
1044 + all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC=1 CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET=1
1045 am335x_evm_usbspl :
1046 + u-boot.cfg: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_NET=1
1047 + u-boot-spl.cfg: CONFIG_SPL_MMC=1 CONFIG_SPL_NAND_SUPPORT=1
1048 + all: CONFIG_SPL_ENV_SUPPORT=1 CONFIG_SPL_MMC=1 CONFIG_SPL_NAND_SUPPORT=1 CONFIG_SPL_NET=1
1049 44: Convert CONFIG_SPL_USB_HOST to Kconfig
1050 ...
1051
1052This shows that commit 44 enabled three new options for the board
1053am335x_evm_usbspl which were not enabled in commit 43. There is also a
1054summary for 'arm' showing all the changes detected for that architecture.
1055In this case there is only one board with changes, so 'arm' output is the
1056same as 'am335x_evm_usbspl'/
1057
1058The -K option uses the u-boot.cfg, spl/u-boot-spl.cfg and tpl/u-boot-tpl.cfg
1059files which are produced by a build. If all you want is to check the
1060configuration you can in fact avoid doing a full build, using -D. This tells
1061buildman to configuration U-Boot and create the .cfg files, but not actually
1062build the source. This is 5-10 times faster than doing a full build.
1063
1064By default buildman considers the follow two configuration methods
1065equivalent::
1066
1067 #define CONFIG_SOME_OPTION
1068
1069 CONFIG_SOME_OPTION=y
1070
1071The former would appear in a header filer and the latter in a defconfig
1072file. The achieve this, buildman considers 'y' to be '1' in configuration
1073variables. This avoids lots of useless output when converting a CONFIG
1074option to Kconfig. To disable this behaviour, use --squash-config-y.
1075
1076
1077Checking the environment
1078------------------------
1079
1080When converting CONFIG options which manipulate the default environment,
1081a common requirement is to check that the default environment has not
1082changed due to the conversion. Buildman supports this with the -U option,
1083used after a build. This shows differences in the default environment
1084between one commit and the next.
1085
1086For example::
1087
1088 $ buildman -b squash brppt1 -sU
1089 Summary of 2 commits for 3 boards (3 threads, 3 jobs per thread)
1090 01: Migrate bootlimit to Kconfig
1091 02: Squashed commit of the following:
1092 c brppt1_mmc: altbootcmd=mmc dev 1; run mmcboot0; -> mmc dev 1; run mmcboot0
1093 c brppt1_spi: altbootcmd=mmc dev 1; run mmcboot0; -> mmc dev 1; run mmcboot0
1094 + brppt1_nand: altbootcmd=run usbscript
1095 - brppt1_nand: altbootcmd=run usbscript
1096 (no errors to report)
1097
1098This shows that commit 2 modified the value of 'altbootcmd' for 'brppt1_mmc'
1099and 'brppt1_spi', removing a trailing semicolon. 'brppt1_nand' gained an a
1100value for 'altbootcmd', but lost one for ' altbootcmd'.
1101
1102The -U option uses the u-boot.env files which are produced by a build.
1103
1104
1105Building with clang
1106-------------------
1107
1108To build with clang (sandbox only), use the -O option to override the
1109toolchain. For example:
1110
1111.. code-block:: bash
1112
1113 buildman -O clang-7 --board sandbox
1114
1115
1116Doing a simple build
1117--------------------
1118
1119In some cases you just want to build a single board and get the full output, use
1120the -w option, for example:
1121
1122.. code-block:: bash
1123
1124 buildman -o /tmp/build --board sandbox -w
1125
1126This will write the full build into /tmp/build including object files. You must
1127specify the output directory with -o when using -w.
1128
1129
1130Support for IDEs (Integrated Development Environments)
1131------------------------------------------------------
1132
1133Normally buildman summarises the output and shows information indicating the
1134meaning of each line of output. For example a '+' symbol appears at the start of
1135each error line. Also, buildman prints information about what it is about to do,
1136along with a summary at the end.
1137
1138When using buildman from an IDE, it is helpful to drop this behaviour. Use the
1139-I/--ide option for that. You might find -W helpful also so that warnings do
1140not cause the build to fail:
1141
1142.. code-block:: bash
1143
1144 buildman -o /tmp/build --board sandbox -wWI
1145
1146
1147Changing the configuration
1148--------------------------
1149
1150Sometimes it is useful to change the CONFIG options for a build on the fly. This
1151can be used to build a board (or multiple) with a few changes to see the impact.
1152The -a option supports this:
1153
1154.. code-block:: bash
1155
1156 -a <cfg>
1157
1158where <cfg> is a CONFIG option (with or without the `CONFIG_` prefix) to enable.
1159For example:
1160
1161.. code-block:: bash
1162
1163 buildman -a CMD_SETEXPR_FMT
1164
1165will build with CONFIG_CMD_SETEXPR_FMT enabled.
1166
1167You can disable options by preceding them with tilde (~). You can specify the
1168-a option multiple times:
1169
1170.. code-block:: bash
1171
1172 buildman -a CMD_SETEXPR_FMT -a ~CMDLINE
1173
1174Some options have values, in which case you can change them:
1175
1176.. code-block:: bash
1177
1178 buildman -a 'BOOTCOMMAND="echo hello"' CONFIG_SYS_LOAD_ADDR=0x1000
1179
1180Note that you must put quotes around string options and the whole thing must be
1181in single quotes, to make sure the shell leave it alone.
1182
1183If you try to set an option that does not exist, or that cannot be changed for
1184some other reason (e.g. it is 'selected' by another option), then buildman
1185shows an error::
1186
1187 $ buildman --board sandbox -a FRED
1188 Building current source for 1 boards (1 thread, 32 jobs per thread)
1189 0 0 0 /1 -1 (starting)errs
1190 Some CONFIG adjustments did not take effect. This may be because
1191 the request CONFIGs do not exist or conflict with others.
1192
1193 Failed adjustments:
1194
1195 FRED Missing expected line: CONFIG_FRED=y
1196
1197
1198One major caveat with this feature with branches (-b) is that buildman does not
1199name the output directories differently when you change the configuration, so
1200doing the same build again with different configuration will not trigger a
1201rebuild. You can use -f to work around that.
1202
1203
1204Other options
1205-------------
1206
1207Buildman has various other command-line options. Try --help to see them.
1208
1209To find out what toolchain prefix buildman will use for a build, use the -A
1210option.
1211
1212To request that compiler warnings be promoted to errors, use -E. This passes the
1213-Werror flag to the compiler. Note that the build can still produce warnings
1214with -E, e.g. the migration warnings::
1215
1216 ===================== WARNING ======================
1217 This board does not use CONFIG_DM_MMC. Please update
1218 ...
1219 ====================================================
1220
1221When doing builds, Buildman's return code will reflect the overall result::
1222
1223 0 (success) No errors or warnings found
1224 100 Errors found
1225 101 Warnings found (only if no -W)
1226
1227You can use -W to tell Buildman to return 0 (success) instead of 101 when
1228warnings are found. Note that it can be useful to combine -E and -W. This means
1229that all compiler warnings will produce failures (code 100) and all other
1230warnings will produce success (since 101 is changed to 0).
1231
1232If there are both warnings and errors, errors win, so buildman returns 100.
1233
1234The -y option is provided (for use with -s) to ignore the bountiful device-tree
1235warnings. Similarly, -Y tells buildman to ignore the migration warnings.
1236
1237Sometimes you might get an error in a thread that is not handled by buildman,
1238perhaps due to a failure of a tool that it calls. You might see the output, but
1239then buildman hangs. Failing to handle any eventuality is a bug in buildman and
1240should be reported. But you can use -T0 to disable threading and hopefully
1241figure out the root cause of the build failure.
1242
1243Build summary
1244-------------
1245
1246When buildman finishes it shows a summary, something like this::
1247
1248 Completed: 5 total built, duration 0:00:21, rate 0.24
1249
1250This shows that a total of 5 builds were done across all selected boards, it
1251took 21 seconds and the builds happened at the rate of 0.24 per second. The
1252latter number depends on the speed of your machine and the efficiency of the
1253U-Boot build.
1254
1255
Simon Glass74df4912022-11-09 19:14:43 -07001256Using boards.cfg
1257----------------
1258
1259This file is no-longer needed by buildman but it is still generated in the
1260working directory. This helps avoid a delay on every build, since scanning all
1261the Kconfig files takes a few seconds. Use the -R flag to force regeneration
1262of the file - in that case buildman exits after writing the file. with exit code
12632 if there was an error in the maintainer files.
1264
1265You should use 'buildman -nv <criteria>' instead of greoing the boards.cfg file,
1266since it may be dropped altogether in future.
1267
1268
1269TODO
1270----
1271
1272Many improvements have been made over the years. There is still quite a bit of
1273scope for more though, e.g.:
1274
1275- easier access to log files
1276- 'hunting' for problems, perhaps by building a few boards for each arch, or
1277 checking commits for changed files and building only boards which use those
1278 files
1279
1280
1281Credits
1282-------
1283
1284Thanks to Grant Grundler <grundler@chromium.org> for his ideas for improving
1285the build speed by building all commits for a board instead of the other
1286way around.
1287
Simon Glassce592522022-11-09 19:14:45 -07001288.. _`Arc Toolchain`: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_elf32_le_linux_install.tar.gz
Simon Glass74df4912022-11-09 19:14:43 -07001289.. _`Blackfin Toolchain`: http://sourceforge.net/projects/adi-toolchain/files/blackfin-toolchain-elf-gcc-4.5-2014R1_45-RC2.x86_64.tar.bz2
1290.. _`Nios2 Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu/sourceryg++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
1291.. _`SH Toolchain`: http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/renesas-4.4-200-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
1292.. _`OpenRISC Toolchains`: http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Prebuilt_versions
1293.. _`OpenRISC 4.8.1`: ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/gcc-or1k-elf-4.8.1-x86.tar.bz2
1294
1295.. sectionauthor:: Simon Glass
1296.. sectionauthor:: Copyright (c) 2013 The Chromium OS Authors.
1297.. sectionauthor:: sjg@chromium.org
1298.. Halloween 2012
1299.. Updated 12-12-12
1300.. Updated 23-02-13
1301.. Updated 09-04-20