100-dtc-binary.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --- a/doc/mkimage.1
  2. +++ b/doc/mkimage.1
  3. @@ -82,6 +82,10 @@
  4. .B Create FIT image:
  5. .TP
  6. +.BI "\-B [" "dtc bin" "]"
  7. +Set path to the device tree compiler binary.
  8. +
  9. +.TP
  10. .BI "\-D [" "dtc options" "]"
  11. Provide special options to the device tree compiler that is used to
  12. create the image.
  13. --- a/tools/fit_image.c
  14. +++ b/tools/fit_image.c
  15. @@ -82,7 +82,8 @@
  16. /* dtc -I dts -O dtb -p 500 datafile > tmpfile */
  17. sprintf (cmd, "%s %s %s > %s",
  18. - MKIMAGE_DTC, params->dtc, params->datafile, tmpfile);
  19. + params->dtc_bin, params->dtc_options, params->datafile,
  20. + tmpfile);
  21. debug ("Trying to execute \"%s\"\n", cmd);
  22. if (system (cmd) == -1) {
  23. fprintf (stderr, "%s: system(%s) failed: %s\n",
  24. --- a/tools/mkimage.c
  25. +++ b/tools/mkimage.c
  26. @@ -38,7 +38,8 @@
  27. .type = IH_TYPE_KERNEL,
  28. .comp = IH_COMP_GZIP,
  29. .magic = IH_MAGIC,
  30. - .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
  31. + .dtc_bin = MKIMAGE_DTC,
  32. + .dtc_options = MKIMAGE_DEFAULT_DTC_OPTIONS,
  33. .imagename = "",
  34. .imagename2 = "",
  35. };
  36. @@ -200,10 +201,15 @@
  37. params.cmdname, *argv);
  38. }
  39. goto NXTARG;
  40. + case 'B':
  41. + if (--argc <= 0)
  42. + usage ();
  43. + params.dtc_bin = *++argv;
  44. + goto NXTARG;
  45. case 'D':
  46. if (--argc <= 0)
  47. usage ();
  48. - params.dtc = *++argv;
  49. + params.dtc_options = *++argv;
  50. goto NXTARG;
  51. case 'O':
  52. @@ -637,7 +643,9 @@
  53. " -d ==> use image data from 'datafile'\n"
  54. " -x ==> set XIP (execute in place)\n",
  55. params.cmdname);
  56. - fprintf (stderr, " %s [-D dtc_options] -f fit-image.its fit-image\n",
  57. + fprintf (stderr, " %s [-B dtc_bin] [-D dtc_options] -f fit-image.its fit-image\n",
  58. + " -B ==> set path to the dtc binary\n",
  59. + " -D ==> set options that will be passed to dtc\n",
  60. params.cmdname);
  61. fprintf (stderr, " %s -V ==> print version information and exit\n",
  62. params.cmdname);
  63. --- a/tools/mkimage.h
  64. +++ b/tools/mkimage.h
  65. @@ -46,7 +46,7 @@
  66. #define MKIMAGE_MAX_TMPFILE_LEN 256
  67. #define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
  68. #define MKIMAGE_MAX_DTC_CMDLINE_LEN 512
  69. -#define MKIMAGE_DTC "dtc" /* assume dtc is in $PATH */
  70. +#define MKIMAGE_DTC "dtc"
  71. /*
  72. * This structure defines all such variables those are initialized by
  73. @@ -66,7 +66,8 @@
  74. int type;
  75. int comp;
  76. unsigned int magic;
  77. - char *dtc;
  78. + char *dtc_bin;
  79. + char *dtc_options;
  80. unsigned int addr;
  81. unsigned int ep;
  82. char *imagename;