Make sure dts files are available for firmware programming

Arm firmware tarballs include the device tree subdirectory. The device
trees must be visible by the firmware programmer for proper reimaging
of ARM platforms.

BUG=chrome-os-partner:15610
TEST=manual
   . execute the following command:

    $ run_remote_tests.sh --allow_offline_remote --use_emerged --board=daisy \
       --remote=192.168.1.116 fwupdate --args \
       'fwurl=gs://chromeos-releases/canary-channel/daisy/3721.0.0/ChromeOS-firmware-R27-3721.0.0-daisy.tar.bz2 \
        board=snow servo_host=192.168.1.115'

      the command still fails, but the dts directory is there on the
      servo host after this command has been executed.

Change-Id: Ic200722aec54c7b76cd6aa0cf743ddee05857409
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43482
Reviewed-by: Alex Miller <milleral@chromium.org>
diff --git a/server/cros/servo.py b/server/cros/servo.py
index b45e596..83f6377 100644
--- a/server/cros/servo.py
+++ b/server/cros/servo.py
@@ -131,7 +131,7 @@
             common_options = '-o PasswordAuthentication=no'
             self._sudo_required = False
             self._ssh_prefix = 'ssh %s root@%s ' % (common_options, servo_host)
-            self._scp_cmd_template = 'scp %s ' % common_options
+            self._scp_cmd_template = 'scp -r %s ' % common_options
             self._scp_cmd_template += '%s ' + 'root@' + servo_host + ':%s'
 
     def initialize_dut(self, cold_reset=False):
@@ -625,16 +625,36 @@
 
 
     def program_ec(self, board, image):
-        """Program EC on a given board using given image."""
+        """Program EC on a given board using given image.
+
+        @param board: a string, type of the DUT board
+        @param image: a string, file name of the EC image to program on the
+                      DUT
+        """
         if not self.is_localhost():
             image = self._scp_image(image)
         programmer.program_ec(board, self, image)
 
 
     def program_bootprom(self, board, image):
-        """Program bootprom on a given board using given image."""
+        """Program bootprom on a given board using given image.
+
+        In case servo is controlled by a remote host, the image needs to be
+        transferred to the host.
+
+        If the device tree subdirectory is present along with the image, the
+        subdirectory is also copied to the remote host.
+
+        @param board: a string, type of the DUT board
+        @param image: a string, file name of the firmware image to program on
+                      the DUT. The device tree subdirectory, if present, is on
+                      the same level with the image file.
+        """
         if not self.is_localhost():
+            dts_path = os.path.join(os.path.dirname(image), 'dts')
             image = self._scp_image(image)
+            if os.path.isdir(dts_path):
+                self._scp_image(dts_path)
         programmer.program_bootprom(board, self, image)
 
     def switch_usbkey(self, side):