From 079df7223c05518687cbd2eb9ad1b3d1712ee6d7 Mon Sep 17 00:00:00 2001 From: Donggeun Kim Date: Thu, 22 Mar 2012 04:38:55 +0000 Subject: FAT write: Fix compile errors This patch removes compile errors introduced by commit 9813b750f32c0056f0a35813b9a9ec0f68b664af 'fs/fat: Fix FAT detection to support non-DOS partition tables' fat_write.c: In function 'disk_write': fat_write.c:54: error: 'part_offset' undeclared (first use in this function) fat_write.c:54: error: (Each undeclared identifier is reported only once fat_write.c:54: error: for each function it appears in.) fat_write.c: In function 'do_fat_write': fat_write.c:950: error: 'part_size' undeclared (first use in this function) These errors only appear when this code is enabled by defining CONFIG_FAT_WRITE option. This patch was originally part of http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847 Signed-off-by: Donggeun Kim Signed-off-by: Kyungmin Park Signed-off-by: Maximilian Schwerin Fixed patch author and added all needed SoB from the original patch and also submitter's SoB. Extended commit log. Signed-off-by: Anatolij Gustschin --- fs/fat/fat_write.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 3bfc1c4b32..16f8400b39 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -41,23 +41,19 @@ static void uppercase(char *str, int len) } static int total_sector; -static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr) +static int disk_write(__u32 block, __u32 nr_blocks, void *buf) { - if (cur_dev == NULL) + if (!cur_dev || !cur_dev->block_write) return -1; - if (startblock + getsize > total_sector) { + if (cur_part_info.start + block + nr_blocks > + cur_part_info.start + total_sector) { printf("error: overflow occurs\n"); return -1; } - startblock += part_offset; - - if (cur_dev->block_read) { - return cur_dev->block_write(cur_dev->dev, startblock, getsize, - (unsigned long *) bufptr); - } - return -1; + return cur_dev->block_write(cur_dev->dev, + cur_part_info.start + block, nr_blocks, buf); } /* @@ -797,7 +793,7 @@ static int check_overflow(fsdata *mydata, __u32 clustnum, unsigned long size) if (size % mydata->sect_size) sect_num++; - if (startsect + sect_num > total_sector) + if (startsect + sect_num > cur_part_info.start + total_sector) return -1; return 0; @@ -947,7 +943,7 @@ static int do_fat_write(const char *filename, void *buffer, total_sector = bs.total_sect; if (total_sector == 0) - total_sector = part_size; + total_sector = cur_part_info.size; root_cluster = bs.root_cluster; -- cgit v1.2.3 From bf6b6af74655506ce23ca04d6e5c6b3ad3fcf490 Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Sat, 24 Mar 2012 23:40:56 +0100 Subject: fs/fat/fat_write.c: Fix GCC 4.6 warnings Fix: fat_write.c: In function 'find_directory_entry': fat_write.c:826:8: warning: variable 'prevcksum' set but not used [-Wunused-but-set-variable] fat_write.c: In function 'do_fat_write': fat_write.c:933:6: warning: variable 'root_cluster' set but not used [-Wunused-but-set-variable] fat_write.c:925:12: warning: variable 'slotptr' set but not used [-Wunused-but-set-variable] Signed-off-by: Anatolij Gustschin Cc: Donggeun Kim Acked-by: Maximilian Schwerin Acked-by: Kyungmin Park --- fs/fat/fat_write.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 16f8400b39..a6181e71b5 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -823,7 +823,6 @@ static dir_entry *empty_dentptr; static dir_entry *find_directory_entry(fsdata *mydata, int startsect, char *filename, dir_entry *retdent, __u32 start) { - __u16 prevcksum = 0xffff; __u32 curclust = (startsect - mydata->data_begin) / mydata->clust_size; debug("get_dentfromdir: %s\n", filename); @@ -857,8 +856,6 @@ static dir_entry *find_directory_entry(fsdata *mydata, int startsect, #ifdef CONFIG_SUPPORT_VFAT if ((dentptr->attr & ATTR_VFAT) && (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) { - prevcksum = - ((dir_slot *)dentptr)->alias_checksum; get_long_file_name(mydata, curclust, get_dentfromdir_block, &dentptr, l_name); @@ -922,7 +919,6 @@ static int do_fat_write(const char *filename, void *buffer, unsigned long size) { dir_entry *dentptr, *retdent; - dir_slot *slotptr; __u32 startsect; __u32 start_cluster; boot_sector bs; @@ -930,7 +926,7 @@ static int do_fat_write(const char *filename, void *buffer, fsdata datablock; fsdata *mydata = &datablock; int cursect; - int root_cluster, ret = -1, name_len; + int ret = -1, name_len; char l_filename[VFAT_MAXLEN_BYTES]; int write_size = size; @@ -945,8 +941,6 @@ static int do_fat_write(const char *filename, void *buffer, if (total_sector == 0) total_sector = cur_part_info.size; - root_cluster = bs.root_cluster; - if (mydata->fatsize == 32) mydata->fatlength = bs.fat32_length; else @@ -1047,8 +1041,6 @@ static int do_fat_write(const char *filename, void *buffer, goto exit; } } else { - slotptr = (dir_slot *)empty_dentptr; - /* Set short name to set alias checksum field in dir_slot */ set_name(empty_dentptr, filename); fill_dir_slot(mydata, &empty_dentptr, filename); -- cgit v1.2.3 From 656f4c653785eb3fac84796da5d3bc04c4918290 Mon Sep 17 00:00:00 2001 From: Donggeun Kim Date: Thu, 22 Mar 2012 04:38:56 +0000 Subject: cmd_fat: add FAT write command Once CONFIG_FAT_WRITE is defined, users can invoke 'fatwrite' command that saves data in RAM as a FAT file. This patch was originally part of http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847 Signed-off-by: Donggeun Kim Signed-off-by: Kyungmin Park Signed-off-by: Maximilian Schwerin Signed-off-by: Anatolij Gustschin --- README | 8 ++++++-- common/cmd_fat.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/README b/README index b69a3b6f6e..110eac6f16 100644 --- a/README +++ b/README @@ -1233,8 +1233,12 @@ The following options need to be configured: - FAT(File Allocation Table) filesystem write function support: CONFIG_FAT_WRITE - Support for saving memory data as a file - in FAT formatted partition + + Define this to enable support for saving memory data as a + file in FAT formatted partition. + + This will also enable the command "fatwrite" enabling the + user to write files to FAT. - Keyboard Support: CONFIG_ISA_KEYBOARD diff --git a/common/cmd_fat.c b/common/cmd_fat.c index 0220494343..559a16d619 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -184,3 +184,60 @@ U_BOOT_CMD( " \n" " - print information about filesystem from 'dev' on 'interface'" ); + +#ifdef CONFIG_FAT_WRITE +static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag, + int argc, char * const argv[]) +{ + long size; + unsigned long addr; + unsigned long count; + block_dev_desc_t *dev_desc = NULL; + int dev = 0; + int part = 1; + char *ep; + + if (argc < 5) + return cmd_usage(cmdtp); + + dev = (int)simple_strtoul(argv[2], &ep, 16); + dev_desc = get_dev(argv[1], dev); + if (dev_desc == NULL) { + puts("\n** Invalid boot device **\n"); + return 1; + } + if (*ep) { + if (*ep != ':') { + puts("\n** Invalid boot device, use `dev[:part]' **\n"); + return 1; + } + part = (int)simple_strtoul(++ep, NULL, 16); + } + if (fat_register_device(dev_desc, part) != 0) { + printf("\n** Unable to use %s %d:%d for fatwrite **\n", + argv[1], dev, part); + return 1; + } + addr = simple_strtoul(argv[3], NULL, 16); + count = simple_strtoul(argv[5], NULL, 16); + + size = file_fat_write(argv[4], (void *)addr, count); + if (size == -1) { + printf("\n** Unable to write \"%s\" from %s %d:%d **\n", + argv[4], argv[1], dev, part); + return 1; + } + + printf("%ld bytes written\n", size); + + return 0; +} + +U_BOOT_CMD( + fatwrite, 6, 0, do_fat_fswrite, + "write file into a dos filesystem", + " \n" + " - write file 'filename' from the address 'addr' in RAM\n" + " to 'dev' on 'interface'" +); +#endif -- cgit v1.2.3 From e758a5c4a75eb0d29201422ffc97ef7d95a88df8 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 1 Mar 2012 21:19:40 +0000 Subject: mkenvimage: fix usage message Don't use argv[0] for usage() because it may or may not be clobbered by the previous call to basename(). Use "prg" instead as it is done in the rest of the code. Signed-off-by: Wolfgang Denk Acked-by: Mike Frysinger --- tools/mkenvimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index f78173163f..64f5340b1b 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -123,7 +123,7 @@ int main(int argc, char **argv) case ':': fprintf(stderr, "Missing argument for option -%c\n", optopt); - usage(argv[0]); + usage(prg); return EXIT_FAILURE; default: fprintf(stderr, "Wrong option -%c\n", optopt); -- cgit v1.2.3 From d721a3a7714147a54f400f9daeeac059e579a4a4 Mon Sep 17 00:00:00 2001 From: Liming Wang Date: Wed, 22 Feb 2012 04:56:31 +0000 Subject: ARMV7/Vexpress: add missing get_ticks() and get_tbclk() commit f31a911fe (arm, post: add missing post_time_ms for arm) enables get_ticks and get_tbclk for all arm based boards, arm/vexpress also needs these functions to work. Signed-off-by: Liming Wang Acked-by: Matt.Waddel@linaro.org --- board/armltd/vexpress/ca9x4_ct_vxp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/board/armltd/vexpress/ca9x4_ct_vxp.c b/board/armltd/vexpress/ca9x4_ct_vxp.c index da6f14d988..0b36d1280a 100644 --- a/board/armltd/vexpress/ca9x4_ct_vxp.c +++ b/board/armltd/vexpress/ca9x4_ct_vxp.c @@ -226,3 +226,13 @@ void lowlevel_init(void) ulong get_board_rev(void){ return readl((u32 *)SYS_ID); } + +unsigned long long get_ticks(void) +{ + return get_timer(0); +} + +ulong get_tbclk (void) +{ + return (ulong)CONFIG_SYS_HZ; +} -- cgit v1.2.3 From 0c185696061afacfe78fc1bc405a0f6ed1f3f7a6 Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Mon, 20 Feb 2012 12:56:25 +0000 Subject: MAKEALL: display SPL size if present This makes it easier to detect changes in the SPL portion, as can currently be done for the main U-Boot image. Signed-off-by: Scott Wood Acked-by: Tom Rini --- MAKEALL | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MAKEALL b/MAKEALL index 0f2b4a1b94..c33be1d4b5 100755 --- a/MAKEALL +++ b/MAKEALL @@ -511,8 +511,12 @@ build_target() { TOTAL_CNT=$((TOTAL_CNT + 1)) - ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \ - | tee -a ${LOG_DIR}/$target.MAKELOG + OBJS=${BUILD_DIR}/u-boot + if [ -e ${BUILD_DIR}/spl/u-boot-spl ]; then + OBJS="${OBJS} ${BUILD_DIR}/spl/u-boot-spl" + fi + + ${CROSS_COMPILE}size ${OBJS} | tee -a ${LOG_DIR}/$target.MAKELOG } build_targets() { for t in "$@" ; do -- cgit v1.2.3 From 8a1b8fc786debc92e73db96800429ca6333fc69b Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:34 +0000 Subject: mkenvimage: correct and clarify comments and error messages Also, don't split error messages over several lines as per a coding style exception making them easier to grep. Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 64f5340b1b..d344456427 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -45,12 +45,9 @@ static void usage(const char *exec_name) { - fprintf(stderr, "%s [-h] [-r] [-b] [-p ] " - "-s -o \n" + fprintf(stderr, "%s [-h] [-r] [-b] [-p ] -s -o \n" "\n" - "This tool takes a key=value input file (same as would a " - "`printenv' show) and generates the corresponding environment " - "image, ready to be flashed.\n" + "This tool takes a key=value input file (same as would a `printenv' show) and generates the corresponding environment image, ready to be flashed.\n" "\n" "\tThe input file is in format:\n" "\t\tkey1=value1\n" @@ -58,8 +55,7 @@ static void usage(const char *exec_name) "\t\t...\n" "\t-r : the environment has multiple copies in flash\n" "\t-b : the target is big endian (default is little endian)\n" - "\t-p : fill the image with bytes instead of " - "0xff bytes\n" + "\t-p : fill the image with 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", @@ -100,8 +96,7 @@ int main(int argc, char **argv) case 'o': bin_filename = strdup(optarg); if (!bin_filename) { - fprintf(stderr, "Can't strdup() the output " - "filename\n"); + fprintf(stderr, "Can't strdup() the output filename\n"); return EXIT_FAILURE; } break; @@ -134,22 +129,21 @@ int main(int argc, char **argv) /* Check datasize and allocate the data */ if (datasize == 0) { - fprintf(stderr, - "Please specify the size of the environment " - "partition.\n"); + fprintf(stderr, "Please specify the size of the environment partition.\n"); usage(prg); return EXIT_FAILURE; } dataptr = malloc(datasize * sizeof(*dataptr)); if (!dataptr) { - fprintf(stderr, "Can't alloc dataptr.\n"); + fprintf(stderr, "Can't alloc %d bytes for dataptr.\n", + datasize); return EXIT_FAILURE; } /* * envptr points to the beginning of the actual environment (after the - * crc and possible `redundant' bit + * crc and possible `redundant' byte */ envsize = datasize - (CRC_SIZE + redundant); envptr = dataptr + CRC_SIZE + redundant; @@ -185,8 +179,8 @@ int main(int argc, char **argv) /* ... and check it */ ret = fstat(txt_fd, &txt_file_stat); if (ret == -1) { - fprintf(stderr, "Can't stat() on \"%s\": " - "%s\n", txt_filename, strerror(errno)); + fprintf(stderr, "Can't stat() on \"%s\": %s\n", + txt_filename, strerror(errno)); return EXIT_FAILURE; } @@ -200,13 +194,9 @@ int main(int argc, char **argv) } ret = close(txt_fd); } - /* - * 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 " - "environment partition size\n"); + /* The +1 is for the additionnal ending \0. See below. */ + if (filesize + 1 > envsize) { + fprintf(stderr, "The input file is larger than the environment partition size\n"); return EXIT_FAILURE; } @@ -255,8 +245,7 @@ int main(int argc, char **argv) * check the env size again to make sure we have room for two \0 */ if (ep >= envsize) { - fprintf(stderr, "The environment file is too large for " - "the target environment storage\n"); + fprintf(stderr, "The environment file is too large for the target environment storage\n"); return EXIT_FAILURE; } envptr[ep] = '\0'; -- cgit v1.2.3 From d1acdae98655af4a9ed1b138325ff172206d1c00 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:35 +0000 Subject: mkenvimage: Correct an include and add a missing one compiler.h needs to be included from U-Boot's headers. Also, group U-Boot-specific includes together stdlib.h was missing. Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index d344456427..c1915795ea 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -31,13 +31,14 @@ #include #include #include +#include #include #include #include -#include #include #include +#include "compiler.h" #include #include -- cgit v1.2.3 From 3d0f9bd0349712223d5be40aa69f4ca1a1965a3e Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:36 +0000 Subject: mkenvimage: More error handling Verbosly fail if the target environment size or the padding byte are badly formated. Verbosly fail if something bad happens when reading from standard input. Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index c1915795ea..b6879bcef7 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -63,6 +63,24 @@ static void usage(const char *exec_name) exec_name); } +long int xstrtol(const char *s) +{ + long int tmp; + + errno = 0; + tmp = strtol(s, NULL, 0); + if (!errno) + return tmp; + + if (errno == ERANGE) + fprintf(stderr, "Bad integer format: %s\n", s); + else + fprintf(stderr, "Error while parsing %s: %s\n", s, + strerror(errno)); + + exit(EXIT_FAILURE); +} + int main(int argc, char **argv) { uint32_t crc, targetendian_crc; @@ -92,7 +110,7 @@ int main(int argc, char **argv) while ((option = getopt(argc, argv, ":s:o:rbp:hV")) != -1) { switch (option) { case 's': - datasize = strtol(optarg, NULL, 0); + datasize = xstrtol(optarg); break; case 'o': bin_filename = strdup(optarg); @@ -108,7 +126,7 @@ int main(int argc, char **argv) bigendian = 1; break; case 'p': - padbyte = strtol(optarg, NULL, 0); + padbyte = xstrtol(optarg); break; case 'h': usage(prg); @@ -166,7 +184,16 @@ int main(int argc, char **argv) do { filebuf = realloc(filebuf, readlen); + if (!filebuf) { + fprintf(stderr, "Can't realloc memory for the input file buffer\n"); + return EXIT_FAILURE; + } readbytes = read(txt_fd, filebuf + filesize, readlen); + if (errno) { + fprintf(stderr, "Error while reading stdin: %s\n", + strerror(errno)); + return EXIT_FAILURE; + } filesize += readbytes; } while (readbytes == readlen); -- cgit v1.2.3 From 48995b5a96c99ba6243906ecab733e4269fbafe5 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:37 +0000 Subject: mkenvimage: Read/Write from/to stdin/out by default or if the filename is "-" Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index b6879bcef7..032dc83652 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -171,15 +171,9 @@ int main(int argc, char **argv) memset(envptr, padbyte, envsize); /* Open the input file ... */ - if (optind >= argc) { - fprintf(stderr, "Please specify an input filename\n"); - return EXIT_FAILURE; - } - - txt_filename = argv[optind]; - if (strcmp(txt_filename, "-") == 0) { + if (optind >= argc || strcmp(argv[optind], "-") == 0) { int readbytes = 0; - int readlen = sizeof(*envptr) * 2048; + int readlen = sizeof(*envptr) * 4096; txt_fd = STDIN_FILENO; do { @@ -198,6 +192,7 @@ int main(int argc, char **argv) } while (readbytes == readlen); } else { + txt_filename = argv[optind]; txt_fd = open(txt_filename, O_RDONLY); if (txt_fd == -1) { fprintf(stderr, "Can't open \"%s\": %s\n", @@ -287,11 +282,16 @@ int main(int argc, char **argv) memcpy(dataptr, &targetendian_crc, sizeof(uint32_t)); - bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - if (bin_fd == -1) { - fprintf(stderr, "Can't open output file \"%s\": %s\n", - bin_filename, strerror(errno)); - return EXIT_FAILURE; + if (!bin_filename || strcmp(bin_filename, "-") == 0) { + bin_fd = STDOUT_FILENO; + } else { + bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP); + if (bin_fd == -1) { + fprintf(stderr, "Can't open output file \"%s\": %s\n", + bin_filename, strerror(errno)); + return EXIT_FAILURE; + } } if (write(bin_fd, dataptr, sizeof(*dataptr) * datasize) != -- cgit v1.2.3 From 6ee39f8055680654f9cc97b98dcce9588f1ab71e Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:38 +0000 Subject: mkenvimage: Use mmap() when reading from a regular file Fall back to read() if it fails. Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 032dc83652..4169004aab 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "compiler.h" #include @@ -208,12 +209,24 @@ int main(int argc, char **argv) } filesize = txt_file_stat.st_size; - /* Read the raw input file and transform it */ - filebuf = malloc(sizeof(*envptr) * filesize); - ret = read(txt_fd, filebuf, sizeof(*envptr) * filesize); - if (ret != sizeof(*envptr) * filesize) { - fprintf(stderr, "Can't read the whole input file\n"); - return EXIT_FAILURE; + + filebuf = mmap(NULL, sizeof(*envptr) * filesize, PROT_READ, + MAP_PRIVATE, txt_fd, 0); + if (filebuf == MAP_FAILED) { + fprintf(stderr, "mmap (%ld bytes) failed: %s\n", + sizeof(*envptr) * filesize, + strerror(errno)); + fprintf(stderr, "Falling back to read()\n"); + + filebuf = malloc(sizeof(*envptr) * filesize); + ret = read(txt_fd, filebuf, sizeof(*envptr) * filesize); + if (ret != sizeof(*envptr) * filesize) { + fprintf(stderr, "Can't read the whole input file (%ld bytes): %s\n", + sizeof(*envptr) * filesize, + strerror(errno)); + + return EXIT_FAILURE; + } } ret = close(txt_fd); } -- cgit v1.2.3 From dc6449a9d8c27899b9bbdaaf49d1535f7a41fd8e Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:39 +0000 Subject: mkenvimage: Don't try to detect comments in the input file Remove this feature since it seems impossible to reliably detect them. Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 4169004aab..3a20b23ed1 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -258,14 +258,6 @@ int main(int argc, char **argv) /* End of a variable */ envptr[ep++] = '\0'; } - } else if (filebuf[fp] == '#') { - if (fp != 0 && filebuf[fp-1] == '\n') { - /* This line is a comment, let's skip it */ - while (fp < txt_file_stat.st_size && fp++ && - filebuf[fp] != '\n'); - } else { - envptr[ep++] = filebuf[fp]; - } } else { envptr[ep++] = filebuf[fp]; } -- cgit v1.2.3 From d8d265999b65afe289f7d8d8860ed492b1ff77d4 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 13 Jan 2012 13:27:40 +0000 Subject: mkenvimage: Really set the redundant byte when applicable Signed-off-by: David Wagner Acked-by: Mike Frysinger --- tools/mkenvimage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 3a20b23ed1..9dbb3b210b 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -285,7 +285,9 @@ int main(int argc, char **argv) crc = crc32(0, envptr, envsize); targetendian_crc = bigendian ? cpu_to_be32(crc) : cpu_to_le32(crc); - memcpy(dataptr, &targetendian_crc, sizeof(uint32_t)); + memcpy(dataptr, &targetendian_crc, sizeof(targetendian_crc)); + if (redundant) + dataptr[sizeof(targetendian_crc)] = 1; if (!bin_filename || strcmp(bin_filename, "-") == 0) { bin_fd = STDOUT_FILENO; -- cgit v1.2.3 From 7e71dc68846647f387a74d50924da1218e197089 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Tue, 27 Mar 2012 11:43:25 +0200 Subject: disk/part.c: Fix device enumeration through API The patch below fixes device enumeration through the U-Boot API. Device enumeration crashes when the system in question doesn't have any RAM mapped to address zero (I discovered this on a BeagleBone board), since the enumeration calls get_dev with a NULL ifname sometimes which then gets passed down to strncmp(). This fix simply ensures that get_dev returns NULL when invoked with a NULL ifname. Signed-off-by: Tim Kientzle Signed-off-by: Anatolij Gustschin --- disk/part.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/disk/part.c b/disk/part.c index f07a17feb8..8ca5d4bdfc 100644 --- a/disk/part.c +++ b/disk/part.c @@ -80,6 +80,9 @@ block_dev_desc_t *get_dev(char* ifname, int dev) block_dev_desc_t* (*reloc_get_dev)(int dev); char *name; + if (!ifname) + return NULL; + name = drvr->name; #ifdef CONFIG_NEEDS_MANUAL_RELOC name += gd->reloc_off; -- cgit v1.2.3 From c46bf09e0b567dda477da53163fe646e66c4912e Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 24 Mar 2012 22:44:01 +0000 Subject: doc: Fix some typos in different files adresses/addresses alernate/alternate asssuming/assuming calcualted/calculated enviroment/environment evalutation/evaluation falsh/flash labled/labeled paramaters/parameters Signed-off-by: Thomas Weber Acked-by: Anatolij Gustschin --- doc/README.AVR32-port-muxing | 4 ++-- doc/README.SNTP | 2 +- doc/README.Sandpoint8240 | 6 +++--- doc/README.at91 | 6 +++--- doc/README.ebony | 2 +- doc/README.fsl-ddr | 4 ++-- doc/README.mpc832xemds | 2 +- doc/README.mpc8360emds | 2 +- doc/README.mpc837xemds | 2 +- doc/README.mpc8544ds | 2 +- doc/README.mpc8572ds | 4 ++-- doc/README.mpc85xxads | 2 +- doc/README.mvbc_p | 2 +- doc/README.mvblm7 | 4 ++-- doc/README.mvsmr | 2 +- doc/README.ocotea | 2 +- doc/README.p2020rdb | 4 ++-- 17 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/README.AVR32-port-muxing b/doc/README.AVR32-port-muxing index b53799d338..8c1718cdca 100644 --- a/doc/README.AVR32-port-muxing +++ b/doc/README.AVR32-port-muxing @@ -91,7 +91,7 @@ of the flags are the same on all implementations. PORTMUX_DIR_OUTPUT PORTMUX_DIR_INPUT -These mutually-exlusive flags configure the initial direction of the +These mutually-exclusive flags configure the initial direction of the pins. PORTMUX_DIR_OUTPUT means that the pins are driven by the CPU, while PORTMUX_DIR_INPUT means that the pins are tristated by the CPU. These flags are ignored by portmux_select_peripheral(). @@ -125,7 +125,7 @@ PORTMUX_PULL_UP. PORTMUX_DRIVE_HIGH PORTMUX_DRIVE_MAX -These mutually-exlusive flags determine the drive strength of the +These mutually-exclusive flags determine the drive strength of the pins. PORTMUX_DRIVE_MIN will give low power-consumption, but may cause corruption of high-speed signals. PORTMUX_DRIVE_MAX will give high power-consumption, but may be necessary on pins toggling at very high diff --git a/doc/README.SNTP b/doc/README.SNTP index 9edc957c6f..da9ec459ad 100644 --- a/doc/README.SNTP +++ b/doc/README.SNTP @@ -6,7 +6,7 @@ syncronize RTC of the board. This command needs the command line parameter of server's IP address or environment variable "ntpserverip". The network time is sent as UTC. So if you want to set local time to RTC, set the offset in second from UTC to the -enviroment variable "time offset". +environment variable "time offset". If the DHCP server provides time server's IP or time offset, you don't need to set the above environment variables yourself. diff --git a/doc/README.Sandpoint8240 b/doc/README.Sandpoint8240 index a41b69aced..fa846dc33e 100644 --- a/doc/README.Sandpoint8240 +++ b/doc/README.Sandpoint8240 @@ -236,7 +236,7 @@ PART 10) => setenv serverip 192.168.0.10 => setenv gatewayip=192.168.0.1 => saveenv -Saving Enviroment to Flash... +Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... done @@ -296,7 +296,7 @@ Erase Flash Bank # 2 - missing => cp.b 0x100000 FFF00000 1f28c Copy to Flash... done => saveenv -Saving Enviroment to Flash... +Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... done @@ -330,7 +330,7 @@ Erase Flash from 0xfff00000 to 0xfff3ffff done Erased 7 sectors Copy to Flash... done -Saving Enviroment to Flash... +Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... done diff --git a/doc/README.at91 b/doc/README.at91 index 84b5595a92..b51df00da7 100644 --- a/doc/README.at91 +++ b/doc/README.at91 @@ -62,16 +62,16 @@ Environment variables U-Boot environment variables can be stored at different places: - Dataflash on SPI chip select 0 (dataflash card) - Nand flash. - - Nor falsh (not populate by default) + - Nor flash (not populate by default) You can choose your storage location at config step (here for at91sam9260ek) : make at91sam9263ek_config - use data flash (spi cs0) (default) make at91sam9263ek_nandflash_config - use nand flash make at91sam9263ek_dataflash_cs0_config - use data flash (spi cs0) - make at91sam9263ek_norflash_config - use nor falsh + make at91sam9263ek_norflash_config - use nor flash You can choose to boot directly from U-Boot at config step - make at91sam9263ek_norflash_boot_config - boot from nor falsh + make at91sam9263ek_norflash_boot_config - boot from nor flash ------------------------------------------------------------------------------ diff --git a/doc/README.ebony b/doc/README.ebony index a8479a4799..4df00b3561 100644 --- a/doc/README.ebony +++ b/doc/README.ebony @@ -4,7 +4,7 @@ ======================================================================= This file contains some handy info regarding U-Boot and the AMCC -Ebony evalutation board. See the README.ppc440 for additional +Ebony evaluation board. See the README.ppc440 for additional information. diff --git a/doc/README.fsl-ddr b/doc/README.fsl-ddr index 1d50153d58..5e21658765 100644 --- a/doc/README.fsl-ddr +++ b/doc/README.fsl-ddr @@ -250,7 +250,7 @@ print [c] [d] [spd] [dimmparms] [commonparms] [opts] [addresses] [regs] c - the controller number, eg. c0, c1 d - the DIMM number, eg. d0, d1 spd - print SPD data - dimmparms - DIMM paramaters, calcualted from SPD + dimmparms - DIMM parameters, calculated from SPD commonparms - lowest common parameters for all DIMMs opts - options addresses - address assignment (not implemented yet) @@ -260,7 +260,7 @@ edit c - the controller number, eg. c0, c1 d - the DIMM number, eg. d0, d1 spd - print SPD data - dimmparms - DIMM paramaters, calcualted from SPD + dimmparms - DIMM parameters, calculated from SPD commonparms - lowest common parameters for all DIMMs opts - options addresses - address assignment (not implemented yet) diff --git a/doc/README.mpc832xemds b/doc/README.mpc832xemds index 688bdbb201..4142aa9c8d 100644 --- a/doc/README.mpc832xemds +++ b/doc/README.mpc832xemds @@ -15,7 +15,7 @@ Freescale MPC832XEMDS Board "On" == 0 SW3 is switch 18 as silk-screened onto the board. - SW4[8] is the bit labled 8 on Switch 4. + SW4[8] is the bit labeled 8 on Switch 4. SW5[1:6] refers to bits labeled 1 through 6 in order on switch 5. SW6[7:1] refers to bits labeled 7 through 1 in order on switch 6. SW7[1:8]= 0000_0001 refers to bits labeled 1 through 6 is set as "On" diff --git a/doc/README.mpc8360emds b/doc/README.mpc8360emds index 2b39160418..6afa753969 100644 --- a/doc/README.mpc8360emds +++ b/doc/README.mpc8360emds @@ -15,7 +15,7 @@ Freescale MPC8360EMDS Board "On" == 0 SW18 is switch 18 as silk-screened onto the board. - SW4[8] is the bit labled 8 on Switch 4. + SW4[8] is the bit labeled 8 on Switch 4. SW2[1:6] refers to bits labeled 1 through 6 in order on switch 2. SW3[7:1] refers to bits labeled 7 through 1 in order on switch 3. SW3[1:8]= 0000_0001 refers to bits labeled 1 through 6 is set as "On" diff --git a/doc/README.mpc837xemds b/doc/README.mpc837xemds index aa767ae7d8..faf21c9ffb 100644 --- a/doc/README.mpc837xemds +++ b/doc/README.mpc837xemds @@ -14,7 +14,7 @@ Freescale MPC837xEMDS Board "Off" == 1 "On" == 0 - SW4[8] is the bit labled 8 on Switch 4. + SW4[8] is the bit labeled 8 on Switch 4. SW2[1:6] refers to bits labeled 1 through 6 in order on switch 2. SW2[1:8]= 0000_0001 refers to bits labeled 1 through 7 is set as "On" and bits labeled 8 is set as "Off". diff --git a/doc/README.mpc8544ds b/doc/README.mpc8544ds index bf257a0054..b49c3c07c4 100644 --- a/doc/README.mpc8544ds +++ b/doc/README.mpc8544ds @@ -22,7 +22,7 @@ boot bank at 0xfff8_0000. Memory Map ---------- -0xff80_0000 - 0xffbf_ffff Alernate bank 4MB +0xff80_0000 - 0xffbf_ffff Alternate bank 4MB 0xffc0_0000 - 0xffff_ffff Boot bank 4MB 0xffb8_0000 Alternate image start 512KB diff --git a/doc/README.mpc8572ds b/doc/README.mpc8572ds index 06dab596be..57fd2ad616 100644 --- a/doc/README.mpc8572ds +++ b/doc/README.mpc8572ds @@ -19,7 +19,7 @@ Booting is always from the boot bank at 0xec00_0000. Memory Map ---------- -0xe800_0000 - 0xebff_ffff Alernate bank 64MB +0xe800_0000 - 0xebff_ffff Alternate bank 64MB 0xec00_0000 - 0xefff_ffff Boot bank 64MB 0xebf8_0000 - 0xebff_ffff Alternate u-boot address 512KB @@ -115,7 +115,7 @@ Implementing AMP(Asymmetric MultiProcessing) - Select "Advanced setup" -> " Prompt for advanced kernel configuration options" - Select "Set physical address where the kernel is loaded" and - set it to 0x20000000, asssuming core1 will start from 512MB. + set it to 0x20000000, assuming core1 will start from 512MB. - Select "Set custom page offset address" - Select "Set custom kernel base address" - Select "Set maximum low memory" diff --git a/doc/README.mpc85xxads b/doc/README.mpc85xxads index d059a97981..28bbcbe095 100644 --- a/doc/README.mpc85xxads +++ b/doc/README.mpc85xxads @@ -35,7 +35,7 @@ Updated 13-July-2004 Jon Loeliger "On" == 0 SW18 is switch 18 as silk-screened onto the board. - SW4[8] is the bit labled 8 on Switch 4. + SW4[8] is the bit labeled 8 on Switch 4. SW2[1:6] refers to bits labeled 1 through 6 in order on switch 2 SW3[7:1] refers to bits labeled 7 through 1 in order on switch 3 diff --git a/doc/README.mvbc_p b/doc/README.mvbc_p index e3fcb4eb1b..a691137550 100644 --- a/doc/README.mvbc_p +++ b/doc/README.mvbc_p @@ -33,7 +33,7 @@ Matrix Vision mvBlueCOUGAR-P (mvBC-P) 2.4 I2C LM75 @ 0x90 for temperature monitoring. EEPROM @ 0xA0 for vendor specifics. - image sensor interface (slave adresses depend on sensor) + image sensor interface (slave addresses depend on sensor) 3 Flash layout. diff --git a/doc/README.mvblm7 b/doc/README.mvblm7 index 3ee9396540..a0686f7fa5 100644 --- a/doc/README.mvblm7 +++ b/doc/README.mvblm7 @@ -40,10 +40,10 @@ Matrix Vision mvBlueLYNX-M7 (mvBL-M7) MAX5381 DAC @ 0x60 for 1st digital input threshold. LM75 @ 0x90 for temperature monitoring. EEPROM @ 0xA0 for system setup (HRCW etc.) + vendor specifics. - 1st image sensor interface (slave adresses depend on sensor) + 1st image sensor interface (slave addresses depend on sensor) Bus2: MAX5381 DAC @ 0x60 for 2nd digital input threshold. - 2nd image sensor interface (slave adresses depend on sensor) + 2nd image sensor interface (slave addresses depend on sensor) 3 Flash layout. diff --git a/doc/README.mvsmr b/doc/README.mvsmr index d729ea6fbe..8e34cb7838 100644 --- a/doc/README.mvsmr +++ b/doc/README.mvsmr @@ -23,7 +23,7 @@ Matrix Vision mvSMR 2.4 I2C EEPROM @ 0xA0 for vendor specifics. - image sensor interface (slave adresses depend on sensor) + image sensor interface (slave addresses depend on sensor) 3 Flash layout. diff --git a/doc/README.ocotea b/doc/README.ocotea index 9ac3a184cb..be79b03c8a 100644 --- a/doc/README.ocotea +++ b/doc/README.ocotea @@ -4,7 +4,7 @@ ======================================================================= This file contains some handy info regarding U-Boot and the AMCC -Ocotea 440gx evalutation board. See the README.ppc440 for additional +Ocotea 440gx evaluation board. See the README.ppc440 for additional information. diff --git a/doc/README.p2020rdb b/doc/README.p2020rdb index 8a2302fa99..cb664a5bd7 100644 --- a/doc/README.p2020rdb +++ b/doc/README.p2020rdb @@ -17,7 +17,7 @@ Booting by default is always from the boot bank at 0xef00_0000. Memory Map ---------- -0xef00_0000 - 0xef7f_ffff Alernate bank 8MB +0xef00_0000 - 0xef7f_ffff Alternate bank 8MB 0xe800_0000 - 0xefff_ffff Boot bank 8MB 0xef78_0000 - 0xef7f_ffff Alternate u-boot address 512KB @@ -89,7 +89,7 @@ Implementing AMP(Asymmetric MultiProcessing) "Prompt for advanced kernel configuration options" - Select "Set physical address where the kernel is loaded" - and set it to 0x20000000, asssuming core1 will + and set it to 0x20000000, assuming core1 will start from 512MB. - Select "Set custom page offset address" - Select "Set custom kernel base address" -- cgit v1.2.3 From 65029492914ea96dec0bfe25a987463a869c72d2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 5 Mar 2012 13:46:51 +0000 Subject: net: smc91111: use mdelay() We've already got a mdelay() func in common code, so use that instead. Signed-off-by: Mike Frysinger --- drivers/net/smc91111.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c index 9b8236ddf0..5cfef4dd7b 100644 --- a/drivers/net/smc91111.c +++ b/drivers/net/smc91111.c @@ -1168,17 +1168,6 @@ static void smc_write_phy_register (struct eth_device *dev, byte phyreg, #endif /* !CONFIG_SMC91111_EXT_PHY */ -/*------------------------------------------------------------ - . Waits the specified number of milliseconds - kernel friendly - .-------------------------------------------------------------*/ -#ifndef CONFIG_SMC91111_EXT_PHY -static void smc_wait_ms(unsigned int ms) -{ - udelay(ms*1000); -} -#endif /* !CONFIG_SMC91111_EXT_PHY */ - - /*------------------------------------------------------------ . Configures the specified PHY using Autonegotiation. Calls . smc_phy_fixed() if the user has requested a certain config. @@ -1205,7 +1194,7 @@ static void smc_phy_configure (struct eth_device *dev) break; } - smc_wait_ms (500); /* wait 500 millisecs */ + mdelay(500); /* wait 500 millisecs */ } if (timeout < 1) { @@ -1270,7 +1259,7 @@ static void smc_phy_configure (struct eth_device *dev) break; } - smc_wait_ms (500); /* wait 500 millisecs */ + mdelay(500); /* wait 500 millisecs */ /* Restart auto-negotiation if remote fault */ if (status & PHY_STAT_REM_FLT) { -- cgit v1.2.3 From 834c9384a43f36464982521163f6462857e560e6 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Mon, 5 Mar 2012 08:12:28 +0000 Subject: cmd_pxe.c: fix strict-aliasing warnings Without this patch, some versions of gcc (at least ELDK 4.2) complain about dereferencing type-punned pointers. Reported-by: Marek Vasut Signed-off-by: Jason Hobbs Cc: Heiko Schocher Cc: Marek Vasut Acked-by: Heiko Schocher --- common/cmd_pxe.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 8a68fa1ae3..b3c1f67a33 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -318,7 +318,7 @@ static int do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *pxefile_addr_str; - void *pxefile_addr_r; + unsigned long pxefile_addr_r; int err; if (argc != 1) @@ -339,10 +339,10 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) * Keep trying paths until we successfully get a file we're looking * for. */ - if (pxe_uuid_path(pxefile_addr_r) > 0 - || pxe_mac_path(pxefile_addr_r) > 0 - || pxe_ipaddr_paths(pxefile_addr_r) > 0 - || get_pxelinux_path("default", pxefile_addr_r) > 0) { + if (pxe_uuid_path((void *)pxefile_addr_r) > 0 + || pxe_mac_path((void *)pxefile_addr_r) > 0 + || pxe_ipaddr_paths((void *)pxefile_addr_r) > 0 + || get_pxelinux_path("default", (void *)pxefile_addr_r) > 0) { printf("Config file found\n"); @@ -363,7 +363,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) */ static int get_relfile_envaddr(char *file_path, char *envaddr_name) { - void *file_addr; + unsigned long file_addr; char *envaddr; envaddr = from_env(envaddr_name); @@ -371,10 +371,10 @@ static int get_relfile_envaddr(char *file_path, char *envaddr_name) if (!envaddr) return -ENOENT; - if (strict_strtoul(envaddr, 16, (unsigned long *)&file_addr) < 0) + if (strict_strtoul(envaddr, 16, &file_addr) < 0) return -EINVAL; - return get_relfile(file_path, file_addr); + return get_relfile(file_path, (void *)file_addr); } /* -- cgit v1.2.3 From 127e19e28d01782b422f0e283678e7e838547aa8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 5 Jan 2012 17:54:55 +0000 Subject: Remove CONFIG_SYS_EXTBDINFO from snapper9260.h This feature is not available on ARM, so it is an error to define it. Signed-off-by: Simon Glass Acked-by: Stefano Babic --- include/configs/snapper9260.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index cb3c674f49..cee65d1695 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -157,7 +157,6 @@ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ sizeof(CONFIG_SYS_PROMPT) + 16) #define CONFIG_SYS_LONGHELP -#define CONFIG_SYS_EXTBDINFO #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE #define CONFIG_SYS_HUSH_PARSER -- cgit v1.2.3 From f3e6110a10b694b3beb1ba7704fb7632cc371844 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 7 Jan 2012 23:14:35 +0000 Subject: lzma: fix printf warnings Fix size_t printf format warnings: LzmaTools.c: In function 'lzmaBuffToBuffDecompress': LzmaTools.c:110:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' LzmaTools.c:111:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' Signed-off-by: Mike Frysinger --- lib/lzma/LzmaTools.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lzma/LzmaTools.c b/lib/lzma/LzmaTools.c index 2eafad246e..28a8aefc2c 100644 --- a/lib/lzma/LzmaTools.c +++ b/lib/lzma/LzmaTools.c @@ -107,8 +107,8 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize, } } - debug ("LZMA: Uncompresed size............ 0x%x\n", outSizeFull); - debug ("LZMA: Compresed size.............. 0x%x\n", compressedSize); + debug("LZMA: Uncompresed size............ 0x%zx\n", outSizeFull); + debug("LZMA: Compresed size.............. 0x%zx\n", compressedSize); g_Alloc.Alloc = SzAlloc; g_Alloc.Free = SzFree; -- cgit v1.2.3