blob: 16656ef60ebc46308e4a1f2615f06df5b6440467 [file] [log] [blame]
Simon Glass89b86b82011-07-17 23:49:49 -07001# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""This module builds a firmware image for a tegra-based board.
6
7This modules uses a few rudimentary other libraries for its activity.
8
9Here are the names we give to the various files we deal with. It is important
10to keep these consistent!
11
12 uboot u-boot.bin (with no device tree)
13 fdt the fdt blob
14 bct the BCT file
15 bootstub uboot + fdt
16 signed (uboot + fdt + bct) signed blob
17"""
18
19import os
20import re
21
22import cros_output
23from fdt import Fdt
24from pack_firmware import PackFirmware
25import shutil
26import tempfile
27from tools import Tools
28from write_firmware import WriteFirmware
29
30# This data is required by bmpblk_utility. Does it ever change?
31# It was stored with the chromeos-bootimage ebuild, but we want
32# this utility to work outside the chroot.
33yaml_data = '''
34bmpblock: 1.0
35
36images:
37 devmode: DeveloperBmp/DeveloperBmp.bmp
38 recovery: RecoveryBmp/RecoveryBmp.bmp
39 rec_yuck: RecoveryNoOSBmp/RecoveryNoOSBmp.bmp
40 rec_insert: RecoveryMissingOSBmp/RecoveryMissingOSBmp.bmp
41
42screens:
43 dev_en:
44 - [0, 0, devmode]
45 rec_en:
46 - [0, 0, recovery]
47 yuck_en:
48 - [0, 0, rec_yuck]
49 ins_en:
50 - [0, 0, rec_insert]
51
52localizations:
53 - [ dev_en, rec_en, yuck_en, ins_en ]
54'''
55
56class Bundle:
Simon Glass290a1802011-07-17 13:54:32 -070057 """This class encapsulates the entire bundle firmware logic.
Simon Glass89b86b82011-07-17 23:49:49 -070058
Simon Glass290a1802011-07-17 13:54:32 -070059 Sequence of events:
60 bundle = Bundle(tools.Tools(), cros_output.Output())
61 bundle.SetDirs(...)
62 bundle.SetFiles(...)
63 bundle.SetOptions(...)
64 bundle.SelectFdt(fdt.Fdt('filename.dtb')
65 .. can call bundle.AddConfigList() if required
66 bundle.Start(...)
Simon Glass89b86b82011-07-17 23:49:49 -070067
Simon Glass290a1802011-07-17 13:54:32 -070068 Public properties:
69 fdt: The fdt object that we use for building our image. This wil be the
70 one specified by the user, except that we might add config options
71 to it. This is set up by SelectFdt() which must be called before
72 bundling starts.
73 uboot_fname: Full filename of the U-Boot binary we use.
74 bct_fname: Full filename of the BCT file we use.
75 """
Simon Glass89b86b82011-07-17 23:49:49 -070076
Simon Glass290a1802011-07-17 13:54:32 -070077 def __init__(self, tools, output):
78 """Set up a new Bundle object.
Simon Glass89b86b82011-07-17 23:49:49 -070079
Simon Glass290a1802011-07-17 13:54:32 -070080 Args:
81 tools: A tools.Tools object to use for external tools.
82 output: A cros_output.Output object to use for program output.
Simon Glass89b86b82011-07-17 23:49:49 -070083 """
Simon Glass290a1802011-07-17 13:54:32 -070084 self.text_base = None # Base of U-Boot image in memory
85
86 self._tools = tools
87 self._out = output
88
89 # Set up the things we need to know in order to operate.
90 self._board = None # Board name, e.g. tegra2_seaboard.
91 self._fdt_fname = None # Filename of our FDT.
92 self.uboot_fname = None # Filename of our U-Boot binary.
93 self.bct_fname = None # Filename of our BCT file.
94 self.fdt = None # Our Fdt object.
Hung-Te Lin5b649382011-08-03 15:01:16 +080095 self.bmpblk_fname = None # Filename of our Bitmap Block
Stefan Reinauer8d79d362011-08-16 14:20:43 -070096 self.coreboot_fname = None # Filename of our coreboot binary.
Simon Glass290a1802011-07-17 13:54:32 -070097
98 def SetDirs(self, keydir):
99 """Set up directories required for Bundle.
100
101 Args:
102 keydir: Directory containing keys to use for signing firmware.
103 """
104 self._keydir = keydir
105
Simon Glass6dcc2f22011-07-28 15:26:49 +1200106 def SetFiles(self, board, bct, uboot=None, bmpblk=None, coreboot=None,
107 postload=None):
Simon Glass290a1802011-07-17 13:54:32 -0700108 """Set up files required for Bundle.
109
110 Args:
111 board: The name of the board to target (e.g. tegra2_seaboard).
112 uboot: The filename of the u-boot.bin image to use.
113 bct: The filename of the binary BCT file to use.
Hung-Te Lin5b649382011-08-03 15:01:16 +0800114 bmpblk: The filename of bitmap block file to use.
Stefan Reinauer8d79d362011-08-16 14:20:43 -0700115 coreboot: The filename of the coreboot image to use (on x86)
Simon Glass6dcc2f22011-07-28 15:26:49 +1200116 postload: The filename of the u-boot-post.bin image to use.
Simon Glass290a1802011-07-17 13:54:32 -0700117 """
118 self._board = board
119 self.uboot_fname = uboot
120 self.bct_fname = bct
Hung-Te Lin5b649382011-08-03 15:01:16 +0800121 self.bmpblk_fname = bmpblk
Stefan Reinauer8d79d362011-08-16 14:20:43 -0700122 self.coreboot_fname = coreboot
Simon Glass6dcc2f22011-07-28 15:26:49 +1200123 self.postload_fname = postload
Simon Glass290a1802011-07-17 13:54:32 -0700124
125 def SetOptions(self, small):
126 """Set up options supported by Bundle.
127
128 Args:
129 small: Only create a signed U-Boot - don't produce the full packed
130 firmware image. This is useful for devs who want to replace just the
131 U-Boot part while keeping the keys, gbb, etc. the same.
132 """
133 self._small = small
134
135 def CheckOptions(self):
136 """Check provided options and select defaults."""
137 if not self._board:
138 raise ValueError('No board defined - please define a board to use')
Simon Glass493163b2011-09-14 11:19:57 -0700139 build_root = os.path.join('##', 'build', self._board, 'firmware')
Simon Glass290a1802011-07-17 13:54:32 -0700140 if not self._fdt_fname:
141 self._fdt_fname = os.path.join(build_root, 'dtb', '%s.dtb' %
142 re.sub('_', '-', self._board))
143 if not self.uboot_fname:
144 self.uboot_fname = os.path.join(build_root, 'u-boot.bin')
145 if not self.bct_fname:
146 self.bct_fname = os.path.join(build_root, 'bct', 'board.bct')
Simon Glass2a7f0b32011-08-26 11:25:17 -0700147 if not self.bmpblk_fname:
148 self.bmpblk_fname = os.path.join(build_root, 'default.bmpblk')
Simon Glass89b86b82011-07-17 23:49:49 -0700149
Simon Glass56577572011-07-19 11:08:06 +1200150 def _CreateGoogleBinaryBlock(self, hardware_id):
Simon Glass89b86b82011-07-17 23:49:49 -0700151 """Create a GBB for the image.
152
Simon Glass56577572011-07-19 11:08:06 +1200153 Args:
154 hardware_id: Hardware ID to use for this board. If None, then the
155 default from the Fdt will be used
156
Simon Glass89b86b82011-07-17 23:49:49 -0700157 Returns:
158 Path of the created GBB file.
159
160 Raises:
161 CmdError if a command fails.
162 """
Simon Glass56577572011-07-19 11:08:06 +1200163 if not hardware_id:
164 hardware_id = self.fdt.GetString('/config/hwid')
Simon Glass89b86b82011-07-17 23:49:49 -0700165 gbb_size = self.fdt.GetFlashPartSize('ro', 'gbb')
Simon Glass290a1802011-07-17 13:54:32 -0700166 odir = self._tools.outdir
Simon Glass89b86b82011-07-17 23:49:49 -0700167
Simon Glass89b86b82011-07-17 23:49:49 -0700168 self._out.Progress('Creating GBB')
169 sizes = [0x100, 0x1000, gbb_size - 0x2180, 0x1000]
170 sizes = ['%#x' % size for size in sizes]
171 gbb = 'gbb.bin'
Simon Glass290a1802011-07-17 13:54:32 -0700172 keydir = self._tools.Filename(self._keydir)
173 self._tools.Run('gbb_utility', ['-c', ','.join(sizes), gbb], cwd=odir)
Simon Glass89b86b82011-07-17 23:49:49 -0700174 self._tools.Run('gbb_utility', ['-s',
Simon Glass56577572011-07-19 11:08:06 +1200175 '--hwid=%s' % hardware_id,
Simon Glass89b86b82011-07-17 23:49:49 -0700176 '--rootkey=%s/root_key.vbpubk' % keydir,
177 '--recoverykey=%s/recovery_key.vbpubk' % keydir,
Simon Glass2a7f0b32011-08-26 11:25:17 -0700178 '--bmpfv=%s' % self._tools.Filename(self.bmpblk_fname),
Simon Glass89b86b82011-07-17 23:49:49 -0700179 gbb],
Simon Glass290a1802011-07-17 13:54:32 -0700180 cwd=odir)
181 return os.path.join(odir, gbb)
Simon Glass89b86b82011-07-17 23:49:49 -0700182
Simon Glasse13ee2c2011-07-28 08:12:28 +1200183 def _SignBootstub(self, bct, bootstub, text_base):
Simon Glass89b86b82011-07-17 23:49:49 -0700184 """Sign an image so that the Tegra SOC will boot it.
185
186 Args:
187 bct: BCT file to use.
188 bootstub: Boot stub (U-Boot + fdt) file to sign.
189 text_base: Address of text base for image.
Simon Glass89b86b82011-07-17 23:49:49 -0700190
191 Returns:
192 filename of signed image.
193
194 Raises:
195 CmdError if a command fails.
196 """
197 # First create a config file - this is how we instruct cbootimage
Simon Glasse13ee2c2011-07-28 08:12:28 +1200198 signed = os.path.join(self._tools.outdir, 'signed.bin')
Simon Glass89b86b82011-07-17 23:49:49 -0700199 self._out.Progress('Signing Bootstub')
Simon Glasse13ee2c2011-07-28 08:12:28 +1200200 config = os.path.join(self._tools.outdir, 'boot.cfg')
Simon Glass89b86b82011-07-17 23:49:49 -0700201 fd = open(config, 'w')
202 fd.write('Version = 1;\n')
203 fd.write('Redundancy = 1;\n')
204 fd.write('Bctfile = %s;\n' % bct)
205 fd.write('BootLoader = %s,%#x,%#x,Complete;\n' % (bootstub, text_base,
206 text_base))
207 fd.close()
208
209 self._tools.Run('cbootimage', [config, signed])
210 self._tools.OutputSize('BCT', bct)
211 self._tools.OutputSize('Signed image', signed)
212 return signed
213
Doug Anderson86ce5f42011-07-27 10:40:18 -0700214 def SetBootcmd(self, bootcmd, bootsecure):
Simon Glass290a1802011-07-17 13:54:32 -0700215 """Set the boot command for U-Boot.
Simon Glass89b86b82011-07-17 23:49:49 -0700216
217 Args:
Simon Glass290a1802011-07-17 13:54:32 -0700218 bootcmd: Boot command to use, as a string (if None this this is a nop).
Doug Anderson86ce5f42011-07-27 10:40:18 -0700219 bootsecure: We'll set '/config/bootsecure' to 1 if True and 0 if False.
Simon Glass89b86b82011-07-17 23:49:49 -0700220 """
Simon Glass290a1802011-07-17 13:54:32 -0700221 if bootcmd:
Simon Glassb4447fd2011-07-26 11:18:25 +1200222 self.fdt.PutString('/config/bootcmd', bootcmd)
Doug Anderson86ce5f42011-07-27 10:40:18 -0700223 self.fdt.PutInteger('/config/bootsecure', int(bootsecure))
Simon Glass290a1802011-07-17 13:54:32 -0700224 self._out.Info('Boot command: %s' % bootcmd)
Simon Glass89b86b82011-07-17 23:49:49 -0700225
Simon Glass290a1802011-07-17 13:54:32 -0700226 def AddConfigList(self, config_list, use_int=False):
227 """Add a list of config items to the fdt.
228
229 Normally these values are written to the fdt as strings, but integers
230 are also supported, in which case the values will be converted to integers
231 (if necessary) before being stored.
232
233 Args:
234 config_list: List of (config, value) tuples to add to the fdt. For each
235 tuple:
236 config: The fdt node to write to will be /config/<config>.
237 value: An integer or string value to write.
238 use_int: True to only write integer values.
239
240 Raises:
241 CmdError: if a value is required to be converted to integer but can't be.
242 """
243 if config_list:
244 for config in config_list:
245 value = config[1]
246 if use_int:
247 try:
248 value = int(value)
249 except ValueError as str:
250 raise CmdError("Cannot convert config option '%s' to integer" %
251 value)
252 if type(value) == type(1):
253 self.fdt.PutInteger('/config/%s' % config[0], value)
254 else:
255 self.fdt.PutString('/config/%s' % config[0], value)
256
Simon Glass6dcc2f22011-07-28 15:26:49 +1200257 def _CreateBootStub(self, uboot, base_fdt, postload):
Simon Glass89b86b82011-07-17 23:49:49 -0700258 """Create a boot stub and a signed boot stub.
259
Simon Glass6dcc2f22011-07-28 15:26:49 +1200260 For postload:
261 We add a /config/postload-text-offset entry to the signed bootstub's
262 fdt so that U-Boot can find the postload code.
263
264 The raw (unsigned) bootstub will have a value of -1 for this since we will
265 simply append the postload code to the bootstub and it can find it there.
266 This will be used for RW A/B firmware.
267
268 For the signed case this value will specify where in the flash to find
269 the postload code. This will be used for RO firmware.
270
Simon Glass89b86b82011-07-17 23:49:49 -0700271 Args:
272 uboot: Path to u-boot.bin (may be chroot-relative)
Simon Glass6dcc2f22011-07-28 15:26:49 +1200273 fdt: Fdt object containing the flat device tree.
274 postload: Path to u-boot-post.bin, or None if none.
Simon Glass89b86b82011-07-17 23:49:49 -0700275
276 Returns:
277 Tuple containing:
Simon Glass6dcc2f22011-07-28 15:26:49 +1200278 Full path to bootstub (uboot + fdt(-1) + postload).
279 Full path to signed (uboot + fdt(flash pos) + bct) + postload.
Simon Glass89b86b82011-07-17 23:49:49 -0700280
281 Raises:
282 CmdError if a command fails.
283 """
Simon Glasse13ee2c2011-07-28 08:12:28 +1200284 bootstub = os.path.join(self._tools.outdir, 'u-boot-fdt.bin')
Simon Glass290a1802011-07-17 13:54:32 -0700285 text_base = self.fdt.GetInt('/chromeos-config/textbase');
Simon Glass89b86b82011-07-17 23:49:49 -0700286 uboot_data = self._tools.ReadFile(uboot)
Simon Glass6dcc2f22011-07-28 15:26:49 +1200287
288 # Make a copy of the fdt for the bootstub
289 fdt = base_fdt.Copy(os.path.join(self._tools.outdir, 'bootstub.dtb'))
290 fdt.PutInteger('/config/postload-text-offset', 0xffffffff);
Simon Glass290a1802011-07-17 13:54:32 -0700291 fdt_data = self._tools.ReadFile(fdt.fname)
Simon Glasse13ee2c2011-07-28 08:12:28 +1200292
Simon Glass89b86b82011-07-17 23:49:49 -0700293 self._tools.WriteFile(bootstub, uboot_data + fdt_data)
Simon Glass290a1802011-07-17 13:54:32 -0700294 self._tools.OutputSize('U-Boot binary', self.uboot_fname)
295 self._tools.OutputSize('U-Boot fdt', self._fdt_fname)
Simon Glass89b86b82011-07-17 23:49:49 -0700296 self._tools.OutputSize('Combined binary', bootstub)
297
Simon Glasse13ee2c2011-07-28 08:12:28 +1200298 # Sign the bootstub; this is a combination of the board specific
Simon Glass89b86b82011-07-17 23:49:49 -0700299 # bct and the stub u-boot image.
Simon Glass290a1802011-07-17 13:54:32 -0700300 signed = self._SignBootstub(self._tools.Filename(self.bct_fname),
Simon Glasse13ee2c2011-07-28 08:12:28 +1200301 bootstub, text_base)
Simon Glass6dcc2f22011-07-28 15:26:49 +1200302
303 signed_postload = os.path.join(self._tools.outdir, 'signed-postload.bin')
304 data = self._tools.ReadFile(signed)
305
306 if postload:
307 # We must add postload to the bootstub since A and B will need to
308 # be able to find it without the /config/postload-text-offset mechanism.
309 bs_data = self._tools.ReadFile(bootstub)
310 bs_data += self._tools.ReadFile(postload)
311 bootstub = os.path.join(self._tools.outdir, 'u-boot-fdt-postload.bin')
312 self._tools.WriteFile(bootstub, bs_data)
313 self._tools.OutputSize('Combined binary with postload', bootstub)
314
315 # Now that we know the file size, adjust the fdt and re-sign
316 postload_bootstub = os.path.join(self._tools.outdir, 'postload.bin')
317 fdt.PutInteger('/config/postload-text-offset', len(data))
318 fdt_data = self._tools.ReadFile(fdt.fname)
319 self._tools.WriteFile(postload_bootstub, uboot_data + fdt_data)
320 signed = self._SignBootstub(self._tools.Filename(self.bct_fname),
321 postload_bootstub, text_base)
322 if len(data) != os.path.getsize(signed):
323 raise CmdError('Signed file size changed from %d to %d after updating '
324 'fdt' % (len(data), os.path.getsize(signed)))
325
326 # Re-read the signed image, and add the post-load binary.
327 data = self._tools.ReadFile(signed)
328 data += self._tools.ReadFile(postload)
329 self._tools.OutputSize('Post-load binary', postload)
330
331 self._tools.WriteFile(signed_postload, data)
332 self._tools.OutputSize('Final bootstub with postload', signed_postload)
333
334 return bootstub, signed_postload
Simon Glass89b86b82011-07-17 23:49:49 -0700335
Stefan Reinauerc2e1e4d2011-08-23 14:50:59 -0700336 def _CreateCorebootStub(self, uboot, coreboot, fdt):
337 """Create a coreboot boot stub.
338
339 Args:
340 uboot: Path to u-boot.bin (may be chroot-relative)
341 coreboot: Path to coreboot.rom
342 fdt: Device Tree
343
344 Returns:
345 Full path to bootstub (coreboot + uboot + fdt).
346
347 Raises:
348 CmdError if a command fails.
349 """
350 bootstub = os.path.join(self._tools.outdir, 'coreboot-full.rom')
Stefan Reinauer17c19622011-09-16 12:47:41 -0700351 cbfstool = "/usr/bin/cbfstool"
Stefan Reinauerc2e1e4d2011-08-23 14:50:59 -0700352 uboot_elf = uboot.replace(".bin", ".elf")
353 shutil.copyfile(coreboot, bootstub)
354 self._tools.Run(cbfstool, [bootstub, 'add-payload', uboot_elf,
355 'fallback/payload', 'lzma'])
356 self._tools.Run(cbfstool, [bootstub, 'add', fdt.fname, 'u-boot.dtb',
357 '0xac'])
358 return bootstub
359
Simon Glass89b86b82011-07-17 23:49:49 -0700360 def _PackOutput(self, msg):
361 """Helper function to write output from PackFirmware (verbose level 2).
362
363 This is passed to PackFirmware for it to use to write output.
364
365 Args:
366 msg: Message to display.
367 """
368 self._out.Notice(msg)
369
Simon Glass290a1802011-07-17 13:54:32 -0700370 def _CreateImage(self, gbb, fdt):
Simon Glass89b86b82011-07-17 23:49:49 -0700371 """Create a full firmware image, along with various by-products.
372
373 This uses the provided u-boot.bin, fdt and bct to create a firmware
374 image containing all the required parts. If the GBB is not supplied
375 then this will just return a signed U-Boot as the image.
376
377 Args:
Simon Glasse13ee2c2011-07-28 08:12:28 +1200378 gbb: Full path to the GBB file, or empty if a GBB is not required.
379 fdt: Fdt object containing required information.
380
381 Returns:
382 Path to image file
Simon Glass89b86b82011-07-17 23:49:49 -0700383
384 Raises:
385 CmdError if a command fails.
386 """
Simon Glass290a1802011-07-17 13:54:32 -0700387 self._out.Notice("Model: %s" % fdt.GetString('/model'))
Simon Glass89b86b82011-07-17 23:49:49 -0700388
Stefan Reinauer8d79d362011-08-16 14:20:43 -0700389 if self.coreboot_fname:
390 # FIXME(reinauer) the names are not too great choices.
391 # signed gets packed into the bootstub, and bootstub gets
392 # packed into the RW sections.
Stefan Reinauerc2e1e4d2011-08-23 14:50:59 -0700393 signed = self._CreateCorebootStub(self.uboot_fname,
394 self.coreboot_fname, fdt)
Stefan Reinauer8d79d362011-08-16 14:20:43 -0700395 bootstub = self.uboot_fname
396 else:
397 # Create the boot stub, which is U-Boot plus an fdt and bct
Simon Glass6dcc2f22011-07-28 15:26:49 +1200398 bootstub, signed = self._CreateBootStub(self.uboot_fname, fdt,
399 self.postload_fname)
Simon Glass89b86b82011-07-17 23:49:49 -0700400
401 if gbb:
402 pack = PackFirmware(self._tools, self._out)
403 image = os.path.join(self._tools.outdir, 'image.bin')
Hung-Te Lina7462e72011-07-27 19:17:10 +0800404 fwid = '.'.join([
405 re.sub('[ ,]+', '_', fdt.GetString('/model')),
406 self._tools.GetChromeosVersion()])
Simon Glass89b86b82011-07-17 23:49:49 -0700407 self._out.Notice('Firmware ID: %s' % fwid)
408 pack.SetupFiles(boot=bootstub, signed=signed, gbb=gbb,
Simon Glass290a1802011-07-17 13:54:32 -0700409 fwid=fwid, keydir=self._keydir)
410 pack.SelectFdt(fdt)
Simon Glass89b86b82011-07-17 23:49:49 -0700411 pack.PackImage(self._tools.outdir, image)
412 else:
413 image = signed
414
415 self._tools.OutputSize('Final image', image)
Simon Glasse13ee2c2011-07-28 08:12:28 +1200416 return image
Simon Glass89b86b82011-07-17 23:49:49 -0700417
Simon Glass290a1802011-07-17 13:54:32 -0700418 def SelectFdt(self, fdt_fname):
419 """Select an FDT to control the firmware bundling
420
421 Args:
422 fdt_fname: The filename of the fdt to use.
423
Simon Glassc0f3dc62011-08-09 14:19:05 -0700424 Returns:
425 The Fdt object of the original fdt file, which we will not modify.
426
Simon Glass290a1802011-07-17 13:54:32 -0700427 We make a copy of this which will include any on-the-fly changes we want
428 to make.
429 """
430 self._fdt_fname = fdt_fname
431 self.CheckOptions()
432 fdt = Fdt(self._tools, self._fdt_fname)
433 self.fdt = fdt.Copy(os.path.join(self._tools.outdir, 'updated.dtb'))
Simon Glassc0f3dc62011-08-09 14:19:05 -0700434 return fdt
Simon Glass290a1802011-07-17 13:54:32 -0700435
Simon Glass56577572011-07-19 11:08:06 +1200436 def Start(self, hardware_id, output_fname):
Simon Glass290a1802011-07-17 13:54:32 -0700437 """This creates a firmware bundle according to settings provided.
Simon Glass89b86b82011-07-17 23:49:49 -0700438
439 - Checks options, tools, output directory, fdt.
440 - Creates GBB and image.
Simon Glass290a1802011-07-17 13:54:32 -0700441
442 Args:
Simon Glass56577572011-07-19 11:08:06 +1200443 hardware_id: Hardware ID to use for this board. If None, then the
444 default from the Fdt will be used
Simon Glass290a1802011-07-17 13:54:32 -0700445 output_fname: Output filename for the image. If this is not None, then
446 the final image will be copied here.
447
448 Returns:
449 Filename of the resulting image (not the output_fname copy).
Simon Glass89b86b82011-07-17 23:49:49 -0700450 """
Simon Glass89b86b82011-07-17 23:49:49 -0700451 gbb = ''
Simon Glass290a1802011-07-17 13:54:32 -0700452 if not self._small:
Simon Glass56577572011-07-19 11:08:06 +1200453 gbb = self._CreateGoogleBinaryBlock(hardware_id)
Simon Glass89b86b82011-07-17 23:49:49 -0700454
455 # This creates the actual image.
Simon Glasse13ee2c2011-07-28 08:12:28 +1200456 image = self._CreateImage(gbb, self.fdt)
Simon Glass290a1802011-07-17 13:54:32 -0700457 if output_fname:
458 shutil.copyfile(image, output_fname)
459 self._out.Notice("Output image '%s'" % output_fname)
460 return image