diff options
author | Andre Przywara <osp@andrep.de> | 2015-07-01 00:31:28 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2015-07-01 13:34:11 +1000 |
commit | f6dbc6ca9618391e4f30c415a0a09b7af35f7647 (patch) | |
tree | 9f1ac367321c64ef29f9019bcb4221cef693e5cc /dtc.c | |
parent | 5e78dff4248da3f4efe3a399d66b091b97940ddf (diff) | |
download | dtc-f6dbc6ca9618391e4f30c415a0a09b7af35f7647.tar.gz |
guess output file format
If no output file type is specified via the -O parameter, guess the
desired file type by looking at the file name extension.
If that provides no useful hints, assume "dtb" as long as the input
type is "dts". Any other input type will lead to "dts" being used as
the guessed output type.
Any explicit specification of the output type will skip this guessing.
Signed-off-by: Andre Przywara <osp@andrep.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.c')
-rw-r--r-- | dtc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -155,7 +155,7 @@ int main(int argc, char *argv[]) { struct boot_info *bi; const char *inform = NULL; - const char *outform = "dts"; + const char *outform = NULL; const char *outname = "-"; const char *depname = NULL; bool force = false, sort = false; @@ -262,6 +262,15 @@ int main(int argc, char *argv[]) if (inform == NULL) inform = guess_input_format(arg, "dts"); + if (outform == NULL) { + outform = guess_type_by_name(outname, NULL); + if (outform == NULL) { + if (streq(inform, "dts")) + outform = "dtb"; + else + outform = "dts"; + } + } if (streq(inform, "dts")) bi = dt_from_source(arg); else if (streq(inform, "fs")) |