cros_bundle_firmware: Move uboot handling code closer together

BUG=chromium:595715
BRANCH=none
TEST=none

Change-Id: I0c4321473bba06319a4553f8fb168ef04e7902a0
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/397619
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index 9dc326a..68effb9 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -958,14 +958,6 @@
 
     # Make a copy of the fdt for the bootstub
     fdt_data = self._tools.ReadFile(fdt.fname)
-    if self.uboot_fname:
-      uboot_data = self._tools.ReadFile(self.uboot_fname)
-      uboot_copy = os.path.join(self._tools.outdir, 'u-boot.bin')
-      self._tools.WriteFile(uboot_copy, uboot_data)
-
-      uboot_dtb = os.path.join(self._tools.outdir, 'u-boot-dtb.bin')
-      self._tools.WriteFile(uboot_dtb, uboot_data + fdt_data)
-
     # Fix up the coreboot image here, since we can't do this until we have
     # a final device tree binary.
     bootstub = pack.GetProperty('coreboot')
@@ -974,6 +966,13 @@
       self._tools.Run('cbfstool', [bootstub, 'add-payload', '-f',
           self.coreboot_elf, '-n', 'fallback/payload', '-c', 'lzma'])
     elif self.uboot_fname:
+      uboot_data = self._tools.ReadFile(self.uboot_fname)
+      uboot_copy = os.path.join(self._tools.outdir, 'u-boot.bin')
+      self._tools.WriteFile(uboot_copy, uboot_data)
+
+      uboot_dtb = os.path.join(self._tools.outdir, 'u-boot-dtb.bin')
+      self._tools.WriteFile(uboot_dtb, uboot_data + fdt_data)
+
       text_base = 0x1110000
 
       # This is the the 'movw $GD_FLG_COLD_BOOT, %bx' instruction