dtoc: Allow the device tree to be compiled from source

If a source device tree is provide to the Fdt() constructors, compile it
automatically. This will be used in tests, where we want to build a
particular test .dts file and check that it works correctly in binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py
index 861f60c..d9ba4ac 100644
--- a/tools/dtoc/fdt_normal.py
+++ b/tools/dtoc/fdt_normal.py
@@ -83,8 +83,11 @@
     """
     def __init__(self, fname):
         Fdt.__init__(self, fname)
-        with open(self._fname) as fd:
-            self._fdt = fd.read()
+        if self._fname:
+            self._fname = fdt_util.EnsureCompiled(self._fname)
+
+            with open(self._fname) as fd:
+                self._fdt = fd.read()
 
     def GetFdt(self):
         """Get the contents of the FDT