2c63ad322e592a3f3f57716f909f8399b31908d7
[openwrt/openwrt.git] / package / boot / uboot-sunxi / patches / 200-mkimage-check-environment-for-dtc-binary-location.patch
1 From 637800493945ffed2f454756300437a4ec86e3b1 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Wed, 19 Jul 2017 22:23:15 +0200
4 Subject: mkimage: check environment for dtc binary location
5
6 Currently mkimage assumes the dtc binary is in the path and fails
7 otherwise. This patch makes it check the DTC environment variable first
8 for the dtc binary and then fall back to the default path. This makes
9 it possible to call the u-boot build with make DTC=... and build a fit
10 image with the dtc binary not being the the default path.
11
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Cc: Simon Glass <sjg@chromium.org>
14 ---
15 tools/fit_image.c | 7 ++++++-
16 1 file changed, 6 insertions(+), 1 deletion(-)
17
18 --- a/tools/fit_image.c
19 +++ b/tools/fit_image.c
20 @@ -649,9 +649,14 @@ static int fit_handle_file(struct image_
21 }
22 *cmd = '\0';
23 } else if (params->datafile) {
24 + const char* dtc = getenv("DTC");
25 +
26 + if (!dtc)
27 + dtc = MKIMAGE_DTC;
28 +
29 /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */
30 snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"",
31 - MKIMAGE_DTC, params->dtc, tmpfile, params->datafile);
32 + dtc, params->dtc, tmpfile, params->datafile);
33 debug("Trying to execute \"%s\"\n", cmd);
34 } else {
35 snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"",