=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py	2011-10-24 07:49:16 +0000
+++ lava_dispatcher/actions/android_deploy.py	2011-11-15 08:08:40 +0000
@@ -126,6 +126,7 @@
     def deploy_linaro_android_testboot(self, boottbz2, pkgbz2=None):
         logging.info("Deploying test boot filesystem")
         client = self.client
+        client.run_cmd_master('umount /dev/disk/by-label/testboot')
         client.run_cmd_master('mkfs.vfat /dev/disk/by-label/testboot '
                               '-n testboot')
         client.run_cmd_master('udevadm trigger')
@@ -145,6 +146,13 @@
     def recreate_uInitrd(self):
         logging.info("Recreate uInitrd")
         client = self.client
+        # Original android sdcard partition layout by l-a-m-c
+        sys_part_org = client.device_option("sys_part_android_org")
+        cache_part_org = client.device_option("cache_part_android_org")
+        data_part_org = client.device_option("data_part_android_org")
+        # Sdcard layout in Lava image
+        sys_part_lava = client.device_option("sys_part_android")
+
         client.run_cmd_master('mkdir -p ~/tmp/')
         client.run_cmd_master('mv /mnt/lava/boot/uInitrd ~/tmp')
         client.run_cmd_master('cd ~/tmp/')
@@ -154,10 +162,13 @@
         client.run_cmd_master(
             'gzip -d ramdisk.cpio.gz; cpio -i -F ramdisk.cpio')
         client.run_cmd_master(
-            'sed -i "/mount ext4 \/dev\/block\/mmcblk0p3/d" init.rc')
+            'sed -i "/mount ext4 \/dev\/block\/mmcblk0p%s/d" init.rc'
+            % cache_part_org)
         client.run_cmd_master(
-            'sed -i "/mount ext4 \/dev\/block\/mmcblk0p5/d" init.rc')
-        client.run_cmd_master('sed -i "s/mmcblk0p2/mmcblk0p5/g" init.rc')
+            'sed -i "/mount ext4 \/dev\/block\/mmcblk0p%s/d" init.rc'
+            % data_part_org)
+        client.run_cmd_master('sed -i "s/mmcblk0p%s/mmcblk0p%s/g" init.rc'
+            % (sys_part_org, sys_part_lava))
         client.run_cmd_master(
             'sed -i "/export PATH/a \ \ \ \ export PS1 root@linaro: " init.rc')
 
@@ -176,6 +187,9 @@
     def deploy_linaro_android_testrootfs(self, systemtbz2):
         logging.info("Deploying the test root filesystem")
         client = self.client
+        sdcard_part_lava = client.device_option("sdcard_part_android")
+
+        client.run_cmd_master('umount /dev/disk/by-label/testrootfs')
         client.run_cmd_master(
             'mkfs.ext4 -q /dev/disk/by-label/testrootfs -L testrootfs')
         client.run_cmd_master('udevadm trigger')
@@ -186,8 +200,8 @@
             'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % systemtbz2,
             600)
 
-        sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard 6 " \
-            "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0"
+        sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard %s " \
+            "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0" %sdcard_part_lava
         client.run_cmd_master(
             'sed -i "%s" /mnt/lava/system/etc/vold.fstab' % sed_cmd)
         client.run_cmd_master('umount /mnt/lava/system')

=== modified file 'lava_dispatcher/actions/lava-android-test.py'
--- lava_dispatcher/actions/lava-android-test.py	2011-11-02 20:22:23 +0000
+++ lava_dispatcher/actions/lava-android-test.py	2011-11-16 04:54:54 +0000
@@ -74,6 +74,7 @@
         cmd = 'lava-android-test run %s -s %s -o %s/%s.bundle' % (
                 test_name, dev_name, self.context.host_result_dir, bundle_name)
 
+        logging.info("Execute command on host: %s" % cmd)
         rc = pexpect.run(cmd, timeout=None, logfile=sys.stdout, withexitstatus=True)[1]
         if rc != 0:
             raise OperationFailed("Failed to run test case(%s) on device(%s) with return value: %s" % (test_name, dev_name, rc))
@@ -88,6 +89,7 @@
             cmd = 'lava-android-test install %s -s %s' % (test, dev_name)
             if option is not None:
                 cmd += ' -o ' + option
+            logging.info("Execute command on host: %s" % cmd)
             rc = pexpect.run(cmd, timeout=None, logfile=sys.stdout, withexitstatus=True)[1]
             if rc != 0:
                 raise OperationFailed("Failed to install test case(%s) on device(%s) with return value: %s" % (test, dev_name, rc))

=== modified file 'lava_dispatcher/client.py'
--- lava_dispatcher/client.py	2011-11-16 03:51:11 +0000
+++ lava_dispatcher/client.py	2011-11-16 04:54:54 +0000
@@ -171,12 +171,14 @@
     def run_cmd_tester(self, cmd, timeout=-1):
         return self.run_shell_command(cmd, self.tester_str, timeout)
 
-    def check_network_up(self):
+    def _check_network_up(self):
+        """
+        Internal function for checking network one time
+        """
         lava_server_ip = self.context.lava_server_ip
         self.proc.sendline("LC_ALL=C ping -W4 -c1 %s" % lava_server_ip)
         id = self.proc.expect(["1 received", "0 received",
             "Network is unreachable"], timeout=5)
