diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-01-10 19:27:52 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2012-01-14 17:47:37 -0500 |
commit | 136ec2049fea65aed0446d04ab7cfff2ae3070f1 (patch) | |
tree | 03a8b0bc6775757b9e83cb9029a913a6e64cfdc9 /scripts/dtc | |
parent | 5bb0571bfddcdcd3fbf42a58fcce4d0b743fe62f (diff) |
dtc: Implement -d option to write out a dependency file
This will allow callers to rebuild .dtb files when any of the /include/d
.dtsi files are modified, not just the top-level .dts file.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/dtc')
-rw-r--r-- | scripts/dtc/dtc.c | 21 | ||||
-rw-r--r-- | scripts/dtc/srcpos.c | 4 | ||||
-rw-r--r-- | scripts/dtc/srcpos.h | 1 |
3 files changed, 25 insertions, 1 deletions
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index cbc0193098e4..451c92d31b19 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
@@ -71,6 +71,7 @@ static void __attribute__ ((noreturn)) usage(void) | |||
71 | fprintf(stderr, "\t\t\tasm - assembler source\n"); | 71 | fprintf(stderr, "\t\t\tasm - assembler source\n"); |
72 | fprintf(stderr, "\t-V <output version>\n"); | 72 | fprintf(stderr, "\t-V <output version>\n"); |
73 | fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); | 73 | fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); |
74 | fprintf(stderr, "\t-d <output dependency file>\n"); | ||
74 | fprintf(stderr, "\t-R <number>\n"); | 75 | fprintf(stderr, "\t-R <number>\n"); |
75 | fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); | 76 | fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); |
76 | fprintf(stderr, "\t-S <bytes>\n"); | 77 | fprintf(stderr, "\t-S <bytes>\n"); |
@@ -99,6 +100,7 @@ int main(int argc, char *argv[]) | |||
99 | const char *inform = "dts"; | 100 | const char *inform = "dts"; |
100 | const char *outform = "dts"; | 101 | const char *outform = "dts"; |
101 | const char *outname = "-"; | 102 | const char *outname = "-"; |
103 | const char *depname = NULL; | ||
102 | int force = 0, check = 0, sort = 0; | 104 | int force = 0, check = 0, sort = 0; |
103 | const char *arg; | 105 | const char *arg; |
104 | int opt; | 106 | int opt; |
@@ -111,7 +113,8 @@ int main(int argc, char *argv[]) | |||
111 | minsize = 0; | 113 | minsize = 0; |
112 | padsize = 0; | 114 | padsize = 0; |
113 | 115 | ||
114 | while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) { | 116 | while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s")) |
117 | != EOF) { | ||
115 | switch (opt) { | 118 | switch (opt) { |
116 | case 'I': | 119 | case 'I': |
117 | inform = optarg; | 120 | inform = optarg; |
@@ -125,6 +128,9 @@ int main(int argc, char *argv[]) | |||
125 | case 'V': | 128 | case 'V': |
126 | outversion = strtol(optarg, NULL, 0); | 129 | outversion = strtol(optarg, NULL, 0); |
127 | break; | 130 | break; |
131 | case 'd': | ||
132 | depname = optarg; | ||
133 | break; | ||
128 | case 'R': | 134 | case 'R': |
129 | reservenum = strtol(optarg, NULL, 0); | 135 | reservenum = strtol(optarg, NULL, 0); |
130 | break; | 136 | break; |
@@ -188,6 +194,14 @@ int main(int argc, char *argv[]) | |||
188 | fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", | 194 | fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", |
189 | inform, outform, arg); | 195 | inform, outform, arg); |
190 | 196 | ||
197 | if (depname) { | ||
198 | depfile = fopen(depname, "w"); | ||
199 | if (!depfile) | ||
200 | die("Couldn't open dependency file %s: %s\n", depname, | ||
201 | strerror(errno)); | ||
202 | fprintf(depfile, "%s:", outname); | ||
203 | } | ||
204 | |||
191 | if (streq(inform, "dts")) | 205 | if (streq(inform, "dts")) |
192 | bi = dt_from_source(arg); | 206 | bi = dt_from_source(arg); |
193 | else if (streq(inform, "fs")) | 207 | else if (streq(inform, "fs")) |
@@ -197,6 +211,11 @@ int main(int argc, char *argv[]) | |||
197 | else | 211 | else |
198 | die("Unknown input format \"%s\"\n", inform); | 212 | die("Unknown input format \"%s\"\n", inform); |
199 | 213 | ||
214 | if (depfile) { | ||
215 | fputc('\n', depfile); | ||
216 | fclose(depfile); | ||
217 | } | ||
218 | |||
200 | if (cmdline_boot_cpuid != -1) | 219 | if (cmdline_boot_cpuid != -1) |
201 | bi->boot_cpuid_phys = cmdline_boot_cpuid; | 220 | bi->boot_cpuid_phys = cmdline_boot_cpuid; |
202 | 221 | ||
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index 2dbc874288ca..36a38e9f1a2c 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c | |||
@@ -40,6 +40,7 @@ static char *dirname(const char *path) | |||
40 | return NULL; | 40 | return NULL; |
41 | } | 41 | } |
42 | 42 | ||
43 | FILE *depfile; /* = NULL */ | ||
43 | struct srcfile_state *current_srcfile; /* = NULL */ | 44 | struct srcfile_state *current_srcfile; /* = NULL */ |
44 | 45 | ||
45 | /* Detect infinite include recursion. */ | 46 | /* Detect infinite include recursion. */ |
@@ -67,6 +68,9 @@ FILE *srcfile_relative_open(const char *fname, char **fullnamep) | |||
67 | strerror(errno)); | 68 | strerror(errno)); |
68 | } | 69 | } |
69 | 70 | ||
71 | if (depfile) | ||
72 | fprintf(depfile, " %s", fullname); | ||
73 | |||
70 | if (fullnamep) | 74 | if (fullnamep) |
71 | *fullnamep = fullname; | 75 | *fullnamep = fullname; |
72 | else | 76 | else |
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h index bd7966e56a53..ce980cafe588 100644 --- a/scripts/dtc/srcpos.h +++ b/scripts/dtc/srcpos.h | |||
@@ -30,6 +30,7 @@ struct srcfile_state { | |||
30 | struct srcfile_state *prev; | 30 | struct srcfile_state *prev; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern FILE *depfile; /* = NULL */ | ||
33 | extern struct srcfile_state *current_srcfile; /* = NULL */ | 34 | extern struct srcfile_state *current_srcfile; /* = NULL */ |
34 | 35 | ||
35 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); | 36 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); |