diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2014-12-12 21:05:20 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-12-13 22:32:04 -0700 |
commit | 673ed2f8c2e6b5526de929861d7dd42834c572fd (patch) | |
tree | 8820261a538e2598448ef8c975698063cbdf61a5 /tools | |
parent | 64542f4616c484142b90534f9f174a632d7d1904 (diff) | |
download | u-boot-imx-673ed2f8c2e6b5526de929861d7dd42834c572fd.zip u-boot-imx-673ed2f8c2e6b5526de929861d7dd42834c572fd.tar.gz u-boot-imx-673ed2f8c2e6b5526de929861d7dd42834c572fd.tar.bz2 |
tools/ifdtool: Support writing multiple files (-w) simultaneously
Currently ifdtool only supports writing one file (-w) at a time.
This looks verbose when generating u-boot.rom for x86 targets.
This change allows at most 16 files to be written simultaneously.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ifdtool.c | 31 | ||||
-rw-r--r-- | tools/ifdtool.h | 2 |
2 files changed, 26 insertions, 7 deletions
diff --git a/tools/ifdtool.c b/tools/ifdtool.c index a4b481f..f81e5c8 100644 --- a/tools/ifdtool.c +++ b/tools/ifdtool.c @@ -732,6 +732,7 @@ static void print_usage(const char *name) " -x | --extract: extract intel fd modules\n" " -i | --inject <region>:<module> inject file <module> into region <region>\n" " -w | --write <addr>:<file> write file to appear at memory address <addr>\n" + " multiple files can be written simultaneously\n" " -s | --spifreq <20|33|50> set the SPI frequency\n" " -e | --em100 set SPI frequency to 20MHz and disable\n" " Dual Output Fast Read Support\n" @@ -782,7 +783,9 @@ int main(int argc, char *argv[]) char *addr_str = NULL; int region_type = -1, inputfreq = 0; enum spi_frequency spifreq = SPI_FREQUENCY_20MHZ; - unsigned int addr = 0; + unsigned int addr[WRITE_MAX]; + char *wr_fname[WRITE_MAX]; + unsigned char wr_idx, wr_num = 0; int rom_size = -1; bool write_it; char *filename; @@ -886,11 +889,19 @@ int main(int argc, char *argv[]) break; case 'w': mode_write = 1; - if (get_two_words(optarg, &addr_str, &src_fname)) { - print_usage(argv[0]); - exit(EXIT_FAILURE); + if (wr_num < WRITE_MAX) { + if (get_two_words(optarg, &addr_str, + &wr_fname[wr_num])) { + print_usage(argv[0]); + exit(EXIT_FAILURE); + } + addr[wr_num] = strtol(optarg, NULL, 0); + wr_num++; + } else { + fprintf(stderr, + "The number of files to write simultaneously exceeds the limitation (%d)\n", + WRITE_MAX); } - addr = strtol(optarg, NULL, 0); break; case 'x': mode_extract = 1; @@ -1002,8 +1013,14 @@ int main(int argc, char *argv[]) if (mode_inject) ret = inject_region(image, size, region_type, src_fname); - if (mode_write) - ret = write_data(image, size, addr, src_fname); + if (mode_write) { + for (wr_idx = 0; wr_idx < wr_num; wr_idx++) { + ret = write_data(image, size, + addr[wr_idx], wr_fname[wr_idx]); + if (ret) + break; + } + } if (mode_spifreq) set_spi_frequency(image, size, spifreq); diff --git a/tools/ifdtool.h b/tools/ifdtool.h index fbec421..0d0cc36 100644 --- a/tools/ifdtool.h +++ b/tools/ifdtool.h @@ -14,6 +14,8 @@ #define IFDTOOL_VERSION "1.1-U-Boot" +#define WRITE_MAX 16 + enum spi_frequency { SPI_FREQUENCY_20MHZ = 0, SPI_FREQUENCY_33MHZ = 1, |