blob: d0286d393563018f92dd5f8ac780e257146afc67 [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
Simon Glass02741682013-05-26 07:07:58 -0700143
144# Special cases for the U-Boot board config, the SOCs and default device tree
145# since the naming is not always consistent.
146# x86 has a lot of boards, but to U-Boot they are all the same
147UBOARDS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600148 "daisy": "smdk5250",
149 "peach": "smdk5420",
Simon Glass02741682013-05-26 07:07:58 -0700150}
Alex Klein1699fab2022-09-08 08:46:06 -0600151for b in [
152 "alex",
153 "butterfly",
154 "emeraldlake2",
155 "link",
156 "lumpy",
157 "parrot",
158 "stout",
159 "stumpy",
160]:
161 UBOARDS[b] = "coreboot-x86"
162 UBOARDS["chromeos_%s" % b] = "chromeos_coreboot"
Simon Glass02741682013-05-26 07:07:58 -0700163
164SOCS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600165 "coreboot-x86": "",
166 "chromeos_coreboot": "",
167 "daisy": "exynos5250-",
168 "peach": "exynos5420-",
Simon Glass02741682013-05-26 07:07:58 -0700169}
170
171DEFAULT_DTS = {
Alex Klein1699fab2022-09-08 08:46:06 -0600172 "daisy": "snow",
173 "daisy_spring": "spring",
174 "peach_pit": "peach-pit",
Simon Glass02741682013-05-26 07:07:58 -0700175}
176
Alex Klein1699fab2022-09-08 08:46:06 -0600177OUT_DIR = "/tmp/crosfw"
Simon Glassb89ae892013-07-18 15:23:35 -0600178
Alex Klein1699fab2022-09-08 08:46:06 -0600179rc_file = os.path.expanduser("~/.crosfwrc")
Simon Glass02741682013-05-26 07:07:58 -0700180if os.path.exists(rc_file):
Alex Klein1699fab2022-09-08 08:46:06 -0600181 with open(rc_file) as fp:
182 # pylint: disable=exec-used
183 exec(compile(fp.read(), rc_file, "exec"))
Simon Glass02741682013-05-26 07:07:58 -0700184
185
Simon Glass02741682013-05-26 07:07:58 -0700186def Dumper(flag, infile, outfile):
Alex Klein1699fab2022-09-08 08:46:06 -0600187 """Run objdump on an input file.
Simon Glass02741682013-05-26 07:07:58 -0700188
Alex Klein1699fab2022-09-08 08:46:06 -0600189 Args:
190 flag: Flag to pass objdump (e.g. '-d').
191 infile: Input file to process.
192 outfile: Output file to write to.
193 """
194 result = cros_build_lib.run(
195 [CompilerTool("objdump"), flag, infile], stdout=outfile, **kwargs
196 )
197 if result.returncode:
198 sys.exit()
Simon Glass02741682013-05-26 07:07:58 -0700199
200
201def CompilerTool(tool):
Alex Klein1699fab2022-09-08 08:46:06 -0600202 """Returns the cross-compiler tool filename.
Simon Glass02741682013-05-26 07:07:58 -0700203
Alex Klein1699fab2022-09-08 08:46:06 -0600204 Args:
205 tool: Tool name to return, e.g. 'size'.
Simon Glass02741682013-05-26 07:07:58 -0700206
Alex Klein1699fab2022-09-08 08:46:06 -0600207 Returns:
208 Filename of requested tool.
209 """
210 return "%s%s" % (compiler, tool)
Simon Glass02741682013-05-26 07:07:58 -0700211
212
213def ParseCmdline(argv):
Alex Klein1699fab2022-09-08 08:46:06 -0600214 """Parse all command line options.
Simon Glass02741682013-05-26 07:07:58 -0700215
Alex Klein1699fab2022-09-08 08:46:06 -0600216 Args:
217 argv: Arguments to parse.
Simon Glass02741682013-05-26 07:07:58 -0700218
Alex Klein1699fab2022-09-08 08:46:06 -0600219 Returns:
220 The parsed options object
221 """
Simon Glass95a316d2023-02-10 11:31:47 -0700222 parser = commandline.ArgumentParser(
223 description=__doc__, default_log_level="notice"
224 )
Alex Klein1699fab2022-09-08 08:46:06 -0600225 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600226 "-B",
227 "--build",
228 action="store_false",
229 default=True,
230 help="Don't build U-Boot, just configure device tree",
231 )
232 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600233 "-d",
234 "--dt",
235 default="seaboard",
236 help="Select name of device tree file to use",
237 )
238 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600239 "-i",
240 "--incremental",
241 action="store_true",
242 default=False,
243 help="Don't reconfigure and clean",
244 )
245 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600246 "-O",
247 "--objdump",
248 action="store_true",
249 default=False,
250 help="Write disassembly output",
251 )
252 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600253 "-t",
254 "--trace",
255 action="store_true",
256 default=False,
257 help="Enable trace support",
258 )
259 parser.add_argument(
Simon Glassa68488c2023-02-09 16:53:47 -0700260 "-T",
261 "--target",
262 nargs="?",
263 default="all",
264 help="Select target to build",
265 )
266 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600267 "-V",
268 "--verified",
269 action="store_true",
270 default=False,
271 help="Include Chrome OS verified boot components",
272 )
273 parser.add_argument(
Alex Klein1699fab2022-09-08 08:46:06 -0600274 "-z",
275 "--size",
276 action="store_true",
277 default=False,
278 help="Display U-Boot image size",
279 )
280 parser.add_argument(
Simon Glassa68488c2023-02-09 16:53:47 -0700281 "board",
282 type=str,
283 default=default_board,
284 help="Select board to build (daisy/peach_pit/link)",
Alex Klein1699fab2022-09-08 08:46:06 -0600285 )
286 return parser.parse_args(argv)
Simon Glass02741682013-05-26 07:07:58 -0700287
288
Simon Glassc1a323a2016-08-04 20:29:51 -0600289def FindCompiler(gcc, cros_prefix):
Alex Klein1699fab2022-09-08 08:46:06 -0600290 """Look up the compiler for an architecture.
Simon Glassc1a323a2016-08-04 20:29:51 -0600291
Alex Klein1699fab2022-09-08 08:46:06 -0600292 Args:
293 gcc: GCC architecture, either 'arm' or 'aarch64'
294 cros_prefix: Full Chromium OS toolchain prefix
295 """
296 if in_chroot:
297 # Use the Chromium OS toolchain.
298 prefix = cros_prefix
299 else:
300 prefix = glob.glob("/opt/linaro/gcc-linaro-%s-linux-*/bin/*gcc" % gcc)
301 if not prefix:
302 cros_build_lib.Die(
303 """Please install an %s toolchain for your machine.
Simon Glassc1a323a2016-08-04 20:29:51 -0600304Install a Linaro toolchain from:
305https://launchpad.net/linaro-toolchain-binaries
Alex Klein1699fab2022-09-08 08:46:06 -0600306or see cros/commands/cros_chrome_sdk.py."""
307 % gcc
308 )
309 prefix = re.sub("gcc$", "", prefix[0])
310 return prefix
Simon Glassc1a323a2016-08-04 20:29:51 -0600311
312
Simon Glass02741682013-05-26 07:07:58 -0700313def SetupBuild(options):
Alex Klein1699fab2022-09-08 08:46:06 -0600314 """Set up parameters needed for the build.
Simon Glass02741682013-05-26 07:07:58 -0700315
Alex Klein1699fab2022-09-08 08:46:06 -0600316 This checks the current environment and options and sets up various things
317 needed for the build, including 'base' which holds the base flags for
318 passing to the U-Boot Makefile.
Simon Glass02741682013-05-26 07:07:58 -0700319
Alex Klein1699fab2022-09-08 08:46:06 -0600320 Args:
321 options: Command line options
Simon Glass02741682013-05-26 07:07:58 -0700322
Alex Klein1699fab2022-09-08 08:46:06 -0600323 Returns:
324 Base flags to use for U-Boot, as a list.
325 """
326 # pylint: disable=global-statement
Simon Glass95a316d2023-02-10 11:31:47 -0700327 global arch, board, compiler, family, outdir, smdk, uboard, vendor
Simon Glass02741682013-05-26 07:07:58 -0700328
Simon Glass9674afc2023-02-10 11:21:30 -0700329 logging.info("Building for %s", options.board)
Simon Glass02741682013-05-26 07:07:58 -0700330
Alex Klein1699fab2022-09-08 08:46:06 -0600331 # Separate out board_variant string: "peach_pit" becomes "peach", "pit".
332 # But don't mess up upstream boards which use _ in their name.
333 parts = options.board.split("_")
334 if parts[0] in ["daisy", "peach"]:
335 board = parts[0]
Simon Glass02741682013-05-26 07:07:58 -0700336 else:
Alex Klein1699fab2022-09-08 08:46:06 -0600337 board = options.board
Simon Glass02741682013-05-26 07:07:58 -0700338
Alex Klein1699fab2022-09-08 08:46:06 -0600339 # To allow this to be run from 'cros_sdk'
340 if in_chroot:
341 os.chdir(os.path.join(src_root, "third_party", "u-boot", "files"))
Simon Glass02741682013-05-26 07:07:58 -0700342
Alex Klein1699fab2022-09-08 08:46:06 -0600343 base_board = board
Simon Glass02741682013-05-26 07:07:58 -0700344
Alex Klein1699fab2022-09-08 08:46:06 -0600345 if options.verified:
346 base_board = "chromeos_%s" % base_board
Simon Glass02741682013-05-26 07:07:58 -0700347
Alex Klein1699fab2022-09-08 08:46:06 -0600348 uboard = UBOARDS.get(base_board, base_board)
Simon Glass9674afc2023-02-10 11:21:30 -0700349 logging.info("U-Boot board is %s", uboard)
Simon Glass02741682013-05-26 07:07:58 -0700350
Alex Klein1699fab2022-09-08 08:46:06 -0600351 # Pull out some information from the U-Boot boards config file
352 family = None
353 (PRE_KBUILD, PRE_KCONFIG, KCONFIG) = range(3)
354 if os.path.exists("MAINTAINERS"):
355 board_format = PRE_KBUILD
356 else:
357 board_format = PRE_KCONFIG
358 with open("boards.cfg") as f:
359 for line in f:
360 if "genboardscfg" in line:
361 board_format = KCONFIG
362 if uboard in line:
363 if line[0] == "#":
364 continue
365 fields = line.split()
366 if not fields:
367 continue
Simon Glassa44a1f92023-02-09 16:31:34 -0700368 target = fields[6]
369 # Make sure this is the right target.
370 if target != uboard:
371 continue
Alex Klein1699fab2022-09-08 08:46:06 -0600372 arch = fields[1]
373 fields += [None, None, None]
374 if board_format == PRE_KBUILD:
375 smdk = fields[3]
376 vendor = fields[4]
377 family = fields[5]
Alex Klein1699fab2022-09-08 08:46:06 -0600378 elif board_format in (PRE_KCONFIG, KCONFIG):
379 smdk = fields[5]
380 vendor = fields[4]
381 family = fields[3]
382 target = fields[0]
Alex Klein1699fab2022-09-08 08:46:06 -0600383 if not arch:
384 cros_build_lib.Die(
385 "Selected board '%s' not found in boards.cfg." % board
386 )
Simon Glass02741682013-05-26 07:07:58 -0700387
Alex Klein1699fab2022-09-08 08:46:06 -0600388 vboot = os.path.join("build", board, "usr")
Simon Glassa44a1f92023-02-09 16:31:34 -0700389 if in_chroot:
390 if arch == "x86":
391 compiler = "i686-cros-linux-gnu-"
392 elif arch == "arm":
393 compiler = FindCompiler(arch, "armv7a-cros-linux-gnueabihf-")
394 elif arch == "aarch64":
395 compiler = FindCompiler(arch, "aarch64-cros-linux-gnu-")
Alex Klein1699fab2022-09-08 08:46:06 -0600396 elif arch == "sandbox":
397 compiler = ""
398 else:
Simon Glassa44a1f92023-02-09 16:31:34 -0700399 result = cros_build_lib.run(
400 ["buildman", "-A", "--boards", options.board],
401 capture_output=True,
402 encoding="utf-8",
403 **kwargs,
404 )
405 compiler = result.stdout.strip()
406 if not compiler:
407 cros_build_lib.Die("Selected arch '%s' not supported.", arch)
Simon Glass02741682013-05-26 07:07:58 -0700408
Alex Klein1699fab2022-09-08 08:46:06 -0600409 if not options.build:
410 options.incremental = True
Simon Glass02741682013-05-26 07:07:58 -0700411
Alex Klein1699fab2022-09-08 08:46:06 -0600412 cpus = multiprocessing.cpu_count()
Simon Glass02741682013-05-26 07:07:58 -0700413
Alex Klein1699fab2022-09-08 08:46:06 -0600414 outdir = os.path.join(OUT_DIR, uboard)
415 base = [
416 "make",
417 "-j%d" % cpus,
418 "O=%s" % outdir,
419 "ARCH=%s" % arch,
420 "CROSS_COMPILE=%s" % compiler,
421 "--no-print-directory",
422 "HOSTSTRIP=true",
423 "DEV_TREE_SRC=%s-%s" % (family, options.dt),
424 "QEMU_ARCH=",
425 ]
Simon Glass02741682013-05-26 07:07:58 -0700426
Simon Glass95a316d2023-02-10 11:31:47 -0700427 # Enable quiet output at INFO level, everything at DEBUG level
428 if logging.getLogger().getEffectiveLevel() <= logging.DEBUG:
Alex Klein1699fab2022-09-08 08:46:06 -0600429 base.append("V=1")
Simon Glass95a316d2023-02-10 11:31:47 -0700430 elif logging.getLogger().getEffectiveLevel() >= logging.NOTICE:
431 base.append("-s")
Simon Glass02741682013-05-26 07:07:58 -0700432
Alex Klein1699fab2022-09-08 08:46:06 -0600433 if options.verified:
434 base += [
435 "VBOOT=%s" % vboot,
436 "MAKEFLAGS_VBOOT=DEBUG=1",
437 "QUIET=1",
438 "CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS",
439 "VBOOT_SOURCE=%s/platform/vboot_reference" % src_root,
440 ]
441 base.append("VBOOT_DEBUG=1")
442
Alex Klein1699fab2022-09-08 08:46:06 -0600443 base.append("BUILD_ROM=1")
444 if options.trace:
445 base.append("FTRACE=1")
Alex Klein1699fab2022-09-08 08:46:06 -0600446
447 if options.incremental:
Alex Klein1699fab2022-09-08 08:46:06 -0600448 config_mk = "%s/include/autoconf.mk" % outdir
449 if not os.path.exists(config_mk):
450 logging.warning("No build found for %s - dropping -i", board)
451 options.incremental = False
452
453 config_mk = "include/autoconf.mk"
454 if os.path.exists(config_mk):
455 logging.warning("Warning: '%s' exists, try 'make distclean'", config_mk)
456
Alex Klein1699fab2022-09-08 08:46:06 -0600457 return base
Simon Glass02741682013-05-26 07:07:58 -0700458
459
460def RunBuild(options, base, target, queue):
Alex Klein1699fab2022-09-08 08:46:06 -0600461 """Run the U-Boot build.
Simon Glass02741682013-05-26 07:07:58 -0700462
Alex Klein1699fab2022-09-08 08:46:06 -0600463 Args:
464 options: Command line options.
465 base: Base U-Boot flags.
466 target: Target to build.
467 queue: A parallel queue to add jobs to.
468 """
Simon Glass9674afc2023-02-10 11:21:30 -0700469 logging.info("U-Boot build flags: %s", " ".join(base))
Simon Glass02741682013-05-26 07:07:58 -0700470
Alex Klein1699fab2022-09-08 08:46:06 -0600471 # Reconfigure U-Boot.
472 if not options.incremental:
473 # Ignore any error from this, some older U-Boots fail on this.
474 cros_build_lib.run(base + ["distclean"], **kwargs)
475 if os.path.exists("tools/genboardscfg.py"):
476 mtarget = "defconfig"
477 else:
478 mtarget = "config"
479 cmd = base + ["%s_%s" % (uboard, mtarget)]
480 result = cros_build_lib.run(
481 cmd, stdout=True, stderr=subprocess.STDOUT, **kwargs
482 )
483 if result.returncode:
484 print("cmd: '%s', output: '%s'" % (result.cmdstr, result.stdout))
485 sys.exit(result.returncode)
Simon Glass02741682013-05-26 07:07:58 -0700486
Alex Klein1699fab2022-09-08 08:46:06 -0600487 # Do the actual build.
488 if options.build:
489 result = cros_build_lib.run(
490 base + [target], stdout=True, stderr=subprocess.STDOUT, **kwargs
491 )
492 if result.returncode:
493 # The build failed, so output the results to stderr.
494 print(
495 "cmd: '%s', output: '%s'" % (result.cmdstr, result.stdout),
496 file=sys.stderr,
497 )
498 sys.exit(result.returncode)
Simon Glass02741682013-05-26 07:07:58 -0700499
Alex Klein1699fab2022-09-08 08:46:06 -0600500 files = ["%s/u-boot" % outdir]
501 spl = glob.glob("%s/spl/u-boot-spl" % outdir)
502 if spl:
503 files += spl
504 if options.size:
505 result = cros_build_lib.run([CompilerTool("size")] + files, **kwargs)
506 if result.returncode:
507 sys.exit()
Simon Glass02741682013-05-26 07:07:58 -0700508
Alex Klein1699fab2022-09-08 08:46:06 -0600509 # Create disassembly files .dis and .Dis (full dump)
510 for f in files:
511 base = os.path.splitext(f)[0]
512 if options.objdump:
513 queue.put(("-d", f, base + ".dis"))
514 queue.put(("-D", f, base + ".Dis"))
515 else:
516 # Remove old files which otherwise might be confusing
517 osutils.SafeUnlink(base + ".dis")
518 osutils.SafeUnlink(base + ".Dis")
Simon Glass02741682013-05-26 07:07:58 -0700519
Simon Glass9674afc2023-02-10 11:21:30 -0700520 logging.info("Output directory %s", outdir)
Simon Glass02741682013-05-26 07:07:58 -0700521
522
Simon Glass02741682013-05-26 07:07:58 -0700523def main(argv):
Simon Glasse6201d72023-02-09 16:42:22 -0700524 """Main function for script to build firmware.
Simon Glass02741682013-05-26 07:07:58 -0700525
Alex Klein1699fab2022-09-08 08:46:06 -0600526 Args:
527 argv: Program arguments.
528 """
529 options = ParseCmdline(argv)
530 base = SetupBuild(options)
Simon Glass02741682013-05-26 07:07:58 -0700531
Alex Klein1699fab2022-09-08 08:46:06 -0600532 with parallel.BackgroundTaskRunner(Dumper) as queue:
533 RunBuild(options, base, options.target, queue)
Simon Glass02741682013-05-26 07:07:58 -0700534
Alex Klein1699fab2022-09-08 08:46:06 -0600535 if options.objdump:
Simon Glass9674afc2023-02-10 11:21:30 -0700536 logging.info("Writing diasssembly files")