 -	//for(i = 0; i < #_files; i++)
 -	for(i = 0; i < 1; i++)
 -	{
-+	ret = ext4fs_exists(file);
- 
+-
 -		ret = ext4fs_exists(file);
 -		if(!ret)
 -		{
 -			continue;
 -		}
--
++	ret = ext4fs_exists(file);
+ 
 -		printf("INFO: Found file to upgrade - %s\n", file);
 +	/*
 +	 * Upgrade file found, call the existing DFU utility
 +	 */
-+	if(ret)
++	if (ret)
 +	{
 +		debug("INFO: Found file to upgrade - %s\n", file);
  

+	else
+	{
+		part = UPGRADE_PART;
+	}
+
+	if(part_get_info(&mmc->block_dev, part, &part_info))
+	{
+		error("Could not mount upgrade partition.  No partition table\n");
 	}
 
 
-	printf("Info: Checking for new firmware files\n");
+	debug("INFO: Checking for new firmware files\n");

-		}
+			ret = update_tftp(addr, "mmc", "0");
 
+			if (ret)
+			{
+				error("System update failed - %d\n", ret);
+				return -1;
+			}
+		}
 	}
+	else
+	{
+		debug("INFO: No upgrade file found\n");
