manifest_test: Build DTs programatically
Manifest unit tests used to come with binary blobs of DTs to test.
This results in having the refresh all the blobs whenever a new required
property is added to the manifest. This patch adds a DTBuilder class
for programatically constructing a DT and compiling it with `dtc`.
Bug: 117551352
Change-Id: Ic6962ad494c200d612988cf25648dd23b9d76c93
diff --git a/build/image/dtc.py b/build/image/dtc.py
old mode 100644
new mode 100755
index 49eeeb7..28a75c3
--- a/build/image/dtc.py
+++ b/build/image/dtc.py
@@ -25,17 +25,22 @@
def main():
parser = argparse.ArgumentParser()
- parser.add_argument("input_file")
- parser.add_argument("output_file")
+ parser.add_argument("-i", "--input-file")
+ parser.add_argument("-o", "--output-file")
args = parser.parse_args()
- return subprocess.call([
- DTC,
- "-I", "dts", "-O", "dtb",
- "-o", args.output_file,
- "--out-version", "17",
- args.input_file
- ])
+ dtc_args = [
+ DTC,
+ "-I", "dts", "-O", "dtb",
+ "--out-version", "17",
+ ]
+
+ if args.output_file:
+ dtc_args += [ "-o", args.output_file ]
+ if args.input_file:
+ dtc_args += [ args.input_file ]
+
+ return subprocess.call(dtc_args)
if __name__ == "__main__":
sys.exit(main())