bootm: refactor fdt locating and relocation code

Move the code that handles finding a device tree blob and relocating
it (if needed) into common code so all arch's have access to it.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 56236b9..9a745f1 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -258,6 +258,16 @@
 			puts ("Ramdisk image is corrupt\n");
 			return 1;
 		}
+
+#if defined(CONFIG_OF_LIBFDT)
+		/* find flattened device tree */
+		ret = boot_get_fdt (flag, argc, argv, &images,
+				    &images.ft_addr, &images.ft_len);
+		if (ret) {
+			puts ("Could not find a valid device tree\n");
+			return 1;
+		}
+#endif
 	}
 
 	image_start = (ulong)os_hdr;