write_firmware: switch from nvflash to tegrarcm

tegrarcm is an open source replacement to nvflash for writing firmware
to tegra devices.

BUG=None
TEST=emerged and flashed tegra2_seaboard with "cros_bundle_firmware -w
usb -F spi"
CQ-DEPEND=I8b998b04065846293e4c100f00db9c6ed6fe4e54

Change-Id: I1792836fd45aa9566536674c9e2c801e7843938c
Reviewed-on: https://gerrit.chromium.org/gerrit/25846
Tested-by: Allen Martin <amartin@nvidia.com>
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Allen Martin <amartin@nvidia.com>
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index 7b8f831..3b73bdf 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -225,7 +225,7 @@
     """Flash the image to SPI flash.
 
     This creates a special Flasher binary, with the image to be flashed as
-    a payload. This is then sent to the board using the nvflash utility.
+    a payload. This is then sent to the board using the tegrarcm utility.
 
     Args:
       flash_dest: Destination for flasher, or None to not create a flasher
@@ -259,10 +259,8 @@
     self._out.Progress('Uploading flasher image')
     args = [
       '--bct', bct,
-      '--setbct',
-      '--bl',  image,
-      '--go',
-      '--setentry', "%#x" % self.text_base, "%#x" % self.text_base
+      '--bootloader',  image,
+      '--loadaddr', "%#x" % self.text_base
     ]
 
     # TODO(sjg): Check for existence of board - but chroot has no lsusb!
@@ -270,7 +268,7 @@
     for tries in range(10):
       try:
         # TODO(sjg): Use Chromite library so we can monitor output
-        self._tools.Run('nvflash', args, sudo=True)
+        self._tools.Run('tegrarcm', args, sudo=True)
         self._out.Notice('Flasher downloaded - please see serial output '
             'for progress.')
         return True
@@ -282,7 +280,7 @@
         # Only show the error output once unless it changes.
         err = str(err)
         if not 'USB device not found' in err:
-          raise CmdError('nvflash failed: %s' % err)
+          raise CmdError('tegrarcm failed: %s' % err)
 
         if err != last_err:
           self._out.Notice(err)
@@ -358,7 +356,7 @@
     """Flash the image to SPI flash.
 
     This creates a special Flasher binary, with the image to be flashed as
-    a payload. This is then sent to the board using the nvflash utility.
+    a payload. This is then sent to the board using the tegrarcm utility.
 
     Args:
       flash_dest: Destination for flasher, or None to not create a flasher
@@ -628,7 +626,7 @@
   if dest == 'usb':
     method = fdt.GetString('/chromeos-config', 'flash-method', 'tegra')
     if method == 'tegra':
-      tools.CheckTool('nvflash')
+      tools.CheckTool('tegrarcm')
       bootstub = props['bootstub']
       if flash_dest:
         write.text_base = bundle.CalcTextBase('flasher ', fdt, flasher)