summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/misc.c17
-rw-r--r--common/version.c10
-rw-r--r--include/common.h2
-rw-r--r--lib/process_escape_sequence.c2
4 files changed, 21 insertions, 10 deletions
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 @@ 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/version.c b/common/version.c
index d33f4d0..e21dbbe 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/include/common.h b/include/common.h
index 59fcd35..88af931 100644
--- a/include/common.h
+++ b/include/common.h
@@ -233,6 +233,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/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 @@ 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());