xref: /openbmc/u-boot/tools/buildman/README (revision e57c6e5b)
1fc3fe1c2SSimon Glass# Copyright (c) 2013 The Chromium OS Authors.
2fc3fe1c2SSimon Glass#
31a459660SWolfgang Denk# SPDX-License-Identifier:	GPL-2.0+
4fc3fe1c2SSimon Glass#
5fc3fe1c2SSimon Glass
66eede34cSSimon Glass(Please read 'How to change from MAKEALL' if you are used to that tool)
76eede34cSSimon Glass
8fc3fe1c2SSimon GlassWhat is this?
9fc3fe1c2SSimon Glass=============
10fc3fe1c2SSimon Glass
11fc3fe1c2SSimon GlassThis tool handles building U-Boot to check that you have not broken it
12fc3fe1c2SSimon Glasswith your patch series. It can build each individual commit and report
13fc3fe1c2SSimon Glasswhich boards fail on which commits, and which errors come up. It aims
14fc3fe1c2SSimon Glassto make full use of multi-processor machines.
15fc3fe1c2SSimon Glass
16fc3fe1c2SSimon GlassA key feature of buildman is its output summary, which allows warnings,
17fc3fe1c2SSimon Glasserrors or image size increases in a particular commit or board to be
18fc3fe1c2SSimon Glassquickly identified and the offending commit pinpointed. This can be a big
19fc3fe1c2SSimon Glasshelp for anyone working with >10 patches at a time.
20fc3fe1c2SSimon Glass
21fc3fe1c2SSimon Glass
22fc3fe1c2SSimon GlassCaveats
23fc3fe1c2SSimon Glass=======
24fc3fe1c2SSimon Glass
25fc3fe1c2SSimon GlassBuildman is still in its infancy. It is already a very useful tool, but
26fc3fe1c2SSimon Glassexpect to find problems and send patches.
27fc3fe1c2SSimon Glass
28fc3fe1c2SSimon GlassBuildman can be stopped and restarted, in which case it will continue
29fc3fe1c2SSimon Glasswhere it left off. This should happen cleanly and without side-effects.
30fc3fe1c2SSimon GlassIf not, it is a bug, for which a patch would be welcome.
31fc3fe1c2SSimon Glass
32fc3fe1c2SSimon GlassBuildman gets so tied up in its work that it can ignore the outside world.
33fc3fe1c2SSimon GlassYou may need to press Ctrl-C several times to quit it. Also it will print
34fc3fe1c2SSimon Glassout various exceptions when stopped.
35fc3fe1c2SSimon Glass
36fc3fe1c2SSimon Glass
37fc3fe1c2SSimon GlassTheory of Operation
38fc3fe1c2SSimon Glass===================
39fc3fe1c2SSimon Glass
40fc3fe1c2SSimon Glass(please read this section in full twice or you will be perpetually confused)
41fc3fe1c2SSimon Glass
42fc3fe1c2SSimon GlassBuildman is a builder. It is not make, although it runs make. It does not
43fc3fe1c2SSimon Glassproduce any useful output on the terminal while building, except for
44e5a0e5d8SSimon Glassprogress information (except with -v, see below). All the output (errors,
453e1ded1fSDirk Behmewarnings and binaries if you ask for them) is stored in output
46e5a0e5d8SSimon Glassdirectories, which you can look at while the build is progressing, or when
47e5a0e5d8SSimon Glassit is finished.
48fc3fe1c2SSimon Glass
49fc3fe1c2SSimon GlassBuildman produces a concise summary of which boards succeeded and failed.
50fc3fe1c2SSimon GlassIt shows which commit introduced which board failure using a simple
51fc3fe1c2SSimon Glassred/green colour coding. Full error information can be requested, in which
52fc3fe1c2SSimon Glasscase it is de-duped and displayed against the commit that introduced the
53fc3fe1c2SSimon Glasserror. An example workflow is below.
54fc3fe1c2SSimon Glass
55fc3fe1c2SSimon GlassBuildman stores image size information and can report changes in image size
56fc3fe1c2SSimon Glassfrom commit to commit. An example of this is below.
57fc3fe1c2SSimon Glass
58fc3fe1c2SSimon GlassBuildman starts multiple threads, and each thread builds for one board at
59fc3fe1c2SSimon Glassa time. A thread starts at the first commit, configures the source for your
60fc3fe1c2SSimon Glassboard and builds it. Then it checks out the next commit and does an
61fc3fe1c2SSimon Glassincremental build. Eventually the thread reaches the last commit and stops.
62fc3fe1c2SSimon GlassIf errors or warnings are found along the way, the thread will reconfigure
63fc3fe1c2SSimon Glassafter every commit, and your build will be very slow. This is because a
64fc3fe1c2SSimon Glassfile that produces just a warning would not normally be rebuilt in an
65fc3fe1c2SSimon Glassincremental build.
66fc3fe1c2SSimon Glass
67fc3fe1c2SSimon GlassBuildman works in an entirely separate place from your U-Boot repository.
68fc3fe1c2SSimon GlassIt creates a separate working directory for each thread, and puts the
69fc3fe1c2SSimon Glassoutput files in the working directory, organised by commit name and board
70fc3fe1c2SSimon Glassname, in a two-level hierarchy.
71fc3fe1c2SSimon Glass
72fc3fe1c2SSimon GlassBuildman is invoked in your U-Boot directory, the one with the .git
73fc3fe1c2SSimon Glassdirectory. It clones this repository into a copy for each thread, and the
74fc3fe1c2SSimon Glassthreads do not affect the state of your git repository. Any checkouts done
75fc3fe1c2SSimon Glassby the thread affect only the working directory for that thread.
76fc3fe1c2SSimon Glass
77fc3fe1c2SSimon GlassBuildman automatically selects the correct tool chain for each board. You
78fc3fe1c2SSimon Glassmust supply suitable tool chains, but buildman takes care of selecting the
79fc3fe1c2SSimon Glassright one.
80fc3fe1c2SSimon Glass
81e5a0e5d8SSimon GlassBuildman generally builds a branch (with the -b flag), and in this case
82e5a0e5d8SSimon Glassbuilds the upstream commit as well, for comparison. It cannot build
83e5a0e5d8SSimon Glassindividual commits at present, unless (maybe) you point it at an empty
84e5a0e5d8SSimon Glassbranch. Put all your commits in a branch, set the branch's upstream to a
85e5a0e5d8SSimon Glassvalid value, and all will be well. Otherwise buildman will perform random
86e5a0e5d8SSimon Glassactions. Use -n to check what the random actions might be.
87e5a0e5d8SSimon Glass
881d8104feSSimon GlassIf you just want to build the current source tree, leave off the -b flag
891d8104feSSimon Glassand add -e. This will display results and errors as they happen. You can
901d8104feSSimon Glassstill look at them later using -se. Note that buildman will assume that the
911d8104feSSimon Glasssource has changed, and will build all specified boards in this case.
92fc3fe1c2SSimon Glass
93fc3fe1c2SSimon GlassBuildman is optimised for building many commits at once, for many boards.
94fc3fe1c2SSimon GlassOn multi-core machines, Buildman is fast because it uses most of the
95fc3fe1c2SSimon Glassavailable CPU power. When it gets to the end, or if you are building just
96fc3fe1c2SSimon Glassa few commits or boards, it will be pretty slow. As a tip, if you don't
97fc3fe1c2SSimon Glassplan to use your machine for anything else, you can use -T to increase the
98fc3fe1c2SSimon Glassnumber of threads beyond the default.
99fc3fe1c2SSimon Glass
1008426d8b0SStephen WarrenBuildman lets you build all boards, or a subset. Specify the subset by passing
1018426d8b0SStephen Warrencommand-line arguments that list the desired board name, architecture name,
1028426d8b0SStephen WarrenSOC name, or anything else in the boards.cfg file. Multiple arguments are
1038426d8b0SStephen Warrenallowed. Each argument will be interpreted as a regular expression, so
1048426d8b0SStephen Warrenbehaviour is a superset of exact or substring matching. Examples are:
1058426d8b0SStephen Warren
1068426d8b0SStephen Warren* 'tegra20'      All boards with a Tegra20 SoC
1078426d8b0SStephen Warren* 'tegra'        All boards with any Tegra Soc (Tegra20, Tegra30, Tegra114...)
1088426d8b0SStephen Warren* '^tegra[23]0$' All boards with either Tegra20 or Tegra30 SoC
1098426d8b0SStephen Warren* 'powerpc'      All PowerPC boards
110fc3fe1c2SSimon Glass
1116131beabSSimon GlassWhile the default is to OR the terms together, you can also make use of
1126131beabSSimon Glassthe '&' operator to limit the selection:
1136131beabSSimon Glass
1146131beabSSimon Glass* 'freescale & arm sandbox'  All Freescale boards with ARM architecture,
1156131beabSSimon Glass                             plus sandbox
1166131beabSSimon Glass
1173cf4ae6fSSimon GlassYou can also use -x to specifically exclude some boards. For example:
1183cf4ae6fSSimon Glass
1193cf4ae6fSSimon Glass buildmand arm -x nvidia,freescale,.*ball$
1203cf4ae6fSSimon Glass
1213cf4ae6fSSimon Glassmeans to build all arm boards except nvidia, freescale and anything ending
1223cf4ae6fSSimon Glasswith 'ball'.
1233cf4ae6fSSimon Glass
1243e1ded1fSDirk BehmeIt is convenient to use the -n option to see what will be built based on
1256131beabSSimon Glassthe subset given.
1266131beabSSimon Glass
127fc3fe1c2SSimon GlassBuildman does not store intermediate object files. It optionally copies
128fc3fe1c2SSimon Glassthe binary output into a directory when a build is successful. Size
129fc3fe1c2SSimon Glassinformation is always recorded. It needs a fair bit of disk space to work,
130fc3fe1c2SSimon Glasstypically 250MB per thread.
131fc3fe1c2SSimon Glass
132fc3fe1c2SSimon Glass
133fc3fe1c2SSimon GlassSetting up
134fc3fe1c2SSimon Glass==========
135fc3fe1c2SSimon Glass
136fc3fe1c2SSimon Glass1. Get the U-Boot source. You probably already have it, but if not these
137fc3fe1c2SSimon Glasssteps should get you started with a repo and some commits for testing.
138fc3fe1c2SSimon Glass
139fc3fe1c2SSimon Glass$ cd /path/to/u-boot
140fc3fe1c2SSimon Glass$ git clone git://git.denx.de/u-boot.git .
141fc3fe1c2SSimon Glass$ git checkout -b my-branch origin/master
142fc3fe1c2SSimon Glass$ # Add some commits to the branch, reading for testing
143fc3fe1c2SSimon Glass
14462005342SSimon Glass2. Create ~/.buildman to tell buildman where to find tool chains (see 'The
14562005342SSimon Glass.buildman file' later for details). As an example:
146fc3fe1c2SSimon Glass
147fc3fe1c2SSimon Glass# Buildman settings file
148fc3fe1c2SSimon Glass
149fc3fe1c2SSimon Glass[toolchain]
150fc3fe1c2SSimon Glassroot: /
151fc3fe1c2SSimon Glassrest: /toolchains/*
152fc3fe1c2SSimon Glasseldk: /opt/eldk-4.2
153e9569478SSimon Glassarm: /opt/linaro/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux
154e9569478SSimon Glassaarch64: /opt/linaro/gcc-linaro-aarch64-none-elf-4.8-2013.10_linux
155fc3fe1c2SSimon Glass
156fc3fe1c2SSimon Glass[toolchain-alias]
157fc3fe1c2SSimon Glassx86: i386
158fc3fe1c2SSimon Glassblackfin: bfin
159fc3fe1c2SSimon Glasssh: sh4
160fc3fe1c2SSimon Glassnds32: nds32le
161fc3fe1c2SSimon Glassopenrisc: or32
162fc3fe1c2SSimon Glass
163fc3fe1c2SSimon Glass
164fc3fe1c2SSimon GlassThis selects the available toolchain paths. Add the base directory for
165fc3fe1c2SSimon Glasseach of your toolchains here. Buildman will search inside these directories
166fc3fe1c2SSimon Glassand also in any '/usr' and '/usr/bin' subdirectories.
167fc3fe1c2SSimon Glass
168fc3fe1c2SSimon GlassMake sure the tags (here root: rest: and eldk:) are unique.
169fc3fe1c2SSimon Glass
170fc3fe1c2SSimon GlassThe toolchain-alias section indicates that the i386 toolchain should be used
171fc3fe1c2SSimon Glassto build x86 commits.
172fc3fe1c2SSimon Glass
173fc3fe1c2SSimon Glass
17434699696SSimon Glass3. Make sure you have the require Python pre-requisites
17534699696SSimon Glass
176827e37b5SSimon GlassBuildman uses multiprocessing, Queue, shutil, StringIO, ConfigParser and
177827e37b5SSimon Glassurllib2. These should normally be available, but if you get an error like
178827e37b5SSimon Glassthis then you will need to obtain those modules:
17934699696SSimon Glass
18034699696SSimon Glass    ImportError: No module named multiprocessing
18134699696SSimon Glass
18234699696SSimon Glass
18334699696SSimon Glass4. Check the available toolchains
184fc3fe1c2SSimon Glass
185fc3fe1c2SSimon GlassRun this check to make sure that you have a toolchain for every architecture.
186fc3fe1c2SSimon Glass
187fc3fe1c2SSimon Glass$ ./tools/buildman/buildman --list-tool-chains
188fc3fe1c2SSimon GlassScanning for tool chains
189fc3fe1c2SSimon Glass   - scanning path '/'
190fc3fe1c2SSimon Glass      - looking in '/.'
191fc3fe1c2SSimon Glass      - looking in '/bin'
192fc3fe1c2SSimon Glass      - looking in '/usr/bin'
193fc3fe1c2SSimon Glass         - found '/usr/bin/gcc'
194fc3fe1c2SSimon GlassTool chain test:  OK
195fc3fe1c2SSimon Glass         - found '/usr/bin/c89-gcc'
196fc3fe1c2SSimon GlassTool chain test:  OK
197fc3fe1c2SSimon Glass         - found '/usr/bin/c99-gcc'
198fc3fe1c2SSimon GlassTool chain test:  OK
199fc3fe1c2SSimon Glass         - found '/usr/bin/x86_64-linux-gnu-gcc'
200fc3fe1c2SSimon GlassTool chain test:  OK
201fc3fe1c2SSimon Glass   - scanning path '/toolchains/powerpc-linux'
202fc3fe1c2SSimon Glass      - looking in '/toolchains/powerpc-linux/.'
203fc3fe1c2SSimon Glass      - looking in '/toolchains/powerpc-linux/bin'
204fc3fe1c2SSimon Glass         - found '/toolchains/powerpc-linux/bin/powerpc-linux-gcc'
205fc3fe1c2SSimon GlassTool chain test:  OK
206fc3fe1c2SSimon Glass      - looking in '/toolchains/powerpc-linux/usr/bin'
207fc3fe1c2SSimon Glass   - scanning path '/toolchains/nds32le-linux-glibc-v1f'
208fc3fe1c2SSimon Glass      - looking in '/toolchains/nds32le-linux-glibc-v1f/.'
209fc3fe1c2SSimon Glass      - looking in '/toolchains/nds32le-linux-glibc-v1f/bin'
210fc3fe1c2SSimon Glass         - found '/toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc'
211fc3fe1c2SSimon GlassTool chain test:  OK
212fc3fe1c2SSimon Glass      - looking in '/toolchains/nds32le-linux-glibc-v1f/usr/bin'
213fc3fe1c2SSimon Glass   - scanning path '/toolchains/nios2'
214fc3fe1c2SSimon Glass      - looking in '/toolchains/nios2/.'
215fc3fe1c2SSimon Glass      - looking in '/toolchains/nios2/bin'
216fc3fe1c2SSimon Glass         - found '/toolchains/nios2/bin/nios2-linux-gcc'
217fc3fe1c2SSimon GlassTool chain test:  OK
218fc3fe1c2SSimon Glass         - found '/toolchains/nios2/bin/nios2-linux-uclibc-gcc'
219fc3fe1c2SSimon GlassTool chain test:  OK
220fc3fe1c2SSimon Glass      - looking in '/toolchains/nios2/usr/bin'
221fc3fe1c2SSimon Glass         - found '/toolchains/nios2/usr/bin/nios2-linux-gcc'
222fc3fe1c2SSimon GlassTool chain test:  OK
223fc3fe1c2SSimon Glass         - found '/toolchains/nios2/usr/bin/nios2-linux-uclibc-gcc'
224fc3fe1c2SSimon GlassTool chain test:  OK
225fc3fe1c2SSimon Glass   - scanning path '/toolchains/microblaze-unknown-linux-gnu'
226fc3fe1c2SSimon Glass      - looking in '/toolchains/microblaze-unknown-linux-gnu/.'
227fc3fe1c2SSimon Glass      - looking in '/toolchains/microblaze-unknown-linux-gnu/bin'
228fc3fe1c2SSimon Glass         - found '/toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc'
229fc3fe1c2SSimon GlassTool chain test:  OK
230fc3fe1c2SSimon Glass         - found '/toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc'
231fc3fe1c2SSimon GlassTool chain test:  OK
232fc3fe1c2SSimon Glass      - looking in '/toolchains/microblaze-unknown-linux-gnu/usr/bin'
233fc3fe1c2SSimon Glass   - scanning path '/toolchains/mips-linux'
234fc3fe1c2SSimon Glass      - looking in '/toolchains/mips-linux/.'
235fc3fe1c2SSimon Glass      - looking in '/toolchains/mips-linux/bin'
236fc3fe1c2SSimon Glass         - found '/toolchains/mips-linux/bin/mips-linux-gcc'
237fc3fe1c2SSimon GlassTool chain test:  OK
238fc3fe1c2SSimon Glass      - looking in '/toolchains/mips-linux/usr/bin'
239fc3fe1c2SSimon Glass   - scanning path '/toolchains/old'
240fc3fe1c2SSimon Glass      - looking in '/toolchains/old/.'
241fc3fe1c2SSimon Glass      - looking in '/toolchains/old/bin'
242fc3fe1c2SSimon Glass      - looking in '/toolchains/old/usr/bin'
243fc3fe1c2SSimon Glass   - scanning path '/toolchains/i386-linux'
244fc3fe1c2SSimon Glass      - looking in '/toolchains/i386-linux/.'
245fc3fe1c2SSimon Glass      - looking in '/toolchains/i386-linux/bin'
246fc3fe1c2SSimon Glass         - found '/toolchains/i386-linux/bin/i386-linux-gcc'
247fc3fe1c2SSimon GlassTool chain test:  OK
248fc3fe1c2SSimon Glass      - looking in '/toolchains/i386-linux/usr/bin'
249fc3fe1c2SSimon Glass   - scanning path '/toolchains/bfin-uclinux'
250fc3fe1c2SSimon Glass      - looking in '/toolchains/bfin-uclinux/.'
251fc3fe1c2SSimon Glass      - looking in '/toolchains/bfin-uclinux/bin'
252fc3fe1c2SSimon Glass         - found '/toolchains/bfin-uclinux/bin/bfin-uclinux-gcc'
253fc3fe1c2SSimon GlassTool chain test:  OK
254fc3fe1c2SSimon Glass      - looking in '/toolchains/bfin-uclinux/usr/bin'
255fc3fe1c2SSimon Glass   - scanning path '/toolchains/sparc-elf'
256fc3fe1c2SSimon Glass      - looking in '/toolchains/sparc-elf/.'
257fc3fe1c2SSimon Glass      - looking in '/toolchains/sparc-elf/bin'
258fc3fe1c2SSimon Glass         - found '/toolchains/sparc-elf/bin/sparc-elf-gcc'
259fc3fe1c2SSimon GlassTool chain test:  OK
260fc3fe1c2SSimon Glass      - looking in '/toolchains/sparc-elf/usr/bin'
261fc3fe1c2SSimon Glass   - scanning path '/toolchains/arm-2010q1'
262fc3fe1c2SSimon Glass      - looking in '/toolchains/arm-2010q1/.'
263fc3fe1c2SSimon Glass      - looking in '/toolchains/arm-2010q1/bin'
264fc3fe1c2SSimon Glass         - found '/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc'
265fc3fe1c2SSimon GlassTool chain test:  OK
266fc3fe1c2SSimon Glass      - looking in '/toolchains/arm-2010q1/usr/bin'
267fc3fe1c2SSimon Glass   - scanning path '/toolchains/from'
268fc3fe1c2SSimon Glass      - looking in '/toolchains/from/.'
269fc3fe1c2SSimon Glass      - looking in '/toolchains/from/bin'
270fc3fe1c2SSimon Glass      - looking in '/toolchains/from/usr/bin'
271fc3fe1c2SSimon Glass   - scanning path '/toolchains/sh4-gentoo-linux-gnu'
272fc3fe1c2SSimon Glass      - looking in '/toolchains/sh4-gentoo-linux-gnu/.'
273fc3fe1c2SSimon Glass      - looking in '/toolchains/sh4-gentoo-linux-gnu/bin'
274fc3fe1c2SSimon Glass         - found '/toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc'
275fc3fe1c2SSimon GlassTool chain test:  OK
276fc3fe1c2SSimon Glass      - looking in '/toolchains/sh4-gentoo-linux-gnu/usr/bin'
277fc3fe1c2SSimon Glass   - scanning path '/toolchains/avr32-linux'
278fc3fe1c2SSimon Glass      - looking in '/toolchains/avr32-linux/.'
279fc3fe1c2SSimon Glass      - looking in '/toolchains/avr32-linux/bin'
280fc3fe1c2SSimon Glass         - found '/toolchains/avr32-linux/bin/avr32-gcc'
281fc3fe1c2SSimon GlassTool chain test:  OK
282fc3fe1c2SSimon Glass      - looking in '/toolchains/avr32-linux/usr/bin'
283fc3fe1c2SSimon Glass   - scanning path '/toolchains/m68k-linux'
284fc3fe1c2SSimon Glass      - looking in '/toolchains/m68k-linux/.'
285fc3fe1c2SSimon Glass      - looking in '/toolchains/m68k-linux/bin'
286fc3fe1c2SSimon Glass         - found '/toolchains/m68k-linux/bin/m68k-linux-gcc'
287fc3fe1c2SSimon GlassTool chain test:  OK
288fc3fe1c2SSimon Glass      - looking in '/toolchains/m68k-linux/usr/bin'
289fc3fe1c2SSimon GlassList of available toolchains (17):
290fc3fe1c2SSimon Glassarm       : /toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
291fc3fe1c2SSimon Glassavr32     : /toolchains/avr32-linux/bin/avr32-gcc
292fc3fe1c2SSimon Glassbfin      : /toolchains/bfin-uclinux/bin/bfin-uclinux-gcc
293fc3fe1c2SSimon Glassc89       : /usr/bin/c89-gcc
294fc3fe1c2SSimon Glassc99       : /usr/bin/c99-gcc
295fc3fe1c2SSimon Glassi386      : /toolchains/i386-linux/bin/i386-linux-gcc
296fc3fe1c2SSimon Glassm68k      : /toolchains/m68k-linux/bin/m68k-linux-gcc
297fc3fe1c2SSimon Glassmb        : /toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc
298fc3fe1c2SSimon Glassmicroblaze: /toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc
299fc3fe1c2SSimon Glassmips      : /toolchains/mips-linux/bin/mips-linux-gcc
300fc3fe1c2SSimon Glassnds32le   : /toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc
301fc3fe1c2SSimon Glassnios2     : /toolchains/nios2/bin/nios2-linux-gcc
302fc3fe1c2SSimon Glasspowerpc   : /toolchains/powerpc-linux/bin/powerpc-linux-gcc
303fc3fe1c2SSimon Glasssandbox   : /usr/bin/gcc
304fc3fe1c2SSimon Glasssh4       : /toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc
305fc3fe1c2SSimon Glasssparc     : /toolchains/sparc-elf/bin/sparc-elf-gcc
306fc3fe1c2SSimon Glassx86_64    : /usr/bin/x86_64-linux-gnu-gcc
307fc3fe1c2SSimon Glass
308fc3fe1c2SSimon Glass
309fc3fe1c2SSimon GlassYou can see that everything is covered, even some strange ones that won't
310fc3fe1c2SSimon Glassbe used (c88 and c99). This is a feature.
311fc3fe1c2SSimon Glass
312fc3fe1c2SSimon Glass
313827e37b5SSimon Glass5. Install new toolchains if needed
314827e37b5SSimon Glass
315827e37b5SSimon GlassYou can download toolchains and update the [toolchain] section of the
316827e37b5SSimon Glasssettings file to find them.
317827e37b5SSimon Glass
318827e37b5SSimon GlassTo make this easier, buildman can automatically download and install
319827e37b5SSimon Glasstoolchains from kernel.org. First list the available architectures:
320827e37b5SSimon Glass
321827e37b5SSimon Glass$ ./tools/buildman/buildman sandbox --fetch-arch list
322827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/
323827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/
324827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/
325827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.2.4/
326827e37b5SSimon GlassAvailable architectures: alpha am33_2.0 arm avr32 bfin cris crisv32 frv h8300
327827e37b5SSimon Glasshppa hppa64 i386 ia64 m32r m68k mips mips64 or32 powerpc powerpc64 s390x sh4
328827e37b5SSimon Glasssparc sparc64 tilegx x86_64 xtensa
329827e37b5SSimon Glass
330827e37b5SSimon GlassThen pick one and download it:
331827e37b5SSimon Glass
332827e37b5SSimon Glass$ ./tools/buildman/buildman sandbox --fetch-arch or32
333827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/
334827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/
335827e37b5SSimon GlassChecking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/
336827e37b5SSimon GlassDownloading: 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
337827e37b5SSimon GlassUnpacking to: /home/sjg/.buildman-toolchains
338827e37b5SSimon GlassTesting
339827e37b5SSimon Glass      - looking in '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/.'
340827e37b5SSimon Glass      - looking in '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/bin'
341827e37b5SSimon Glass         - found '/home/sjg/.buildman-toolchains/gcc-4.5.1-nolibc/or32-linux/bin/or32-linux-gcc'
342827e37b5SSimon GlassTool chain test:  OK
343827e37b5SSimon Glass
344827e37b5SSimon GlassBuildman should now be set up to use your new toolchain.
345827e37b5SSimon Glass
346827e37b5SSimon GlassAt the time of writing, U-Boot has these architectures:
347827e37b5SSimon Glass
348827e37b5SSimon Glass   arc, arm, avr32, blackfin, m68k, microblaze, mips, nds32, nios2, openrisc
349827e37b5SSimon Glass   powerpc, sandbox, sh, sparc, x86
350827e37b5SSimon Glass
351827e37b5SSimon GlassOf these, only arc, microblaze and nds32 are not available at kernel.org..
352827e37b5SSimon Glass
353827e37b5SSimon Glass
354fc3fe1c2SSimon GlassHow to run it
355fc3fe1c2SSimon Glass=============
356fc3fe1c2SSimon Glass
357fc3fe1c2SSimon GlassFirst do a dry run using the -n flag: (replace <branch> with a real, local
358fc3fe1c2SSimon Glassbranch with a valid upstream)
359fc3fe1c2SSimon Glass
360fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b <branch> -n
361fc3fe1c2SSimon Glass
362fc3fe1c2SSimon GlassIf it can't detect the upstream branch, try checking out the branch, and
3632a9e2c6aSSimon Glassdoing something like 'git branch --set-upstream-to upstream/master'
3642a9e2c6aSSimon Glassor something similar. Buildman will try to guess a suitable upstream branch
3652a9e2c6aSSimon Glassif it can't find one (you will see a message like" Guessing upstream as ...).
366fc3fe1c2SSimon Glass
367cec83c3eSSimon GlassAs an example:
368fc3fe1c2SSimon Glass
369fc3fe1c2SSimon GlassDry run, so not doing much. But I would do this:
370fc3fe1c2SSimon Glass
371fc3fe1c2SSimon GlassBuilding 18 commits for 1059 boards (4 threads, 1 job per thread)
372fc3fe1c2SSimon GlassBuild directory: ../lcd9b
373fc3fe1c2SSimon Glass    5bb3505 Merge branch 'master' of git://git.denx.de/u-boot-arm
374fc3fe1c2SSimon Glass    c18f1b4 tegra: Use const for pinmux_config_pingroup/table()
375fc3fe1c2SSimon Glass    2f043ae tegra: Add display support to funcmux
376fc3fe1c2SSimon Glass    e349900 tegra: fdt: Add pwm binding and node
377fc3fe1c2SSimon Glass    424a5f0 tegra: fdt: Add LCD definitions for Tegra
378fc3fe1c2SSimon Glass    0636ccf tegra: Add support for PWM
379fc3fe1c2SSimon Glass    a994fe7 tegra: Add SOC support for display/lcd
380fc3fe1c2SSimon Glass    fcd7350 tegra: Add LCD driver
381fc3fe1c2SSimon Glass    4d46e9d tegra: Add LCD support to Nvidia boards
382fc3fe1c2SSimon Glass    991bd48 arm: Add control over cachability of memory regions
383fc3fe1c2SSimon Glass    54e8019 lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment
384fc3fe1c2SSimon Glass    d92aff7 lcd: Add support for flushing LCD fb from dcache after update
385fc3fe1c2SSimon Glass    dbd0677 tegra: Align LCD frame buffer to section boundary
386fc3fe1c2SSimon Glass    0cff9b8 tegra: Support control of cache settings for LCD
387fc3fe1c2SSimon Glass    9c56900 tegra: fdt: Add LCD definitions for Seaboard
388fc3fe1c2SSimon Glass    5cc29db lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
389fc3fe1c2SSimon Glass    cac5a23 tegra: Enable display/lcd support on Seaboard
390fc3fe1c2SSimon Glass    49ff541 wip
391fc3fe1c2SSimon Glass
392fc3fe1c2SSimon GlassTotal boards to build for each commit: 1059
393fc3fe1c2SSimon Glass
394fc3fe1c2SSimon GlassThis shows that it will build all 1059 boards, using 4 threads (because
395fc3fe1c2SSimon Glasswe have a 4-core CPU). Each thread will run with -j1, meaning that each
396fc3fe1c2SSimon Glassmake job will use a single CPU. The list of commits to be built helps you
397fc3fe1c2SSimon Glassconfirm that things look about right. Notice that buildman has chosen a
398fc3fe1c2SSimon Glass'base' directory for you, immediately above your source tree.
399fc3fe1c2SSimon Glass
400fc3fe1c2SSimon GlassBuildman works entirely inside the base directory, here ../lcd9b,
401fc3fe1c2SSimon Glasscreating a working directory for each thread, and creating output
402fc3fe1c2SSimon Glassdirectories for each commit and board.
403fc3fe1c2SSimon Glass
404fc3fe1c2SSimon Glass
405fc3fe1c2SSimon GlassSuggested Workflow
406fc3fe1c2SSimon Glass==================
407fc3fe1c2SSimon Glass
408fc3fe1c2SSimon GlassTo run the build for real, take off the -n:
409fc3fe1c2SSimon Glass
410fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b <branch>
411fc3fe1c2SSimon Glass
412fc3fe1c2SSimon GlassBuildman will set up some working directories, and get started. After a
413fc3fe1c2SSimon Glassminute or so it will settle down to a steady pace, with a display like this:
414fc3fe1c2SSimon Glass
415fc3fe1c2SSimon GlassBuilding 18 commits for 1059 boards (4 threads, 1 job per thread)
416fc3fe1c2SSimon Glass  528   36  124 /19062  1:13:30  : SIMPC8313_SP
417fc3fe1c2SSimon Glass
418fc3fe1c2SSimon GlassThis means that it is building 19062 board/commit combinations. So far it
419cec83c3eSSimon Glasshas managed to successfully build 528. Another 36 have built with warnings,
420fc3fe1c2SSimon Glassand 124 more didn't build at all. Buildman expects to complete the process
421fc3fe1c2SSimon Glassin an hour and 15 minutes. Use this time to buy a faster computer.
422fc3fe1c2SSimon Glass
423fc3fe1c2SSimon Glass
424fc3fe1c2SSimon GlassTo find out how the build went, ask for a summary with -s. You can do this
4253e1ded1fSDirk Behmeeither before the build completes (presumably in another terminal) or
426fc3fe1c2SSimon Glassafterwards. Let's work through an example of how this is used:
427fc3fe1c2SSimon Glass
428fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b lcd9b -s
429fc3fe1c2SSimon Glass...
430fc3fe1c2SSimon Glass01: Merge branch 'master' of git://git.denx.de/u-boot-arm
431fc3fe1c2SSimon Glass   powerpc:   + galaxy5200_LOWBOOT
432fc3fe1c2SSimon Glass02: tegra: Use const for pinmux_config_pingroup/table()
433fc3fe1c2SSimon Glass03: tegra: Add display support to funcmux
434fc3fe1c2SSimon Glass04: tegra: fdt: Add pwm binding and node
435fc3fe1c2SSimon Glass05: tegra: fdt: Add LCD definitions for Tegra
436fc3fe1c2SSimon Glass06: tegra: Add support for PWM
437fc3fe1c2SSimon Glass07: tegra: Add SOC support for display/lcd
438fc3fe1c2SSimon Glass08: tegra: Add LCD driver
439fc3fe1c2SSimon Glass09: tegra: Add LCD support to Nvidia boards
440fc3fe1c2SSimon Glass10: arm: Add control over cachability of memory regions
441fc3fe1c2SSimon Glass11: lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment
442fc3fe1c2SSimon Glass12: lcd: Add support for flushing LCD fb from dcache after update
443fc3fe1c2SSimon Glass       arm:   + lubbock
444fc3fe1c2SSimon Glass13: tegra: Align LCD frame buffer to section boundary
445fc3fe1c2SSimon Glass14: tegra: Support control of cache settings for LCD
446fc3fe1c2SSimon Glass15: tegra: fdt: Add LCD definitions for Seaboard
447fc3fe1c2SSimon Glass16: lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
448fc3fe1c2SSimon Glass17: tegra: Enable display/lcd support on Seaboard
449fc3fe1c2SSimon Glass18: wip
450fc3fe1c2SSimon Glass
451fc3fe1c2SSimon GlassThis shows which commits have succeeded and which have failed. In this case
452fc3fe1c2SSimon Glassthe build is still in progress so many boards are not built yet (use -u to
453fc3fe1c2SSimon Glasssee which ones). But still we can see a few failures. The galaxy5200_LOWBOOT
454fc3fe1c2SSimon Glassnever builds correctly. This could be a problem with our toolchain, or it
455fc3fe1c2SSimon Glasscould be a bug in the upstream. The good news is that we probably don't need
456fc3fe1c2SSimon Glassto blame our commits. The bad news is it isn't tested on that board.
457fc3fe1c2SSimon Glass
458fc3fe1c2SSimon GlassCommit 12 broke lubbock. That's what the '+ lubbock' means. The failure
459fc3fe1c2SSimon Glassis never fixed by a later commit, or you would see lubbock again, in green,
460fc3fe1c2SSimon Glasswithout the +.
461fc3fe1c2SSimon Glass
462fc3fe1c2SSimon GlassTo see the actual error:
463fc3fe1c2SSimon Glass
464fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b <branch> -se lubbock
465fc3fe1c2SSimon Glass...
466fc3fe1c2SSimon Glass12: lcd: Add support for flushing LCD fb from dcache after update
467fc3fe1c2SSimon Glass       arm:   + lubbock
468fc3fe1c2SSimon Glass+common/libcommon.o: In function `lcd_sync':
469fc3fe1c2SSimon Glass+/u-boot/lcd9b/.bm-work/00/common/lcd.c:120: undefined reference to `flush_dcache_range'
470fc3fe1c2SSimon Glass+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
471fc3fe1c2SSimon Glass+make: *** [/u-boot/lcd9b/.bm-work/00/build/u-boot] Error 139
472fc3fe1c2SSimon Glass13: tegra: Align LCD frame buffer to section boundary
473fc3fe1c2SSimon Glass14: tegra: Support control of cache settings for LCD
474fc3fe1c2SSimon Glass15: tegra: fdt: Add LCD definitions for Seaboard
475fc3fe1c2SSimon Glass16: lcd: Add CONFIG_CONSOLE_SCROLL_LINES option to speed console
476fc3fe1c2SSimon Glass-/u-boot/lcd9b/.bm-work/00/common/lcd.c:120: undefined reference to `flush_dcache_range'
477fc3fe1c2SSimon Glass+/u-boot/lcd9b/.bm-work/00/common/lcd.c:125: undefined reference to `flush_dcache_range'
478fc3fe1c2SSimon Glass17: tegra: Enable display/lcd support on Seaboard
479fc3fe1c2SSimon Glass18: wip
480fc3fe1c2SSimon Glass
481fc3fe1c2SSimon GlassSo the problem is in lcd.c, due to missing cache operations. This information
482fc3fe1c2SSimon Glassshould be enough to work out what that commit is doing to break these
483fc3fe1c2SSimon Glassboards. (In this case pxa did not have cache operations defined).
484fc3fe1c2SSimon Glass
485fc3fe1c2SSimon GlassIf you see error lines marked with - that means that the errors were fixed
486fc3fe1c2SSimon Glassby that commit. Sometimes commits can be in the wrong order, so that a
487fc3fe1c2SSimon Glassbreakage is introduced for a few commits and fixed by later commits. This
488fc3fe1c2SSimon Glassshows up clearly with buildman. You can then reorder the commits and try
489fc3fe1c2SSimon Glassagain.
490fc3fe1c2SSimon Glass
491fc3fe1c2SSimon GlassAt commit 16, the error moves - you can see that the old error at line 120
492fc3fe1c2SSimon Glassis fixed, but there is a new one at line 126. This is probably only because
4933e1ded1fSDirk Behmewe added some code and moved the broken line further down the file.
494fc3fe1c2SSimon Glass
495fc3fe1c2SSimon GlassIf many boards have the same error, then -e will display the error only
496ed966657SSimon Glassonce. This makes the output as concise as possible. To see which boards have
497ed966657SSimon Glasseach error, use -l.
498fc3fe1c2SSimon Glass
499e30965dbSSimon GlassBuildman tries to distinguish warnings from errors, and shows warning lines
500e30965dbSSimon Glassseparately with a 'w' prefix.
501e30965dbSSimon Glass
502fc3fe1c2SSimon GlassThe full build output in this case is available in:
503fc3fe1c2SSimon Glass
504fc3fe1c2SSimon Glass../lcd9b/12_of_18_gd92aff7_lcd--Add-support-for/lubbock/
505fc3fe1c2SSimon Glass
506fc3fe1c2SSimon Glass   done: Indicates the build was done, and holds the return code from make.
507fc3fe1c2SSimon Glass         This is 0 for a good build, typically 2 for a failure.
508fc3fe1c2SSimon Glass
509fc3fe1c2SSimon Glass   err:  Output from stderr, if any. Errors and warnings appear here.
510fc3fe1c2SSimon Glass
511fc3fe1c2SSimon Glass   log:  Output from stdout. Normally there isn't any since buildman runs
512fc3fe1c2SSimon Glass         in silent mode for now.
513fc3fe1c2SSimon Glass
514fc3fe1c2SSimon Glass   toolchain: Shows information about the toolchain used for the build.
515fc3fe1c2SSimon Glass
516fc3fe1c2SSimon Glass   sizes: Shows image size information.
517fc3fe1c2SSimon Glass
518fc3fe1c2SSimon GlassIt is possible to get the build output there also. Use the -k option for
519fc3fe1c2SSimon Glassthis. In that case you will also see some output files, like:
520fc3fe1c2SSimon Glass
521fc3fe1c2SSimon Glass   System.map  toolchain  u-boot  u-boot.bin  u-boot.map  autoconf.mk
522fc3fe1c2SSimon Glass   (also SPL versions u-boot-spl and u-boot-spl.bin if available)
523fc3fe1c2SSimon Glass
524fc3fe1c2SSimon Glass
525fc3fe1c2SSimon GlassChecking Image Sizes
526fc3fe1c2SSimon Glass====================
527fc3fe1c2SSimon Glass
528fc3fe1c2SSimon GlassA key requirement for U-Boot is that you keep code/data size to a minimum.
529fc3fe1c2SSimon GlassWhere a new feature increases this noticeably it should normally be put
530fc3fe1c2SSimon Glassbehind a CONFIG flag so that boards can leave it off and keep the image
531fc3fe1c2SSimon Glasssize more or less the same with each new release.
532fc3fe1c2SSimon Glass
533fc3fe1c2SSimon GlassTo check the impact of your commits on image size, use -S. For example:
534fc3fe1c2SSimon Glass
535fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b us-x86 -sS
536fc3fe1c2SSimon GlassSummary of 10 commits for 1066 boards (4 threads, 1 job per thread)
537fc3fe1c2SSimon Glass01: MAKEALL: add support for per architecture toolchains
538fc3fe1c2SSimon Glass02: x86: Add function to get top of usable ram
539fc3fe1c2SSimon Glass       x86: (for 1/3 boards)  text -272.0  rodata +41.0
540fc3fe1c2SSimon Glass03: x86: Add basic cache operations
541fc3fe1c2SSimon Glass04: x86: Permit bootstage and timer data to be used prior to relocation
542fc3fe1c2SSimon Glass       x86: (for 1/3 boards)  data +16.0
543fc3fe1c2SSimon Glass05: x86: Add an __end symbol to signal the end of the U-Boot binary
544fc3fe1c2SSimon Glass       x86: (for 1/3 boards)  text +76.0
545fc3fe1c2SSimon Glass06: x86: Rearrange the output input to remove BSS
546fc3fe1c2SSimon Glass       x86: (for 1/3 boards)  bss -2140.0
547fc3fe1c2SSimon Glass07: x86: Support relocation of FDT on start-up
548fc3fe1c2SSimon Glass       x86: +   coreboot-x86
549fc3fe1c2SSimon Glass08: x86: Add error checking to x86 relocation code
550fc3fe1c2SSimon Glass09: x86: Adjust link device tree include file
551fc3fe1c2SSimon Glass10: x86: Enable CONFIG_OF_CONTROL on coreboot
552fc3fe1c2SSimon Glass
553fc3fe1c2SSimon Glass
554fc3fe1c2SSimon GlassYou can see that image size only changed on x86, which is good because this
555fc3fe1c2SSimon Glassseries is not supposed to change any other board. From commit 7 onwards the
556fc3fe1c2SSimon Glassbuild fails so we don't get code size numbers. The numbers are fractional
557fc3fe1c2SSimon Glassbecause they are an average of all boards for that architecture. The
558fc3fe1c2SSimon Glassintention is to allow you to quickly find image size problems introduced by
559fc3fe1c2SSimon Glassyour commits.
560fc3fe1c2SSimon Glass
561fc3fe1c2SSimon GlassNote that the 'text' region and 'rodata' are split out. You should add the
562fc3fe1c2SSimon Glasstwo together to get the total read-only size (reported as the first column
563fc3fe1c2SSimon Glassin the output from binutil's 'size' utility).
564fc3fe1c2SSimon Glass
565fc3fe1c2SSimon GlassA useful option is --step which lets you skip some commits. For example
566fc3fe1c2SSimon Glass--step 2 will show the image sizes for only every 2nd commit (so it will
567fc3fe1c2SSimon Glasscompare the image sizes of the 1st, 3rd, 5th... commits). You can also use
568fc3fe1c2SSimon Glass--step 0 which will compare only the first and last commits. This is useful
569fc3fe1c2SSimon Glassfor an overview of how your entire series affects code size.
570fc3fe1c2SSimon Glass
571fc3fe1c2SSimon GlassYou can also use -d to see a detailed size breakdown for each board. This
572fc3fe1c2SSimon Glasslist is sorted in order from largest growth to largest reduction.
573fc3fe1c2SSimon Glass
574fc3fe1c2SSimon GlassIt is possible to go a little further with the -B option (--bloat). This
575cec83c3eSSimon Glassshows where U-Boot has bloated, breaking the size change down to the function
576fc3fe1c2SSimon Glasslevel. Example output is below:
577fc3fe1c2SSimon Glass
578fc3fe1c2SSimon Glass$ ./tools/buildman/buildman -b us-mem4 -sSdB
579fc3fe1c2SSimon Glass...
580fc3fe1c2SSimon Glass19: Roll crc32 into hash infrastructure
581fc3fe1c2SSimon Glass       arm: (for 10/10 boards)  all -143.4  bss +1.2  data -4.8  rodata -48.2 text -91.6
582fc3fe1c2SSimon Glass            paz00          :  all +23  bss -4  rodata -29  text +56
583fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 3/-2 bytes: 168/-104 (64)
584fc3fe1c2SSimon Glass                 function                                   old     new   delta
585fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
586fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
587fc3fe1c2SSimon Glass                 ext4fs_read_file                           540     568     +28
588fc3fe1c2SSimon Glass                 insert_var_value_sub                       688     692      +4
589fc3fe1c2SSimon Glass                 run_list_real                             1996    1992      -4
590fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
591fc3fe1c2SSimon Glass            trimslice      :  all -9  bss +16  rodata -29  text +4
592fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
593fc3fe1c2SSimon Glass                 function                                   old     new   delta
594fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
595fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
596fc3fe1c2SSimon Glass                 ext4fs_iterate_dir                         672     668      -4
597fc3fe1c2SSimon Glass                 ext4fs_read_file                           568     548     -20
598fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
599fc3fe1c2SSimon Glass            whistler       :  all -9  bss +16  rodata -29  text +4
600fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
601fc3fe1c2SSimon Glass                 function                                   old     new   delta
602fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
603fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
604fc3fe1c2SSimon Glass                 ext4fs_iterate_dir                         672     668      -4
605fc3fe1c2SSimon Glass                 ext4fs_read_file                           568     548     -20
606fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
607fc3fe1c2SSimon Glass            seaboard       :  all -9  bss -28  rodata -29  text +48
608fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 3/-2 bytes: 160/-104 (56)
609fc3fe1c2SSimon Glass                 function                                   old     new   delta
610fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
611fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
612fc3fe1c2SSimon Glass                 ext4fs_read_file                           548     568     +20
613fc3fe1c2SSimon Glass                 run_list_real                             1996    2000      +4
614fc3fe1c2SSimon Glass                 do_nandboot                                760     756      -4
615fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
616*e57c6e5bSMarcel Ziswiler            colibri_t20    :  all -9  rodata -29  text +20
617fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 2/-3 bytes: 140/-112 (28)
618fc3fe1c2SSimon Glass                 function                                   old     new   delta
619fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
620fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
621fc3fe1c2SSimon Glass                 read_abs_bbt                               204     208      +4
622fc3fe1c2SSimon Glass                 do_nandboot                                760     756      -4
623fc3fe1c2SSimon Glass                 ext4fs_read_file                           576     568      -8
624fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
625fc3fe1c2SSimon Glass            ventana        :  all -37  bss -12  rodata -29  text +4
626fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 1/-3 bytes: 136/-124 (12)
627fc3fe1c2SSimon Glass                 function                                   old     new   delta
628fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
629fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
630fc3fe1c2SSimon Glass                 ext4fs_iterate_dir                         672     668      -4
631fc3fe1c2SSimon Glass                 ext4fs_read_file                           568     548     -20
632fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
633fc3fe1c2SSimon Glass            harmony        :  all -37  bss -16  rodata -29  text +8
634fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 2/-3 bytes: 140/-124 (16)
635fc3fe1c2SSimon Glass                 function                                   old     new   delta
636fc3fe1c2SSimon Glass                 hash_command                                80     160     +80
637fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
638fc3fe1c2SSimon Glass                 nand_write_oob_syndrome                    428     432      +4
639fc3fe1c2SSimon Glass                 ext4fs_iterate_dir                         672     668      -4
640fc3fe1c2SSimon Glass                 ext4fs_read_file                           568     548     -20
641fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
642fc3fe1c2SSimon Glass            medcom-wide    :  all -417  bss +28  data -16  rodata -93  text -336
643fc3fe1c2SSimon Glass               u-boot: add: 1/-1, grow: 1/-2 bytes: 88/-376 (-288)
644fc3fe1c2SSimon Glass                 function                                   old     new   delta
645fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
646fc3fe1c2SSimon Glass                 do_fat_read_at                            2872    2904     +32
647fc3fe1c2SSimon Glass                 hash_algo                                   16       -     -16
648fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
649fc3fe1c2SSimon Glass                 hash_command                               420     160    -260
650fc3fe1c2SSimon Glass            tec            :  all -449  bss -4  data -16  rodata -93  text -336
651fc3fe1c2SSimon Glass               u-boot: add: 1/-1, grow: 1/-2 bytes: 88/-376 (-288)
652fc3fe1c2SSimon Glass                 function                                   old     new   delta
653fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
654fc3fe1c2SSimon Glass                 do_fat_read_at                            2872    2904     +32
655fc3fe1c2SSimon Glass                 hash_algo                                   16       -     -16
656fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
657fc3fe1c2SSimon Glass                 hash_command                               420     160    -260
658fc3fe1c2SSimon Glass            plutux         :  all -481  bss +16  data -16  rodata -93  text -388
659fc3fe1c2SSimon Glass               u-boot: add: 1/-1, grow: 1/-3 bytes: 68/-408 (-340)
660fc3fe1c2SSimon Glass                 function                                   old     new   delta
661fc3fe1c2SSimon Glass                 crc32_wd_buf                                 -      56     +56
662fc3fe1c2SSimon Glass                 do_load_serial_bin                        1688    1700     +12
663fc3fe1c2SSimon Glass                 hash_algo                                   16       -     -16
664fc3fe1c2SSimon Glass                 do_fat_read_at                            2904    2872     -32
665fc3fe1c2SSimon Glass                 do_mem_crc                                 168      68    -100
666fc3fe1c2SSimon Glass                 hash_command                               420     160    -260
667fc3fe1c2SSimon Glass   powerpc: (for 5/5 boards)  all +37.4  data -3.2  rodata -41.8  text +82.4
668fc3fe1c2SSimon Glass            MPC8610HPCD    :  all +55  rodata -29  text +84
669fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
670fc3fe1c2SSimon Glass                 function                                   old     new   delta
671fc3fe1c2SSimon Glass                 hash_command                                 -     176    +176
672fc3fe1c2SSimon Glass                 do_mem_crc                                 184      88     -96
673fc3fe1c2SSimon Glass            MPC8641HPCN    :  all +55  rodata -29  text +84
674fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
675fc3fe1c2SSimon Glass                 function                                   old     new   delta
676fc3fe1c2SSimon Glass                 hash_command                                 -     176    +176
677fc3fe1c2SSimon Glass                 do_mem_crc                                 184      88     -96
678fc3fe1c2SSimon Glass            MPC8641HPCN_36BIT:  all +55  rodata -29  text +84
679fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
680fc3fe1c2SSimon Glass                 function                                   old     new   delta
681fc3fe1c2SSimon Glass                 hash_command                                 -     176    +176
682fc3fe1c2SSimon Glass                 do_mem_crc                                 184      88     -96
683fc3fe1c2SSimon Glass            sbc8641d       :  all +55  rodata -29  text +84
684fc3fe1c2SSimon Glass               u-boot: add: 1/0, grow: 0/-1 bytes: 176/-96 (80)
685fc3fe1c2SSimon Glass                 function                                   old     new   delta
686fc3fe1c2SSimon Glass                 hash_command                                 -     176    +176
687fc3fe1c2SSimon Glass                 do_mem_crc                                 184      88     -96
688fc3fe1c2SSimon Glass            xpedite517x    :  all -33  data -16  rodata -93  text +76
689fc3fe1c2SSimon Glass               u-boot: add: 1/-1, grow: 0/-1 bytes: 176/-112 (64)
690fc3fe1c2SSimon Glass                 function                                   old     new   delta
691fc3fe1c2SSimon Glass                 hash_command                                 -     176    +176
692fc3fe1c2SSimon Glass                 hash_algo                                   16       -     -16
693fc3fe1c2SSimon Glass                 do_mem_crc                                 184      88     -96
694fc3fe1c2SSimon Glass...
695fc3fe1c2SSimon Glass
696fc3fe1c2SSimon Glass
697fc3fe1c2SSimon GlassThis shows that commit 19 has increased text size for arm (although only one
698fc3fe1c2SSimon Glassboard was built) and by 96 bytes for powerpc. This increase was offset in both
699fc3fe1c2SSimon Glasscases by reductions in rodata and data/bss.
700fc3fe1c2SSimon Glass
7013e1ded1fSDirk BehmeShown below the summary lines are the sizes for each board. Below each board
7023e1ded1fSDirk Behmeare the sizes for each function. This information starts with:
703fc3fe1c2SSimon Glass
704fc3fe1c2SSimon Glass   add - number of functions added / removed
705fc3fe1c2SSimon Glass   grow - number of functions which grew / shrunk
706fc3fe1c2SSimon Glass   bytes - number of bytes of code added to / removed from all functions,
707fc3fe1c2SSimon Glass            plus the total byte change in brackets
708fc3fe1c2SSimon Glass
709fc3fe1c2SSimon GlassThe change seems to be that hash_command() has increased by more than the
710fc3fe1c2SSimon Glassdo_mem_crc() function has decreased. The function sizes typically add up to
711fc3fe1c2SSimon Glassroughly the text area size, but note that every read-only section except
712fc3fe1c2SSimon Glassrodata is included in 'text', so the function total does not exactly
713fc3fe1c2SSimon Glasscorrespond.
714fc3fe1c2SSimon Glass
715fc3fe1c2SSimon GlassIt is common when refactoring code for the rodata to decrease as the text size
716fc3fe1c2SSimon Glassincreases, and vice versa.
717fc3fe1c2SSimon Glass
718fc3fe1c2SSimon Glass
71962005342SSimon GlassThe .buildman file
72062005342SSimon Glass==================
7214281ad8eSSimon Glass
72262005342SSimon GlassThe .buildman file provides information about the available toolchains and
72362005342SSimon Glassalso allows build flags to be passed to 'make'. It consists of several
72462005342SSimon Glasssections, with the section name in square brackets. Within each section are
72562005342SSimon Glassa set of (tag, value) pairs.
72662005342SSimon Glass
72762005342SSimon Glass'[toolchain]' section
72862005342SSimon Glass
72962005342SSimon Glass    This lists the available toolchains. The tag here doesn't matter, but
73062005342SSimon Glass    make sure it is unique. The value is the path to the toolchain. Buildman
73162005342SSimon Glass    will look in that path for a file ending in 'gcc'. It will then execute
73262005342SSimon Glass    it to check that it is a C compiler, passing only the --version flag to
73362005342SSimon Glass    it. If the return code is 0, buildman assumes that it is a valid C
73462005342SSimon Glass    compiler. It uses the first part of the name as the architecture and
73562005342SSimon Glass    strips off the last part when setting the CROSS_COMPILE environment
73662005342SSimon Glass    variable (parts are delimited with a hyphen).
73762005342SSimon Glass
73862005342SSimon Glass    For example powerpc-linux-gcc will be noted as a toolchain for 'powerpc'
73962005342SSimon Glass    and CROSS_COMPILE will be set to powerpc-linux- when using it.
74062005342SSimon Glass
74162005342SSimon Glass'[toolchain-alias]' section
74262005342SSimon Glass
74362005342SSimon Glass    This converts toolchain architecture names to U-Boot names. For example,
74462005342SSimon Glass    if an x86 toolchains is called i386-linux-gcc it will not normally be
7459b83bfdcSSimon Glass    used for architecture 'x86'. Adding 'x86: i386 x86_64' to this section
7469b83bfdcSSimon Glass    will tell buildman that the i386 and x86_64 toolchains can be used for
7479b83bfdcSSimon Glass    the x86 architecture.
74862005342SSimon Glass
74962005342SSimon Glass'[make-flags]' section
75062005342SSimon Glass
75162005342SSimon Glass    U-Boot's build system supports a few flags (such as BUILD_TAG) which
75262005342SSimon Glass    affect the build product. These flags can be specified in the buildman
75362005342SSimon Glass    settings file. They can also be useful when building U-Boot against other
75462005342SSimon Glass    open source software.
7554281ad8eSSimon Glass
7564281ad8eSSimon Glass    [make-flags]
7574281ad8eSSimon Glass    at91-boards=ENABLE_AT91_TEST=1
7584281ad8eSSimon Glass    snapper9260=${at91-boards} BUILD_TAG=442
7594281ad8eSSimon Glass    snapper9g45=${at91-boards} BUILD_TAG=443
7604281ad8eSSimon Glass
7614281ad8eSSimon Glass    This will use 'make ENABLE_AT91_TEST=1 BUILD_TAG=442' for snapper9260
76261242ac5SAndreas Bießmann    and 'make ENABLE_AT91_TEST=1 BUILD_TAG=443' for snapper9g45. A special
76362005342SSimon Glass    variable ${target} is available to access the target name (snapper9260
76462005342SSimon Glass    and snapper9g20 in this case). Variables are resolved recursively. Note
76562005342SSimon Glass    that variables can only contain the characters A-Z, a-z, 0-9, hyphen (-)
76662005342SSimon Glass    and underscore (_).
7674281ad8eSSimon Glass
7684281ad8eSSimon Glass    It is expected that any variables added are dealt with in U-Boot's
7694281ad8eSSimon Glass    config.mk file and documented in the README.
7704281ad8eSSimon Glass
77162005342SSimon Glass    Note that you can pass ad-hoc options to the build using environment
77262005342SSimon Glass    variables, for example:
77362005342SSimon Glass
77462005342SSimon Glass       SOME_OPTION=1234 ./tools/buildman/buildman my_board
77562005342SSimon Glass
7764281ad8eSSimon Glass
777e5a0e5d8SSimon GlassQuick Sanity Check
778e5a0e5d8SSimon Glass==================
779e5a0e5d8SSimon Glass
780e5a0e5d8SSimon GlassIf you have made changes and want to do a quick sanity check of the
7811d8104feSSimon Glasscurrently checked-out source, run buildman without the -b flag. This will
7821d8104feSSimon Glassbuild the selected boards and display build status as it runs (i.e. -v is
7831d8104feSSimon Glassenabled automatically). Use -e to see errors/warnings as well.
784e5a0e5d8SSimon Glass
785e5a0e5d8SSimon Glass
7865abab20dSSimon GlassBuilding Ranges
7875abab20dSSimon Glass===============
7885abab20dSSimon Glass
7895abab20dSSimon GlassYou can build a range of commits by specifying a range instead of a branch
7905abab20dSSimon Glasswhen using the -b flag. For example:
7915abab20dSSimon Glass
7925abab20dSSimon Glass    upstream/master..us-buildman
7935abab20dSSimon Glass
7945abab20dSSimon Glasswill build commits in us-buildman that are not in upstream/master.
7955abab20dSSimon Glass
7965abab20dSSimon Glass
797fc3fe1c2SSimon GlassOther options
798fc3fe1c2SSimon Glass=============
799fc3fe1c2SSimon Glass
800fc3fe1c2SSimon GlassBuildman has various other command line options. Try --help to see them.
801fc3fe1c2SSimon Glass
8022c3deb97SSimon GlassWhen doing builds, Buildman's return code will reflect the overall result:
8032c3deb97SSimon Glass
8042c3deb97SSimon Glass    0 (success)     No errors or warnings found
8052c3deb97SSimon Glass    128             Errors found
8062c3deb97SSimon Glass    129             Warnings found
8072c3deb97SSimon Glass
808fc3fe1c2SSimon Glass
8096eede34cSSimon GlassHow to change from MAKEALL
8106eede34cSSimon Glass==========================
8116eede34cSSimon Glass
8126eede34cSSimon GlassBuildman includes most of the features of MAKEALL and is generally faster
8136eede34cSSimon Glassand easier to use. In particular it builds entire branches: if a particular
8146eede34cSSimon Glasscommit introduces an error in a particular board, buildman can easily show
8156eede34cSSimon Glassyou this, even if a later commit fixes that error.
8166eede34cSSimon Glass
8176eede34cSSimon GlassThe reasons to deprecate MAKEALL are:
8186eede34cSSimon Glass- We don't want to maintain two build systems
8196eede34cSSimon Glass- Buildman is typically faster
8206eede34cSSimon Glass- Buildman has a lot more features
8216eede34cSSimon Glass
8226eede34cSSimon GlassBut still, many people will be sad to lose MAKEALL. If you are used to
8236eede34cSSimon GlassMAKEALL, here are a few pointers.
8246eede34cSSimon Glass
8256eede34cSSimon GlassFirst you need to set up your tool chains - see the 'Setting up' section
8266eede34cSSimon Glassfor details. Once you have your required toolchain(s) detected then you are
8276eede34cSSimon Glassready to go.
8286eede34cSSimon Glass
829e5a0e5d8SSimon GlassTo build the current source tree, run buildman without a -b flag:
830e5a0e5d8SSimon Glass
831e5a0e5d8SSimon Glass   ./tools/buildman/buildman <list of things to build>
832e5a0e5d8SSimon Glass
833e5a0e5d8SSimon GlassThis will build the current source tree for the given boards and display
834e5a0e5d8SSimon Glassthe results and errors.
835e5a0e5d8SSimon Glass
836e5a0e5d8SSimon GlassHowever buildman usually works on entire branches, and for that you must
837e5a0e5d8SSimon Glassspecify a board flag:
8386eede34cSSimon Glass
8396eede34cSSimon Glass   ./tools/buildman/buildman -b <branch_name> <list of things to build>
8406eede34cSSimon Glass
8416eede34cSSimon Glassfollowed by (afterwards, or perhaps concurrently in another terminal):
8426eede34cSSimon Glass
8436eede34cSSimon Glass   ./tools/buildman/buildman -b <branch_name> -s <list of things to build>
8446eede34cSSimon Glass
8456eede34cSSimon Glassto see the results of the build. Rather than showing you all the output,
8466eede34cSSimon Glassbuildman just shows a summary, with red indicating that a commit introduced
8476eede34cSSimon Glassan error and green indicating that a commit fixed an error. Use the -e
848ed966657SSimon Glassflag to see the full errors and -l to see which boards caused which errors.
8496eede34cSSimon Glass
850e5a0e5d8SSimon GlassIf you really want to see build results as they happen, use -v when doing a
8511d8104feSSimon Glassbuild (and -e to see the errors/warnings too).
852e5a0e5d8SSimon Glass
8536eede34cSSimon GlassYou don't need to stick around on that branch while buildman is running. It
8546eede34cSSimon Glasschecks out its own copy of the source code, so you can change branches,
8556eede34cSSimon Glassadd commits, etc. without affecting the build in progress.
8566eede34cSSimon Glass
8576eede34cSSimon GlassThe <list of things to build> can include board names, architectures or the
8586eede34cSSimon Glasslike. There are no flags to disambiguate since ambiguities are rare. Using
8596eede34cSSimon Glassthe examples from MAKEALL:
8606eede34cSSimon Glass
8616eede34cSSimon GlassExamples:
8626eede34cSSimon Glass  - build all Power Architecture boards:
8636eede34cSSimon Glass      MAKEALL -a powerpc
8646eede34cSSimon Glass      MAKEALL --arch powerpc
8656eede34cSSimon Glass      MAKEALL powerpc
8666eede34cSSimon Glass          ** buildman -b <branch> powerpc
8676eede34cSSimon Glass  - build all PowerPC boards manufactured by vendor "esd":
8686eede34cSSimon Glass      MAKEALL -a powerpc -v esd
8696eede34cSSimon Glass          ** buildman -b <branch> esd
8706eede34cSSimon Glass  - build all PowerPC boards manufactured either by "keymile" or "siemens":
8716eede34cSSimon Glass      MAKEALL -a powerpc -v keymile -v siemens
8726eede34cSSimon Glass          ** buildman -b <branch> keymile siemens
8736eede34cSSimon Glass  - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
8746eede34cSSimon Glass      MAKEALL -c mpc83xx -v freescale 4xx
8756eede34cSSimon Glass          ** buildman -b <branch> mpc83xx freescale 4xx
8766eede34cSSimon Glass
8776eede34cSSimon GlassBuildman automatically tries to use all the CPUs in your machine. If you
8786eede34cSSimon Glassare building a lot of boards it will use one thread for every CPU core
8796eede34cSSimon Glassit detects in your machine. This is like MAKEALL's BUILD_NBUILDS option.
8806eede34cSSimon GlassYou can use the -T flag to change the number of threads. If you are only
8816eede34cSSimon Glassbuilding a few boards, buildman will automatically run make with the -j
8826eede34cSSimon Glassflag to increase the number of concurrent make tasks. It isn't normally
8836eede34cSSimon Glassthat helpful to fiddle with this option, but if you use the BUILD_NCPUS
8846eede34cSSimon Glassoption in MAKEALL then -j is the equivalent in buildman.
8856eede34cSSimon Glass
8866eede34cSSimon GlassBuildman puts its output in ../<branch_name> by default but you can change
8876eede34cSSimon Glassthis with the -o option. Buildman normally does out-of-tree builds: use -i
8886eede34cSSimon Glassto disable that if you really want to. But be careful that once you have
8896eede34cSSimon Glassused -i you pollute buildman's copies of the source tree, and you will need
8906eede34cSSimon Glassto remove the build directory (normally ../<branch_name>) to run buildman
8916eede34cSSimon Glassin normal mode (without -i).
8926eede34cSSimon Glass
8936eede34cSSimon GlassBuildman doesn't keep the output result normally, but use the -k option to
8946eede34cSSimon Glassdo this.
8956eede34cSSimon Glass
8966eede34cSSimon GlassPlease read 'Theory of Operation' a few times as it will make a lot of
8976eede34cSSimon Glassthings clearer.
8986eede34cSSimon Glass
8996eede34cSSimon GlassSome options you might like are:
9006eede34cSSimon Glass
9016eede34cSSimon Glass   -B shows which functions are growing/shrinking in which commit - great
9026eede34cSSimon Glass        for finding code bloat.
9036eede34cSSimon Glass   -S shows image sizes for each commit (just an overall summary)
9046eede34cSSimon Glass   -u shows boards that you haven't built yet
9056eede34cSSimon Glass   --step 0 will build just the upstream commit and the last commit of your
9066eede34cSSimon Glass        branch. This is often a quick sanity check that your branch doesn't
9076eede34cSSimon Glass        break anything. But note this does not check bisectability!
9086eede34cSSimon Glass
9096eede34cSSimon Glass
910fc3fe1c2SSimon GlassTODO
911fc3fe1c2SSimon Glass====
912fc3fe1c2SSimon Glass
913fc3fe1c2SSimon GlassThis has mostly be written in my spare time as a response to my difficulties
914fc3fe1c2SSimon Glassin testing large series of patches. Apart from tidying up there is quite a
9151d8104feSSimon Glassbit of scope for improvement. Things like better error diffs and easier
9163e1ded1fSDirk Behmeaccess to log files. Also it would be nice if buildman could 'hunt' for
9171d8104feSSimon Glassproblems, perhaps by building a few boards for each arch, or checking
9181d8104feSSimon Glasscommits for changed files and building only boards which use those files.
919fc3fe1c2SSimon Glass
920fc3fe1c2SSimon Glass
921fc3fe1c2SSimon GlassCredits
922fc3fe1c2SSimon Glass=======
923fc3fe1c2SSimon Glass
924fc3fe1c2SSimon GlassThanks to Grant Grundler <grundler@chromium.org> for his ideas for improving
925fc3fe1c2SSimon Glassthe build speed by building all commits for a board instead of the other
926fc3fe1c2SSimon Glassway around.
927fc3fe1c2SSimon Glass
928fc3fe1c2SSimon Glass
929fc3fe1c2SSimon GlassSimon Glass
930fc3fe1c2SSimon Glasssjg@chromium.org
931fc3fe1c2SSimon GlassHalloween 2012
932fc3fe1c2SSimon GlassUpdated 12-12-12
933fc3fe1c2SSimon GlassUpdated 23-02-13
934