blob: a23e1d17e3273e598f21ab8f533b57a44cbcf251 [file] [log] [blame]
Mike Frysingerf1ba7ad2022-09-12 05:42:57 -04001# Copyright 2013 The ChromiumOS Authors
Simon Glass02741682013-05-26 07:07:58 -07002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""crosfw - Chrome OS Firmware build/flash script.
6
7Builds a firmware image for any board and writes it to the board. The image
8can be pure upstream or include Chrome OS components (-V). Some device
9tree parameters can be provided, including silent console (-C) and secure
10boot (-S). Use -i for a faster incremental build. The image is written to
11the board by default using USB/em100 (or sdcard with -x). Use -b to specify
12the board to build. Options can be added to ~/.crosfwrc - see the script for
13details.
14
15It can also flash SPI by writing a 'magic flasher' U-Boot with a payload
16to the board.
17
Simon Glass02741682013-05-26 07:07:58 -070018The script is normally run from within the U-Boot directory which is
19.../src/third_party/u-boot/files
20
21Example 1: Build upstream image for coreboot and write to a 'link':
22
23 crosfw -b link
24
25Example 2: Build verified boot image (V) for daisy/snow and boot in secure
26 mode (S) so that breaking in on boot is not possible.
27
28 crosfw -b daisy -VS
29 crosfw -b daisy -VSC (no console output)
30
31Example 3: Build a magic flasher (F) with full verified boot for peach_pit,
32 but with console enabled, write to SD card (x)
33
34 crosfw -b peach_pit -VSFx
35
36This sript does not use an ebuild. It does a similar thing to the
37chromeos-u-boot ebuild, and runs cros_bundle_firmware to produce various
38types of image, a little like the chromeos-bootimage ebuild.
39
40The purpose of this script is to make it easier and faster to perform
41common firmware build tasks without changing boards, manually updating
42device tree files or lots of USE flags and complexity in the ebuilds.
43
44This script has been tested with snow, link and peach_pit. It builds for
45peach_pit by default. Note that it will also build any upstream ARM
46board - e.g. "-b snapper9260" will build an image for that board.
47
48Mostly you can use the script inside and outside the chroot. The main
49limitation is that dut-control doesn't really work outside the chroot,
50so writing the image to the board over USB is not possible, nor can the
51board be automatically reset on x86 platforms.
52
53For an incremental build (faster), run with -i
54
55To get faster clean builds, install ccache, and create ~/.crosfwrc with
56this line:
57
Simon Glass6ddc7f12013-07-18 15:22:41 -060058 USE_CCACHE = True
Simon Glass02741682013-05-26 07:07:58 -070059
60(make sure ~/.ccache is not on NFS, or set CCACHE_DIR)
61
62Other options are the default board to build, and verbosity (0-4), e.g.:
63
Simon Glass6ddc7f12013-07-18 15:22:41 -060064 DEFAULT_BOARD = 'daisy'
65 VERBOSE = 1
Simon Glass02741682013-05-26 07:07:58 -070066
67It is possible to use multiple servo boards, each on its own port. Add
68these lines to your ~/.crosfwrc to set the servo port to use for each
69board:
70
71 SERVO_PORT['link'] = 8888
72 SERVO_PORT['daisy'] = 9999
73 SERVO_PORT['peach_pit'] = 7777
74
Simon Glassb89ae892013-07-18 15:23:35 -060075All builds appear in the <outdir>/<board> subdirectory and images are written
76to <outdir>/<uboard>/out, where <uboard> is the U-Boot name for the board (in
77the U-Boot boards.cfg file)
78
79The value for <outdir> defaults to /tmp/crosfw but can be configured in your
80~/.crosfwrc file, e.g.:"
81
82 OUT_DIR = '/tmp/u-boot'
Simon Glass02741682013-05-26 07:07:58 -070083
84For the -a option here are some useful options:
85
86--add-blob cros-splash /dev/null
87--gbb-flags -force-dev-switch-on
88--add-node-enable /spi@131b0000/cros-ecp@0 1
89--verify --full-erase
90--bootcmd "cros_test sha"
91--gbb-flags -force-dev-switch-on
Mike Frysinger0246c1f2021-12-14 01:17:17 -050092--bmpblk ~/chromiumos/src/third_party/u-boot/bmp.bin
Simon Glass02741682013-05-26 07:07:58 -070093
94For example: -a "--gbb-flags -force-dev-switch-on"
95
96Note the standard bmpblk is at:
Mike Frysinger0246c1f2021-12-14 01:17:17 -050097 ~/chromiumos/src/third_party/chromiumos-overlay/sys-boot/
98 chromeos-bootimage/files/bmpblk.bin
Simon Glass02741682013-05-26 07:07:58 -070099"""
100
101import glob
Chris McDonald59650c32021-07-20 15:29:28 -0600102import logging
Simon Glass02741682013-05-26 07:07:58 -0700103import multiprocessing
104import os
105import re
Mike Frysinger66d32cd2019-12-17 14:55:29 -0500106import subprocess
Simon Glass02741682013-05-26 07:07:58 -0700107import sys
108
Simon Glass02741682013-05-26 07:07:58 -0700109from chromite.lib import commandline
Chris McDonald59650c32021-07-20 15:29:28 -0600110from chromite.lib import constants
Simon Glass02741682013-05-26 07:07:58 -0700111from chromite.lib import cros_build_lib
112from chromite.lib import osutils
113from chromite.lib import parallel
114
115
116arch = None
117board = None
118compiler = None
119default_board = None
120family = None
121in_chroot = True
122
Alex Klein1699fab2022-09-08 08:46:06 -0600123kwargs = {
124 "print_cmd": False,
125 "check": False,
Alex Klein1699fab2022-09-08 08:46:06 -0600126}
Simon Glass02741682013-05-26 07:07:58 -0700127
Alex Klein1699fab2022-09-08 08:46:06 -0600128outdir = ""
Simon Glass02741682013-05-26 07:07:58 -0700129
Alex Klein1699fab2022-09-08 08:46:06 -0600130# If you have multiple boards connected on different servo ports, put lines
Simon Glass02741682013-05-26 07:07:58 -0700131# like 'SERVO_PORT{"peach_pit"} = 7777' in your ~/.crosfwrc
132SERVO_PORT = {}
133
134smdk = None
Alex Klein1699fab2022-09-08 08:46:06 -0600135src_root = os.path.join(constants.SOURCE_ROOT, "src")
Simon Glass02741682013-05-26 07:07:58 -0700136in_chroot = cros_build_lib.IsInsideChroot()
137
Alex Klein1699fab2022-09-08 08:46:06 -0600138uboard = ""
Simon Glass02741682013-05-26 07:07:58 -0700139
Alex Klein1699fab2022-09-08 08:46:06 -0600140default_board = "peach_pit"
Simon Glass02741682013-05-26 07:07:58 -0700141use_ccache = False
142vendor = None
143verbose = False
144
145# Special cases for the U-Boot board config, the SOCs and default device tree
146# since the naming is not always consistent.
147# x86 has a lot of boards, but to U-Boot they are all the same
148UBOARDS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600149 "daisy": "smdk5250",
150 "peach": "smdk5420",
Simon Glass02741682013-05-26 07:07:58 -0700151}
Alex Klein1699fab2022-09-08 08:46:06 -0600152for b in [
153 "alex",
154 "butterfly",
155 "emeraldlake2",
156 "link",
157 "lumpy",
158 "parrot",
159 "stout",
160 "stumpy",
161]:
162 UBOARDS[b] = "coreboot-x86"
163 UBOARDS["chromeos_%s" % b] = "chromeos_coreboot"
Simon Glass02741682013-05-26 07:07:58 -0700164
165SOCS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600166 "coreboot-x86": "",
167 "chromeos_coreboot": "",
168 "daisy": "exynos5250-",
169 "peach": "exynos5420-",
Simon Glass02741682013-05-26 07:07:58 -0700170}
171
172DEFAULT_DTS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600173 "daisy": "snow",
174 "daisy_spring": "spring",
175 "peach_pit": "peach-pit",
Simon Glass02741682013-05-26 07:07:58 -0700176}
177
Alex Klein1699fab2022-09-08 08:46:06 -0600178OUT_DIR = "/tmp/crosfw"
Simon Glassb89ae892013-07-18 15:23:35 -0600179
Alex Klein1699fab2022-09-08 08:46:06 -0600180rc_file = os.path.expanduser("~/.crosfwrc")
Simon Glass02741682013-05-26 07:07:58 -0700181if os.path.exists(rc_file):
Alex Klein1699fab2022-09-08 08:46:06 -0600182 with open(rc_file) as fp:
183 # pylint: disable=exec-used
184 exec(compile(fp.read(), rc_file, "exec"))
Simon Glass02741682013-05-26 07:07:58 -0700185
186
Simon Glass02741682013-05-26 07:07:58 -0700187def Dumper(flag, infile, outfile):
Alex Klein1699fab2022-09-08 08:46:06 -0600188 """Run objdump on an input file.
Simon Glass02741682013-05-26 07:07:58 -0700189
Alex Klein1699fab2022-09-08 08:46:06 -0600190 Args:
191 flag: Flag to pass objdump (e.g. '-d').
192 infile: Input file to process.
193 outfile: Output file to write to.
194 """
195 result = cros_build_lib.run(
196 [CompilerTool("objdump"), flag, infile], stdout=outfile, **kwargs
197 )
198 if result.returncode:
199 sys.exit()
Simon Glass02741682013-05-26 07:07:58 -0700200
201
202def CompilerTool(tool):
Alex Klein1699fab2022-09-08 08:46:06 -0600203 """Returns the cross-compiler tool filename.
Simon Glass02741682013-05-26 07:07:58 -0700204
Alex Klein1699fab2022-09-08 08:46:06 -0600205 Args:
206 tool: Tool name to return, e.g. 'size'.
Simon Glass02741682013-05-26 07:07:58 -0700207
Alex Klein1699fab2022-09-08 08:46:06 -0600208 Returns:
209 Filename of requested tool.
210 """
211 return "%s%s" % (compiler, tool)
Simon Glass02741682013-05-26 07:07:58 -0700212
213
214def ParseCmdline(argv):
Alex Klein1699fab2022-09-08 08:46:06 -0600215 """Parse all command line options.
Simon Glass02741682013-05-26 07:07:58 -0700216
Alex Klein1699fab2022-09-08 08:46:06 -0600217 Args:
218 argv: Arguments to parse.
Simon Glass02741682013-05-26 07:07:58 -0700219
Alex Klein1699fab2022-09-08 08:46:06 -0600220 Returns:
221 The parsed options object
222 """
223 parser = commandline.ArgumentParser(description=__doc__)
224 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600225 "-B",
226 "--build",
227 action="store_false",
228 default=True,
229 help="Don't build U-Boot, just configure device tree",
230 )
231 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600232 "-d",
233 "--dt",
234 default="seaboard",
235 help="Select name of device tree file to use",
236 )
237 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600238 "-i",
239 "--incremental",
240 action="store_true",
241 default=False,
242 help="Don't reconfigure and clean",
243 )
244 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600245 "-O",
246 "--objdump",
247 action="store_true",
248 default=False,
249 help="Write disassembly output",
250 )
251 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600252 "-t",
253 "--trace",
254 action="store_true",
255 default=False,
256 help="Enable trace support",
257 )
258 parser.add_argument(
Simon Glassa68488c2023-02-09 16:53:47 -0700259 "-T",
260 "--target",
261 nargs="?",
262 default="all",
263 help="Select target to build",
264 )
265 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600266 "-V",
267 "--verified",
268 action="store_true",
269 default=False,
270 help="Include Chrome OS verified boot components",
271 )
272 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600273 "-z",
274 "--size",
275 action="store_true",
276 default=False,
277 help="Display U-Boot image size",
278 )
279 parser.add_argument(
Simon Glassa68488c2023-02-09 16:53:47 -0700280 "board",
281 type=str,
282 default=default_board,
283 help="Select board to build (daisy/peach_pit/link)",
Alex Klein1699fab2022-09-08 08:46:06 -0600284 )
285 return parser.parse_args(argv)
Simon Glass02741682013-05-26 07:07:58 -0700286
287
Simon Glassc1a323a2016-08-04 20:29:51 -0600288def FindCompiler(gcc, cros_prefix):
Alex Klein1699fab2022-09-08 08:46:06 -0600289 """Look up the compiler for an architecture.
Simon Glassc1a323a2016-08-04 20:29:51 -0600290
Alex Klein1699fab2022-09-08 08:46:06 -0600291 Args:
292 gcc: GCC architecture, either 'arm' or 'aarch64'
293 cros_prefix: Full Chromium OS toolchain prefix
294 """
295 if in_chroot:
296 # Use the Chromium OS toolchain.
297 prefix = cros_prefix
298 else:
299 prefix = glob.glob("/opt/linaro/gcc-linaro-%s-linux-*/bin/*gcc" % gcc)
300 if not prefix:
301 cros_build_lib.Die(
302 """Please install an %s toolchain for your machine.
Simon Glassc1a323a2016-08-04 20:29:51 -0600303Install a Linaro toolchain from:
304https://launchpad.net/linaro-toolchain-binaries
Alex Klein1699fab2022-09-08 08:46:06 -0600305or see cros/commands/cros_chrome_sdk.py."""
306 % gcc
307 )
308 prefix = re.sub("gcc$", "", prefix[0])
309 return prefix
Simon Glassc1a323a2016-08-04 20:29:51 -0600310
311
Simon Glass02741682013-05-26 07:07:58 -0700312def SetupBuild(options):
Alex Klein1699fab2022-09-08 08:46:06 -0600313 """Set up parameters needed for the build.
Simon Glass02741682013-05-26 07:07:58 -0700314
Alex Klein1699fab2022-09-08 08:46:06 -0600315 This checks the current environment and options and sets up various things
316 needed for the build, including 'base' which holds the base flags for
317 passing to the U-Boot Makefile.
Simon Glass02741682013-05-26 07:07:58 -0700318
Alex Klein1699fab2022-09-08 08:46:06 -0600319 Args:
320 options: Command line options
Simon Glass02741682013-05-26 07:07:58 -0700321
Alex Klein1699fab2022-09-08 08:46:06 -0600322 Returns:
323 Base flags to use for U-Boot, as a list.
324 """
325 # pylint: disable=global-statement
326 global arch, board, compiler, family, outdir, smdk, uboard, vendor, verbose
Simon Glass02741682013-05-26 07:07:58 -0700327
Alex Klein1699fab2022-09-08 08:46:06 -0600328 if not verbose:
329 verbose = options.verbose != 0
Simon Glass02741682013-05-26 07:07:58 -0700330
Simon Glass9674afc2023-02-10 11:21:30 -0700331 logging.info("Building for %s", options.board)
Simon Glass02741682013-05-26 07:07:58 -0700332
Alex Klein1699fab2022-09-08 08:46:06 -0600333 # Separate out board_variant string: "peach_pit" becomes "peach", "pit".
334 # But don't mess up upstream boards which use _ in their name.
335 parts = options.board.split("_")
336 if parts[0] in ["daisy", "peach"]:
337 board = parts[0]
Simon Glass02741682013-05-26 07:07:58 -0700338 else:
Alex Klein1699fab2022-09-08 08:46:06 -0600339 board = options.board
Simon Glass02741682013-05-26 07:07:58 -0700340
Alex Klein1699fab2022-09-08 08:46:06 -0600341 # To allow this to be run from 'cros_sdk'
342 if in_chroot:
343 os.chdir(os.path.join(src_root, "third_party", "u-boot", "files"))
Simon Glass02741682013-05-26 07:07:58 -0700344
Alex Klein1699fab2022-09-08 08:46:06 -0600345 base_board = board
Simon Glass02741682013-05-26 07:07:58 -0700346
Alex Klein1699fab2022-09-08 08:46:06 -0600347 if options.verified:
348 base_board = "chromeos_%s" % base_board
Simon Glass02741682013-05-26 07:07:58 -0700349
Alex Klein1699fab2022-09-08 08:46:06 -0600350 uboard = UBOARDS.get(base_board, base_board)
Simon Glass9674afc2023-02-10 11:21:30 -0700351 logging.info("U-Boot board is %s", uboard)
Simon Glass02741682013-05-26 07:07:58 -0700352
Alex Klein1699fab2022-09-08 08:46:06 -0600353 # Pull out some information from the U-Boot boards config file
354 family = None
355 (PRE_KBUILD, PRE_KCONFIG, KCONFIG) = range(3)
356 if os.path.exists("MAINTAINERS"):
357 board_format = PRE_KBUILD
358 else:
359 board_format = PRE_KCONFIG
360 with open("boards.cfg") as f:
361 for line in f:
362 if "genboardscfg" in line:
363 board_format = KCONFIG
364 if uboard in line:
365 if line[0] == "#":
366 continue
367 fields = line.split()
368 if not fields:
369 continue
Simon Glassa44a1f92023-02-09 16:31:34 -0700370 target = fields[6]
371 # Make sure this is the right target.
372 if target != uboard:
373 continue
Alex Klein1699fab2022-09-08 08:46:06 -0600374 arch = fields[1]
375 fields += [None, None, None]
376 if board_format == PRE_KBUILD:
377 smdk = fields[3]
378 vendor = fields[4]
379 family = fields[5]
Alex Klein1699fab2022-09-08 08:46:06 -0600380 elif board_format in (PRE_KCONFIG, KCONFIG):
381 smdk = fields[5]
382 vendor = fields[4]
383 family = fields[3]
384 target = fields[0]
Alex Klein1699fab2022-09-08 08:46:06 -0600385 if not arch:
386 cros_build_lib.Die(
387 "Selected board '%s' not found in boards.cfg." % board
388 )
Simon Glass02741682013-05-26 07:07:58 -0700389
Alex Klein1699fab2022-09-08 08:46:06 -0600390 vboot = os.path.join("build", board, "usr")
Simon Glassa44a1f92023-02-09 16:31:34 -0700391 if in_chroot:
392 if arch == "x86":
393 compiler = "i686-cros-linux-gnu-"
394 elif arch == "arm":
395 compiler = FindCompiler(arch, "armv7a-cros-linux-gnueabihf-")
396 elif arch == "aarch64":
397 compiler = FindCompiler(arch, "aarch64-cros-linux-gnu-")
Alex Klein1699fab2022-09-08 08:46:06 -0600398 elif arch == "sandbox":
399 compiler = ""
400 else:
Simon Glassa44a1f92023-02-09 16:31:34 -0700401 result = cros_build_lib.run(
402 ["buildman", "-A", "--boards", options.board],
403 capture_output=True,
404 encoding="utf-8",
405 **kwargs,
406 )
407 compiler = result.stdout.strip()
408 if not compiler:
409 cros_build_lib.Die("Selected arch '%s' not supported.", arch)
Simon Glass02741682013-05-26 07:07:58 -0700410
Alex Klein1699fab2022-09-08 08:46:06 -0600411 if not options.build:
412 options.incremental = True
Simon Glass02741682013-05-26 07:07:58 -0700413
Alex Klein1699fab2022-09-08 08:46:06 -0600414 cpus = multiprocessing.cpu_count()
Simon Glass02741682013-05-26 07:07:58 -0700415
Alex Klein1699fab2022-09-08 08:46:06 -0600416 outdir = os.path.join(OUT_DIR, uboard)
417 base = [
418 "make",
419 "-j%d" % cpus,
420 "O=%s" % outdir,
421 "ARCH=%s" % arch,
422 "CROSS_COMPILE=%s" % compiler,
423 "--no-print-directory",
424 "HOSTSTRIP=true",
425 "DEV_TREE_SRC=%s-%s" % (family, options.dt),
426 "QEMU_ARCH=",
427 ]
Simon Glass02741682013-05-26 07:07:58 -0700428
Alex Klein1699fab2022-09-08 08:46:06 -0600429 if options.verbose < 2:
430 base.append("-s")
431 elif options.verbose > 2:
432 base.append("V=1")
Simon Glass02741682013-05-26 07:07:58 -0700433
Alex Klein1699fab2022-09-08 08:46:06 -0600434 if options.verified:
435 base += [
436 "VBOOT=%s" % vboot,
437 "MAKEFLAGS_VBOOT=DEBUG=1",
438 "QUIET=1",
439 "CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS",
440 "VBOOT_SOURCE=%s/platform/vboot_reference" % src_root,
441 ]
442 base.append("VBOOT_DEBUG=1")
443
Alex Klein1699fab2022-09-08 08:46:06 -0600444 base.append("BUILD_ROM=1")
445 if options.trace:
446 base.append("FTRACE=1")
Alex Klein1699fab2022-09-08 08:46:06 -0600447
448 if options.incremental:
Alex Klein1699fab2022-09-08 08:46:06 -0600449 config_mk = "%s/include/autoconf.mk" % outdir
450 if not os.path.exists(config_mk):
451 logging.warning("No build found for %s - dropping -i", board)
452 options.incremental = False
453
454 config_mk = "include/autoconf.mk"
455 if os.path.exists(config_mk):
456 logging.warning("Warning: '%s' exists, try 'make distclean'", config_mk)
457
Alex Klein1699fab2022-09-08 08:46:06 -0600458 return base
Simon Glass02741682013-05-26 07:07:58 -0700459
460
461def RunBuild(options, base, target, queue):
Alex Klein1699fab2022-09-08 08:46:06 -0600462 """Run the U-Boot build.
Simon Glass02741682013-05-26 07:07:58 -0700463
Alex Klein1699fab2022-09-08 08:46:06 -0600464 Args:
465 options: Command line options.
466 base: Base U-Boot flags.
467 target: Target to build.
468 queue: A parallel queue to add jobs to.
469 """
Simon Glass9674afc2023-02-10 11:21:30 -0700470 logging.info("U-Boot build flags: %s", " ".join(base))
Simon Glass02741682013-05-26 07:07:58 -0700471
Alex Klein1699fab2022-09-08 08:46:06 -0600472 # Reconfigure U-Boot.
473 if not options.incremental:
474 # Ignore any error from this, some older U-Boots fail on this.
475 cros_build_lib.run(base + ["distclean"], **kwargs)
476 if os.path.exists("tools/genboardscfg.py"):
477 mtarget = "defconfig"
478 else:
479 mtarget = "config"
480 cmd = base + ["%s_%s" % (uboard, mtarget)]
481 result = cros_build_lib.run(
482 cmd, stdout=True, stderr=subprocess.STDOUT, **kwargs
483 )
484 if result.returncode:
485 print("cmd: '%s', output: '%s'" % (result.cmdstr, result.stdout))
486 sys.exit(result.returncode)
Simon Glass02741682013-05-26 07:07:58 -0700487
Alex Klein1699fab2022-09-08 08:46:06 -0600488 # Do the actual build.
489 if options.build:
490 result = cros_build_lib.run(
491 base + [target], stdout=True, stderr=subprocess.STDOUT, **kwargs
492 )
493 if result.returncode:
494 # The build failed, so output the results to stderr.
495 print(
496 "cmd: '%s', output: '%s'" % (result.cmdstr, result.stdout),
497 file=sys.stderr,
498 )
499 sys.exit(result.returncode)
Simon Glass02741682013-05-26 07:07:58 -0700500
Alex Klein1699fab2022-09-08 08:46:06 -0600501 files = ["%s/u-boot" % outdir]
502 spl = glob.glob("%s/spl/u-boot-spl" % outdir)
503 if spl:
504 files += spl
505 if options.size:
506 result = cros_build_lib.run([CompilerTool("size")] + files, **kwargs)
507 if result.returncode:
508 sys.exit()
Simon Glass02741682013-05-26 07:07:58 -0700509
Alex Klein1699fab2022-09-08 08:46:06 -0600510 # Create disassembly files .dis and .Dis (full dump)
511 for f in files:
512 base = os.path.splitext(f)[0]
513 if options.objdump:
514 queue.put(("-d", f, base + ".dis"))
515 queue.put(("-D", f, base + ".Dis"))
516 else:
517 # Remove old files which otherwise might be confusing
518 osutils.SafeUnlink(base + ".dis")
519 osutils.SafeUnlink(base + ".Dis")
Simon Glass02741682013-05-26 07:07:58 -0700520
Simon Glass9674afc2023-02-10 11:21:30 -0700521 logging.info("Output directory %s", outdir)
Simon Glass02741682013-05-26 07:07:58 -0700522
523
Simon Glass02741682013-05-26 07:07:58 -0700524def main(argv):
Simon Glasse6201d72023-02-09 16:42:22 -0700525 """Main function for script to build firmware.
Simon Glass02741682013-05-26 07:07:58 -0700526
Alex Klein1699fab2022-09-08 08:46:06 -0600527 Args:
528 argv: Program arguments.
529 """
530 options = ParseCmdline(argv)
531 base = SetupBuild(options)
Simon Glass02741682013-05-26 07:07:58 -0700532
Alex Klein1699fab2022-09-08 08:46:06 -0600533 with parallel.BackgroundTaskRunner(Dumper) as queue:
534 RunBuild(options, base, options.target, queue)
Simon Glass02741682013-05-26 07:07:58 -0700535
Alex Klein1699fab2022-09-08 08:46:06 -0600536 if options.objdump:
Simon Glass9674afc2023-02-10 11:21:30 -0700537 logging.info("Writing diasssembly files")