-        self.proc.expect(self.master_str)
         if id == 0:
             return True
         else:
@@ -185,7 +187,7 @@
     def wait_network_up(self, timeout=300):
         now = time.time()
         while time.time() < now+timeout:
-            if self.check_network_up():
+            if self._check_network_up():
                 return
         raise NetworkError
 
@@ -211,8 +213,7 @@
             ip = self.proc.match.groups()[0]
             logging.info("Master IP is %s" % ip)
             return ip
-        else:
-            return None
+        return None
 
     def export_display(self):
         #export the display, ignore errors on non-graphical images
@@ -245,9 +246,10 @@
         pattern3 = "unable to connect to"
 
         cmd = "adb connect %s" % dev_ip
+        logging.info("Execute adb command on host: %s" % cmd)
         adb_proc = pexpect.spawn(cmd, timeout=300, logfile=sys.stdout)
         match_id = adb_proc.expect([pattern1, pattern2, pattern3, pexpect.EOF])
-        if match_id == 0 or match_id == 1:
+        if match_id in [0, 1]:
             dev_name = adb_proc.match.groups()[0]
             return dev_name
         else:
@@ -255,6 +257,7 @@
 
     def android_adb_disconnect(self, dev_ip):
         cmd = "adb disconnect %s" % dev_ip
+        logging.info("Execute adb command on host: %s" % cmd)
         pexpect.run(cmd, timeout=300, logfile=sys.stdout)
 
     def get_default_nic_ip(self):
@@ -274,6 +277,11 @@
 
     def _get_default_nic_ip_by_ifconfig(self, nic_name):
         # Check network ip and setup adb connection
+        try:
+            self.wait_network_up()
+        except:
+            logging.warning(traceback.format_exc())
+            return None
         ip_pattern = "%s: ip (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) mask" % nic_name
         cmd = "ifconfig %s" % nic_name
         self.proc.sendline('')
@@ -299,16 +307,19 @@
 
 
     def android_adb_connect_over_default_nic_ip(self):
+        logging.info("adb connect over default network interface")
         dev_ip = self.get_default_nic_ip()
         if dev_ip is not None:
             return self.android_adb_connect(dev_ip)
 
     def android_adb_disconnect_over_default_nic_ip(self):
+        logging.info("adb disconnect over default network interface")
         dev_ip = self.get_default_nic_ip()
         if dev_ip is not None:
             self.android_adb_disconnect(dev_ip)
 
     def enable_adb_over_tcpip(self):
+        logging.info("Enable adb over TCPIP")
         self.proc.sendline('echo 0>/sys/class/android_usb/android0/enable')
         self.proc.sendline('setprop service.adb.tcp.port 5555')
         self.proc.sendline('stop adbd')

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2011-10-20 04:12:48 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf	2011-11-15 07:17:34 +0000
@@ -43,6 +43,32 @@
 # into sections to write onto the device.
 root_part = 2
 
+# Original linaro-android-media-create generated Android system SD card layout
+#
+# This is used to regenerate init script when Android bootup for partitions are
+# changed if deployed in LAVA test image
+# 
+# boot partition number in original Android, counting from 1
+boot_part_android_org = 1
+# sys partition number in original Android, counting from 1
+sys_part_android_org = 2
+# cache partition number in original Android, counting from 1
+cache_part_android_org = 3
+# data partition number in original Android, counting from 1
+data_part_android_org = 5
+# sdcard partition number in original Android, counting from 1
+sdcard_part_android_org = 6
+
+# Android LAVA test image SD card layout
+#
+# This is used to regenerate init script when Android bootup for partitions are
+# changed if deployed in LAVA test image
+# 
+# sys partition number in LAVA test image, counting from 1
+sys_part_android = 5
+# sdcard partition number in LAVA test image, counting from 1
+sdcard_part_android = 6
+
 # Master image recognization string
 MASTER_STR = root@master:
 

=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf	2011-10-20 04:09:15 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/mx53loco.conf	2011-11-15 07:17:34 +0000
@@ -7,4 +7,23 @@
     setenv bootargs "' console=tty0 console=ttymxc0,115200n8 
     root=LABEL=testrootfs rootwait ro'",
     boot
+
+# Original linaro-android-media-create generated Android system SD card layout
+boot_part_android_org = 2
+sys_part_android_org = 3
+cache_part_android_org = 5
+data_part_android_org = 6
+sdcard_part_android_org = 7
+
+# Android LAVA test image SD card layout
+sys_part_android = 6
+sdcard_part_android = 7
+boot_cmds_android = mmc init,
+    mmc part 0,
+    setenv bootcmd "'fatload mmc 0:5 0x70000000 uImage;
+    fatload mmc 0:5 0x72000000 uInitrd; bootm 0x70000000 0x72000000'",
+    setenv bootargs "'console=tty0 console=ttymxc0,115200n8 
+    rootwait ro earlyprintk rootdelay=1 fixrtc nocompcache di1_primary tve
+    init=/init androidboot.console=ttymxc0'",
+    boot
 bootloader_prompt = >

