aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-12-23 20:53:58 +0100
committerWolfgang Denk <wd@denx.de>2011-12-23 20:53:58 +0100
commitbfcc40bb09b05c90cc3b1496abb270eb8aa72134 (patch)
treec551fbe329411533b80f0298f6f0ff5afb48cee7 /tools
parentcba9a894fdb1cb49b60fcd1d1d6919cbd7995dd5 (diff)
parent1895420b2ef7358014b355aa4f4f2c348267a6d9 (diff)
Merge branch 'next' of ../next
* 'next' of ../next: mkenvimage: Add version info switch (-V) mkenvimage: Fix getopt() error handling mkenvimage: Fix some typos phy: add Micrel KS8721BL phy definition net: introduce per device index mvgbe: remove setting of ethaddr within the driver x86: Add support for specifying an initrd with the zboot command x86: Refactor the zboot innards so they can be reused with a vboot image x86: Add infrastructure to extract an e820 table from the coreboot tables x86: Add support for booting Linux using the 32 bit boot protocol x86: Clean up the x86 zimage code in preparation to extend it x86: Import code from coreboot's libpayload to parse the coreboot table x86: Initial commit for running as a coreboot payload CHECKPATCH: ./board/esd/hh405/logo_320_240_8bpp.c CHECKPATCH: ./board/esd/hh405/logo_1024_768_8bpp.c CHECKPATCH: ./board/esd/hh405/logo_320_240_4bpp.c CHECKPATCH: ./board/esd/hh405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/apc405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/voh405/logo_320_240_4bpp.c CHECKPATCH: ./board/esd/voh405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/hh405/fpgadata.c CHECKPATCH: ./board/esd/pci405/fpgadata.c CHECKPATCH: ./board/esd/tasreg/fpgadata.c CHECKPATCH: ./board/esd/apc405/fpgadata.c CHECKPATCH: ./board/esd/voh405/fpgadata.c CHECKPATCH: ./board/esd/ash405/fpgadata.c CHECKPATCH: ./board/esd/dasa_sim/fpgadata.c CHECKPATCH: ./board/esd/ar405/fpgadata_xl30.c CHECKPATCH: ./board/esd/ar405/fpgadata.c CHECKPATCH: ./board/esd/plu405/fpgadata.c CHECKPATCH: ./board/esd/wuh405/fpgadata.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405ab.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci4052.c CHECKPATCH: ./board/esd/canbt/fpgadata.c CHECKPATCH: ./board/esd/du405/fpgadata.c CHECKPATCH: ./board/esd/cpciiser4/fpgadata.c CHECKPATCH: ./board/dave/PPChameleonEVB/fpgadata.c avr32:mmu.c: fix printf() length modifier fat.c: fix printf() length modifier cmd_sf.c: fix printf() length modifier Make printf and vprintf safe from buffer overruns vsprintf: Move function documentation into header file Add safe vsnprintf and snprintf library functions Move vsprintf functions into their own header Conflicts: tools/mkenvimage.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/mkenvimage.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index 3bb471d31..c5ed373b9 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -39,6 +39,7 @@
#include <sys/stat.h>
#include <u-boot/crc.h>
+#include <version.h>
#define CRC_SIZE sizeof(uint32_t)
@@ -59,6 +60,7 @@ static void usage(const char *exec_name)
"\t-b : the target is big endian (default is little endian)\n"
"\t-p <byte> : fill the image with <byte> bytes instead of "
"0xff bytes\n"
+ "\t-V : print version information and exit\n"
"\n"
"If the input file is \"-\", data is read from standard input\n",
exec_name);
@@ -86,8 +88,11 @@ int main(int argc, char **argv)
prg = basename(argv[0]);
+ /* Turn off getopt()'s internal error message */
+ opterr = 0;
+
/* Parse the cmdline */
- while ((option = getopt(argc, argv, "s:o:rbp:h")) != -1) {
+ while ((option = getopt(argc, argv, ":s:o:rbp:hV")) != -1) {
switch (option) {
case 's':
datasize = strtol(optarg, NULL, 0);
@@ -112,6 +117,14 @@ int main(int argc, char **argv)
case 'h':
usage(prg);
return EXIT_SUCCESS;
+ case 'V':
+ printf("%s version %s\n", prg, PLAIN_VERSION);
+ return EXIT_SUCCESS;
+ case ':':
+ fprintf(stderr, "Missing argument for option -%c\n",
+ option);
+ usage(argv[0]);
+ return EXIT_FAILURE;
default:
fprintf(stderr, "Wrong option -%c\n", option);
usage(prg);
@@ -122,7 +135,7 @@ int main(int argc, char **argv)
/* Check datasize and allocate the data */
if (datasize == 0) {
fprintf(stderr,
- "Please specify the size of the envrionnment "
+ "Please specify the size of the environment "
"partition.\n");
usage(prg);
return EXIT_FAILURE;
@@ -188,12 +201,12 @@ int main(int argc, char **argv)
ret = close(txt_fd);
}
/*
- * The right test to do is "=>" (not ">") because of the additionnal
+ * The right test to do is "=>" (not ">") because of the additional
* ending \0. See below.
*/
if (filesize >= envsize) {
fprintf(stderr, "The input file is larger than the "
- "envrionnment partition size\n");
+ "environment partition size\n");
return EXIT_FAILURE;
}
@@ -202,7 +215,7 @@ int main(int argc, char **argv)
if (filebuf[fp] == '\n') {
if (fp == 0) {
/*
- * Newline at the beggining of the file ?
+ * Newline at the beginning of the file ?
* Ignore it.
*/
continue;