Browse Source

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>
main
Andre Przywara 9 years ago committed by David Gibson
parent
commit
f6dbc6ca96
  1. 11
      dtc.c

11
dtc.c

@ -155,7 +155,7 @@ int main(int argc, char *argv[]) @@ -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[]) @@ -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"))

Loading…
Cancel
Save