Skip to contentSkip to conversation

(reformated) Allow board specific fancy banner

PATCH In review Franck JULLIEN 3 participants 4 messages Dec 26, 2010 – Dec 29, 2010 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (reformated) Allow board specific fancy banner

This time I used git to send the email. I think I get it right. However, I didn't find how to put this file in the thread we were later... I don't think it is possible since those emails didn't have ID's to use with the In-Reply-To option (right ?).

---
 common/Kconfig   |    6 ++++++
 common/console.c |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
common/Kconfig +6 -0
index 617f640..d46c8fc 100644
@@ -248,6 +248,12 @@ config HUSH_FANCY_PROMPT
 	  Allow to set PS1 from the command line. PS1 can have several escaped commands
 	  like \h for CONFIG_BOARDINFO or \w for the current working directory.
 
+config BOARD_BANNER
+	bool
+	prompt "allow a board specific fancy banner"
+	help
+	  Allow to define a custom board banner (you must define BOARD_BANNER in your config.h)
+
 config HUSH_GETOPT
 	bool
 	depends on SHELL_HUSH
common/console.c +10 -0
index 82786f2..8a830e3 100644
@@ -46,7 +46,17 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)
 {
 	printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
+#ifdef CONFIG_BOARD_BANNER
+#ifdef BOARD_BANNER
+	printf(RELOC(BOARD_BANNER));
+#else
+#define VT100_YELLOW	"\033[1;33m"
+#define VT100_RESET	"\033[1;0m"
+	printf(RELOC("Board: " VT100_YELLOW CONFIG_BOARDINFO VT100_RESET "\n"));
+#endif
+#else
 	printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+#endif
 }
 
 static int __early_initdata initialized = 0;
Signature · 7 lines
1.7.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 32 lines · Franck JULLIEN

This time I used git to send the email. I think I get it right. However, I didn't find how to put this file in the thread we were later... I don't think it is possible since those emails didn't have ID's to use with the In-Reply-To option (right ?).

---
 common/Kconfig   |    6 ++++++
 common/console.c |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
common/Kconfig +6 -0
index 617f640..d46c8fc 100644
@@ -248,6 +248,12 @@ config HUSH_FANCY_PROMPT
 	  Allow to set PS1 from the command line. PS1 can have several escaped commands
 	  like \h for CONFIG_BOARDINFO or \w for the current working directory.
 
+config BOARD_BANNER
+	bool
+	prompt "allow a board specific fancy banner"
+	help
+	  Allow to define a custom board banner (you must define BOARD_BANNER in your config.h)
+
 config HUSH_GETOPT
 	bool
 	depends on SHELL_HUSH
common/console.c +0 -0
index 82786f2..8a830e3 100644

common/console.c EXPORT_SYMBOL(console_list); · line 55

Quoted 10 lines
common/console.c +7 -0
@@ -46,7 +46,17 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)
 {
 	printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
+#ifdef CONFIG_BOARD_BANNER
+#ifdef BOARD_BANNER
+	printf(RELOC(BOARD_BANNER));
+#else
+#define VT100_YELLOW	"\033[1;33m"
+#define VT100_RESET	"\033[1;0m"
+	printf(RELOC("Board: " VT100_YELLOW CONFIG_BOARDINFO VT100_RESET "\n"));

why not define it in the Kconfig simply?

I'm sorry but I do not see why we can not do it in the defconfig

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
In reply to a message not in the archive
Quoted 28 lines
     > diff --git a/common/console.c b/common/console.c
     > index 82786f2..8a830e3 100644
     > --- a/common/console.c
     > +++ b/common/console.c
     > @@ -46,7 +46,17 @@ EXPORT_SYMBOL(console_list);
     >  static void display_banner (void)
     >  {
     >       printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
     > +#ifdef CONFIG_BOARD_BANNER
     > +#ifdef BOARD_BANNER
     > +     printf(RELOC(BOARD_BANNER));
     > +#else
     > +#define VT100_YELLOW "\033[1;33m"
     > +#define VT100_RESET  "\033[1;0m"
     > +     printf(RELOC("Board: " VT100_YELLOW CONFIG_BOARDINFO VT100_RESET
     "\n"));
     why not define it in the Kconfig simply?

     I'm sorry but I do not see why we can not do it in the defconfig

     Best Regards,
     J.

We could do it in the arch/_the_arch_/Kconfig with depends on _your_board_ but I don't think that the better/more generic way. Moreover, if we ask for the banner in Kconfig (with a string entry), fancy escape code and/or carriage return will be hard to enter manually.
This is for example what I use for my neek board:

Quoted 7 lines
   #define BOARD_BANNER "\e[1;32m\
   ****************************************\n\
   *          Altera NEEK board           *\n\
   ****************************************\
   \e[0m\n\n"
   However, if you want I could manage to use the Kconfig way.....
   Best regards,

so define completely the banner in the config.h
no VT100.... in the console.c as diferrent boards will have different colour

and something like this will be better

#ifndef CONFIG_BOARD_BANNER
#undef CONFIG_BOARD_BANNER_TEXT
#define CONFIG_BOARD_BANNER_TEXT "Board: " CONFIG_BOARDINFO "\n" #endif

printf(RELOC(CONFIG_BOARD_BANNER_TEXT));

please keep CONFIG_xxxx for the macro even in the config.h

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#4 lore raw
In reply to Franck JULLIEN
Quoted 4 lines · Franck JULLIEN

This time I used git to send the email. I think I get it right. However, I didn't find how to put this file in the thread we were later... I don't think it is possible since those emails didn't have ID's to use with the In-Reply-To option (right ?).

--in-reply-to '[email protected]' would have been the correct option.

And please put such infomal text after the tripple dash below, otherwise it will end up in the commit log.

Quoted 10 lines
---
 common/Kconfig   |    6 ++++++
 common/console.c |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
common/Kconfig +0 -0
index 617f640..d46c8fc 100644

common/Kconfig config HUSH_FANCY_PROMPT · line 255

Quoted 8 lines
common/Kconfig +5 -0
@@ -248,6 +248,12 @@ config HUSH_FANCY_PROMPT
 	  Allow to set PS1 from the command line. PS1 can have several escaped commands
 	  like \h for CONFIG_BOARDINFO or \w for the current working directory.
 
+config BOARD_BANNER
+	bool
+	prompt "allow a board specific fancy banner"
+	help
+	  Allow to define a custom board banner (you must define BOARD_BANNER in your config.h)

The patch below seems to handle a missing BOARD_BANNER just fine, so maybe s/must/can/.

Best regards
Uwe

Quoted 35 lines
common/Kconfig +1 -0
+
 config HUSH_GETOPT
 	bool
 	depends on SHELL_HUSH
common/console.c +10 -0
index 82786f2..8a830e3 100644
@@ -46,7 +46,17 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)
 {
 	printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
+#ifdef CONFIG_BOARD_BANNER
+#ifdef BOARD_BANNER
+	printf(RELOC(BOARD_BANNER));
+#else
+#define VT100_YELLOW	"\033[1;33m"
+#define VT100_RESET	"\033[1;0m"
+	printf(RELOC("Board: " VT100_YELLOW CONFIG_BOARDINFO VT100_RESET "\n"));
+#endif
+#else
 	printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+#endif
 }
 
 static int __early_initdata initialized = 0;
Signature · 7 lines
1.7.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 7 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox