cros_bundle_firmware: Support USB download properly on Tegra
Now that we can select between downloading a flasher or a normal U-Boot
with the -F flag, support this on Tegra too.
BUG=chrome-os-partner:10075
TEST=manual:
build for seaboard
$ cros_bundle_firmware -w usb
See that it sends U-Boot to the board and it boots
$ cros_bundle_firmware -w usb -F spi
See that it sends a flasher to the board and it successfully flashes U-Boot.
Boot the new image from SPI and see that it works.
Change-Id: I2b570cbc3b6af5466239a4c16145181e3f75d9a2
Reviewed-on: https://gerrit.chromium.org/gerrit/24765
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index 6b30b3f..1d802d9 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -221,7 +221,7 @@
self._tools.OutputSize('Flasher', flasher)
return flasher
- def _NvidiaFlashImage(self, flash_dest, uboot, bct, payload):
+ def _NvidiaFlashImage(self, flash_dest, uboot, bct, payload, bootstub):
"""Flash the image to SPI flash.
This creates a special Flasher binary, with the image to be flashed as
@@ -233,6 +233,8 @@
uboot: Full path to u-boot.bin.
bct: Full path to BCT file (binary chip timings file for Nvidia SOCs).
payload: Full path to payload.
+ bootstub: Full path to bootstub, which is the payload without the
+ signing information (i.e. bootstub is u-boot.bin + the FDT)
Returns:
True if ok, False if failed.
@@ -247,14 +249,18 @@
boot_type = filter(match.match, bct_dumped)
boot_type = match.match(boot_type[0]).group('boot').lower()
- flasher = self.PrepareFlasher(uboot, payload, self.update, self.verify,
- boot_type, 0)
+ if flash_dest:
+ image = self.PrepareFlasher(uboot, payload, self.update, self.verify,
+ boot_type, 0)
+ else:
+ image = bootstub
+ self._out.Notice('TEXT_BASE is %#x' % self.text_base)
self._out.Progress('Uploading flasher image')
args = [
'--bct', bct,
'--setbct',
- '--bl', flasher,
+ '--bl', image,
'--go',
'--setentry', "%#x" % self.text_base, "%#x" % self.text_base
]
@@ -598,8 +604,13 @@
method = fdt.GetString('/chromeos-config', 'flash-method', 'tegra')
if method == 'tegra':
tools.CheckTool('nvflash')
+ bootstub = props['bootstub']
+ if flash_dest:
+ write.text_base = bundle.CalcTextBase('flasher ', fdt, flasher)
+ else:
+ write.text_base = bundle.CalcTextBase('bootstub ', fdt, bootstub)
ok = write._NvidiaFlashImage(flash_dest, flasher, file_list['bct'],
- image_fname)
+ image_fname, bootstub)
elif method == 'exynos':
tools.CheckTool('lsusb', 'usbutils')
tools.CheckTool('smdk-usbdl', 'smdk-dltool')