]> git.sur5r.net Git - u-boot/blobdiff - tools/fit_image.c
mkimage: Refactor imagetool_get_source_date to take command name
[u-boot] / tools / fit_image.c
index 1db44f47a16b1be9ba6ffd45546d293498fddc90..6f09a661067e53d4bbe61d23dbc6fffa459da664 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2008 Semihalf
  *
@@ -10,8 +11,6 @@
  *             some functions added to address abstraction
  *
  * All rights reserved.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include "imagetool.h"
@@ -52,7 +51,8 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc,
 
        /* for first image creation, add a timestamp at offset 0 i.e., root  */
        if (params->datafile) {
-               time_t time = imagetool_get_source_date(params, sbuf.st_mtime);
+               time_t time = imagetool_get_source_date(params->cmdname,
+                                                       sbuf.st_mtime);
                ret = fit_set_timestamp(ptr, 0, time);
        }
 
@@ -650,9 +650,9 @@ static int fit_handle_file(struct image_tool_params *params)
                }
                *cmd = '\0';
        } else if (params->datafile) {
-               /* dtc -I dts -O dtb -p 500 datafile > tmpfile */
-               snprintf(cmd, sizeof(cmd), "%s %s \"%s\" > \"%s\"",
-                        MKIMAGE_DTC, params->dtc, params->datafile, tmpfile);
+               /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */
+               snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"",
+                        MKIMAGE_DTC, params->dtc, tmpfile, params->datafile);
                debug("Trying to execute \"%s\"\n", cmd);
        } else {
                snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"",