summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-07-01 09:37:37 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-01 09:37:37 +0200
commit85b427ffedfe19f0810808b6739e77be54112170 (patch)
tree07620b46336fdc6fb6a564a03479197c91f07066
parent2720526fa4c0c3b02891a419451b6f1bf8b768a5 (diff)
parent2177c1c20c83543e559b404208aee21ff4cf037c (diff)
downloadbarebox-85b427ffedfe19f0810808b6739e77be54112170.tar.gz
barebox-85b427ffedfe19f0810808b6739e77be54112170.tar.xz
Merge branch 'for-next/misc'
-rwxr-xr-xMAKEALL4
-rw-r--r--Makefile2
-rw-r--r--commands/detect.c17
-rw-r--r--common/misc.c17
-rw-r--r--common/module.c3
-rw-r--r--common/version.c10
-rw-r--r--drivers/mtd/core.c2
-rw-r--r--fs/fs.c18
-rw-r--r--fs/tftp.c5
-rw-r--r--include/common.h2
-rw-r--r--include/fs.h2
-rw-r--r--include/mfd/mc34708.h9
-rw-r--r--include/stdio.h3
-rw-r--r--lib/process_escape_sequence.c2
14 files changed, 74 insertions, 22 deletions
diff --git a/MAKEALL b/MAKEALL
index 18ed86216a..bf9131abbf 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -34,7 +34,7 @@ usage() {
echo "The cross-compiler can be specify via"
echo " CROSS_COMPILE default"
echo " CROSS_COMPILE_<arch> arch default"
- echo " CROSS_COMPILE_<target> deconfig specifc"
+ echo " CROSS_COMPILE_<target> defconfig specific"
echo ""
echo "it will be evaluated in the invert order"
echo ""
@@ -70,7 +70,7 @@ stats() {
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 45e78626f1..8c1becbc0c 100644
--- a/Makefile
+++ b/Makefile
@@ -898,7 +898,7 @@ all: modules
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 0010a17779..fbce4eb0ce 100644
--- a/commands/detect.c
+++ b/commands/detect.c
@@ -28,8 +28,9 @@ static int do_detect(int argc, char *argv[])
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 @@ static int do_detect(int argc, char *argv[])
case 'e':
option_error = 1;
break;
+ case 'a':
+ option_all = 1;
+ break;
+ default:
+ return COMMAND_ERROR_USAGE;
}
}
@@ -48,6 +54,15 @@ static int do_detect(int argc, char *argv[])
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 e9fdacc655..806649431d 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -125,3 +125,20 @@ EXPORT_SYMBOL(perror);
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 109fe5cd00..eb882bce31 100644
--- a/common/module.c
+++ b/common/module.c
@@ -129,9 +129,6 @@ static int simplify_symbols(Elf32_Shdr *sechdrs,
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 d33f4d0078..e21dbbedfa 100644
--- a/common/version.c
+++ b/common/version.c
@@ -1,7 +1,6 @@
#include <common.h>
#include <generated/compile.h>
#include <generated/utsrelease.h>
-#include <of.h>
const char version_string[] =
"barebox " UTS_RELEASE " " UTS_VERSION "\n";
@@ -9,13 +8,6 @@ EXPORT_SYMBOL(version_string);
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 f3580981f0..c7c0fd64f0 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -70,7 +70,7 @@ static ssize_t mtd_op_read(struct cdev *cdev, void* buf, size_t count,
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 7e2fb78845..d913a503f2 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -38,10 +38,21 @@ void *read_file(const char *filename, size_t *size)
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 @@ void *read_file(const char *filename, size_t *size)
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 f86a7d1b0f..50efe0d77c 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -598,7 +598,10 @@ static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)
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 fc2c8ca8be..744b19ea7b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -234,6 +234,8 @@ void barebox_banner(void);
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 7c4e46175a..22c07467da 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -149,6 +149,8 @@ int protect(int fd, size_t count, unsigned long offset, int prot);
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 f384c62a8a..541c47ff0e 100644
--- a/include/mfd/mc34708.h
+++ b/include/mfd/mc34708.h
@@ -93,7 +93,14 @@ struct mc34708 {
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 5c091a8eab..71dbae35ca 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -70,7 +70,7 @@ static inline int ctrlc (void)
{
return 0;
}
-#endif /* ARCH_HAS_CTRC */
+#endif /* ARCH_HAS_CTRLC */
#endif
@@ -101,7 +101,6 @@ static inline void putchar(char c)
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 7cc3898d5c..612976b9d4 100644
--- a/lib/process_escape_sequence.c
+++ b/lib/process_escape_sequence.c
@@ -54,7 +54,7 @@ int process_escape_sequence(const char *source, char *dest, int destlen)
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());