200-mkimage-check-environment-for-dtc-binary-location.patch 1.3 KB

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