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