aboutsummaryrefslogtreecommitdiff
path: root/dtc.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@arm.com>2018-09-11 15:41:31 -0500
committerDavid Gibson <david@gibson.dropbear.id.au>2018-09-13 11:39:03 +1000
commitc86da84d30e4b72cfb4fee22b62bea4257bc14bf (patch)
tree9186e26404171e4a77cd69c3b2ec3afc35cff82c /dtc.c
parent361b5e7d80673e7d3613cfdf989449013bf109a0 (diff)
downloaddtc-c86da84d30e4b72cfb4fee22b62bea4257bc14bf.zip
dtc-c86da84d30e4b72cfb4fee22b62bea4257bc14bf.tar.gz
dtc-c86da84d30e4b72cfb4fee22b62bea4257bc14bf.tar.bz2
Add support for YAML encoded output
YAML encoded DT is useful for validation of DTs using binding schemas. The YAML encoding is an intermediate format used for validation and is therefore subject to change as needed. The YAML output is dependent on DTS input with type information preserved. Signed-off-by: Grant Likely <grant.likely@arm.com> [robh: make YAML support optional, build fixes, Travis CI test, preserve type information in paths and phandles] Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.c')
-rw-r--r--dtc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dtc.c b/dtc.c
index c36994e..64134aa 100644
--- a/dtc.c
+++ b/dtc.c
@@ -95,6 +95,9 @@ static const char * const usage_opts_help[] = {
"\n\tOutput formats are:\n"
"\t\tdts - device tree source text\n"
"\t\tdtb - device tree blob\n"
+#ifndef NO_YAML
+ "\t\tyaml - device tree encoded as YAML\n"
+#endif
"\t\tasm - assembler source",
"\n\tBlob version to produce, defaults to "stringify(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
"\n\tOutput dependency file",
@@ -128,6 +131,8 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
return fallback;
if (!strcasecmp(s, ".dts"))
return "dts";
+ if (!strcasecmp(s, ".yaml"))
+ return "yaml";
if (!strcasecmp(s, ".dtb"))
return "dtb";
return fallback;
@@ -350,6 +355,12 @@ int main(int argc, char *argv[])
if (streq(outform, "dts")) {
dt_to_source(outf, dti);
+#ifndef NO_YAML
+ } else if (streq(outform, "yaml")) {
+ if (!streq(inform, "dts"))
+ die("YAML output format requires dts input format\n");
+ dt_to_yaml(outf, dti);
+#endif
} else if (streq(outform, "dtb")) {
dt_to_blob(outf, dti, outversion);
} else if (streq(outform, "asm")) {