9
0
Fork 0

add function to get boardinfo string

When using devicetrees the boardinfo (or model) can be obtained
from the devicetree. Add a function to get the boardinfo so that
we have a chance to add information from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-06-03 15:04:21 +02:00
parent a34a6f836f
commit 0686fe0edf
4 changed files with 21 additions and 10 deletions

View File

@ -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);

View File

@ -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());
}

View File

@ -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))

View File

@ -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());