cros_bundle_firmware: Look up a FDT file given its root name

It is convenience to be able to specify something like '-d exynos5250-daisy'
and have cros_bundle_firmware find the right file.

BUG=chromium-os:28958
TEST=manual:
$ cros_write_firmware -b daisy -i /build/daisy/firmware/legacy_image.bin
-d exynos5250-daisy
See that it automatically finds the FDT file in the build firmware directory.

Change-Id: I805f58033f7e2386d60421ac657fbb960df88b0e
Reviewed-on: https://gerrit.chromium.org/gerrit/19598
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/bundle_firmware.py b/host/lib/bundle_firmware.py
index a605f15..2a2f5cd 100644
--- a/host/lib/bundle_firmware.py
+++ b/host/lib/bundle_firmware.py
@@ -145,9 +145,9 @@
     if not self._board:
       raise ValueError('No board defined - please define a board to use')
     build_root = os.path.join('##', 'build', self._board, 'firmware')
+    dir_name = os.path.join(build_root, 'dts')
     if not self._fdt_fname:
       # Figure out where the file should be, and the name we expect.
-      dir_name = os.path.join(build_root, 'dts')
       base_name = re.sub('_', '-', self._board)
 
       # In case the name exists with a prefix or suffix, find it.
@@ -159,6 +159,11 @@
         # We didn't find anything definite, so set up our expected name.
         self._fdt_fname = os.path.join(dir_name, '%s.dts' % base_name)
 
+    # Convert things like 'exynos5250-daisy' into a full path.
+    root, ext = os.path.splitext(self._fdt_fname)
+    if not ext and not os.path.dirname(root):
+      self._fdt_fname = os.path.join(dir_name, '%s.dts' % root)
+
     if not self.uboot_fname:
       self.uboot_fname = os.path.join(build_root, 'u-boot.bin')
     if not self.bct_fname: