diff --git a/MAKEALL b/MAKEALL index 18ed862..bf9131a 100755 --- a/MAKEALL +++ b/MAKEALL @@ -34,7 +34,7 @@ echo "The cross-compiler can be specify via" echo " CROSS_COMPILE default" echo " CROSS_COMPILE_ arch default" - echo " CROSS_COMPILE_ deconfig specifc" + echo " CROSS_COMPILE_ defconfig specific" echo "" echo "it will be evaluated in the invert order" echo "" @@ -70,7 +70,7 @@ time_diff=$((${time_stop} - ${time_start})) printf "compiled in %4is\n" ${time_diff} if [ ${nb_errors} -gt 0 ] ; then - echo "defcongids with warnings or errors: ${nb_errors} (${errors_list} )" + echo "defconfigs with warnings or errors: ${nb_errors} (${errors_list} )" fi echo "----------------------------------------------------------" diff --git a/Makefile b/Makefile index 45e7862..8c1becb 100644 --- a/Makefile +++ b/Makefile @@ -898,7 +898,7 @@ PHONY += modules modules: $(barebox-dirs) $(if $(KBUILD_BUILTIN),barebox) - @echo ' Building modules, stage 2.'; + @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost diff --git a/commands/detect.c b/commands/detect.c index 0010a17..fbce4eb 100644 --- a/commands/detect.c +++ b/commands/detect.c @@ -28,8 +28,9 @@ int opt, i, ret; int option_list = 0; int option_error = 0; + int option_all = 0; - while ((opt = getopt(argc, argv, "el")) > 0) { + while ((opt = getopt(argc, argv, "ela")) > 0) { switch (opt) { case 'l': option_list = 1; @@ -37,6 +38,11 @@ case 'e': option_error = 1; break; + case 'a': + option_all = 1; + break; + default: + return COMMAND_ERROR_USAGE; } } @@ -48,6 +54,15 @@ return 0; } + if (option_all) { + for_each_device(dev) { + ret = device_detect(dev); + if (ret && ret != -ENOSYS && option_error) + return ret; + } + return 0; + } + if (argc == optind) return COMMAND_ERROR_USAGE; diff --git a/common/misc.c b/common/misc.c index e9fdacc..8066494 100644 --- a/common/misc.c +++ b/common/misc.c @@ -125,3 +125,20 @@ void (*do_execute)(void *func, int argc, char *argv[]); EXPORT_SYMBOL(do_execute); + +static const char *boardinfo; + +const char *barebox_boardinfo(void) +{ + if (boardinfo) + return boardinfo; + + boardinfo = of_get_model(); + if (boardinfo) + boardinfo = xstrdup(boardinfo); + else + boardinfo = CONFIG_BOARDINFO; + + return boardinfo; +} +EXPORT_SYMBOL(barebox_boardinfo); diff --git a/common/module.c b/common/module.c index 109fe5c..eb882bc 100644 --- a/common/module.c +++ b/common/module.c @@ -129,9 +129,6 @@ return ret; } -#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) -#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) - /* Update size with this section: return offset. */ static long get_offset(unsigned long *size, Elf32_Shdr *sechdr) { diff --git a/common/version.c b/common/version.c index d33f4d0..e21dbbe 100644 --- a/common/version.c +++ b/common/version.c @@ -1,7 +1,6 @@ #include #include #include -#include const char version_string[] = "barebox " UTS_RELEASE " " UTS_VERSION "\n"; @@ -9,13 +8,6 @@ void barebox_banner (void) { - const char *board; - - board = of_get_model(); - - if (!board) - board = CONFIG_BOARDINFO; - pr_info("\n\n%s\n\n", version_string); - pr_info("Board: %s\n", board); + pr_info("Board: %s\n", barebox_boardinfo()); } diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index f358098..c7c0fd6 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -70,7 +70,7 @@ int ret; unsigned long offset = _offset; - dev_dbg(cdev->dev, "read ofs: 0x%08lx count: 0x%08x\n", + dev_dbg(cdev->dev, "read ofs: 0x%08lx count: 0x%08zx\n", offset, count); ret = mtd_read(mtd, offset, count, &retlen, buf); diff --git a/fs/fs.c b/fs/fs.c index 7e2fb78..d913a50 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -38,10 +38,21 @@ int fd; struct stat s; void *buf = NULL; + const char *tmpfile = "/.read_file_tmp"; + int ret; +again: if (stat(filename, &s)) return NULL; + if (s.st_size == FILESIZE_MAX) { + ret = copy_file(filename, tmpfile, 0); + if (ret) + return NULL; + filename = tmpfile; + goto again; + } + buf = xzalloc(s.st_size + 1); fd = open(filename, O_RDONLY); @@ -56,12 +67,19 @@ if (size) *size = s.st_size; + if (filename == tmpfile) + unlink(tmpfile); + return buf; err_out1: close(fd); err_out: free(buf); + + if (filename == tmpfile) + unlink(tmpfile); + return NULL; } diff --git a/fs/tftp.c b/fs/tftp.c index f86a7d1..50efe0d 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -598,7 +598,10 @@ return PTR_ERR(priv); s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO; - s->st_size = priv->filesize; + if (priv->filesize) + s->st_size = priv->filesize; + else + s->st_size = FILESIZE_MAX; tftp_do_close(priv); diff --git a/include/common.h b/include/common.h index fc2c8ca..744b19e 100644 --- a/include/common.h +++ b/include/common.h @@ -234,6 +234,8 @@ static inline void barebox_banner(void) {} #endif +const char *barebox_boardinfo(void); + #define IOMEM(addr) ((void __force __iomem *)(addr)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) diff --git a/include/fs.h b/include/fs.h index 7c4e461..22c0746 100644 --- a/include/fs.h +++ b/include/fs.h @@ -149,6 +149,8 @@ int protect_file(const char *file, int prot); void *memmap(int fd, int flags); +#define FILESIZE_MAX ((loff_t)-1) + #define PROT_READ 1 #define PROT_WRITE 2 diff --git a/include/mfd/mc34708.h b/include/mfd/mc34708.h index f384c62..541c47f 100644 --- a/include/mfd/mc34708.h +++ b/include/mfd/mc34708.h @@ -93,7 +93,14 @@ unsigned int revision; }; -extern struct mc34708 *mc34708_get(void); +#ifdef CONFIG_MFD_MC34708 +struct mc34708 *mc34708_get(void); +#else +static inline struct mc34708 *mc34708_get(void) +{ + return NULL; +} +#endif extern int mc34708_reg_read(struct mc34708 *mc34708, enum mc34708_reg reg, u32 *val); extern int mc34708_reg_write(struct mc34708 *mc34708, enum mc34708_reg reg, u32 val); diff --git a/include/stdio.h b/include/stdio.h index 5c091a8..71dbae3 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -70,7 +70,7 @@ { return 0; } -#endif /* ARCH_HAS_CTRC */ +#endif /* ARCH_HAS_CTRLC */ #endif @@ -101,7 +101,6 @@ int fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); int fputs(int file, const char *s); int fputc(int file, const char c); -int ftstc(int file); int fgetc(int file); #endif /* __STDIO_H */ diff --git a/lib/process_escape_sequence.c b/lib/process_escape_sequence.c index 7cc3898..612976b 100644 --- a/lib/process_escape_sequence.c +++ b/lib/process_escape_sequence.c @@ -54,7 +54,7 @@ dest[i++] = 0x1b; break; case 'h': - i += snprintf(dest + i, destlen - i, "%s", CONFIG_BOARDINFO); + i += snprintf(dest + i, destlen - i, "%s", barebox_boardinfo()); break; case 'w': i += snprintf(dest + i, destlen - i, "%s", getcwd());