Skip to contentSkip to conversation

Add an option to set a board specific banner

PATCH In review Franck JULLIEN 4 participants 8 messages Dec 30, 2010 – Jan 4, 2011 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 Add an option to set a board specific banner

In reply to a message not in the archive

Allow a board specific fancy banner

---

I removed the default fancy banner and do it like Jean-Christophe suggested it.

 common/Kconfig   |    6 ++++++
 common/console.c |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
common/Kconfig +6 -0
index 617f640..d32c1ce 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 can define CONFIG_BOARD_BANNER_TEXT in your config.h)
+
 config HUSH_GETOPT
 	bool
 	depends on SHELL_HUSH
common/console.c +6 -1
index 82786f2..7caef11 100644
@@ -46,7 +46,12 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)
 {
 	printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
-	printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+
+#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));
 }
 
 static int __early_initdata initialized = 0;
Signature · 7 lines
1.7.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Franck JULLIEN

Hi Franck,

Quoted 33 lines · Franck JULLIEN

Allow a board specific fancy banner

---

I removed the default fancy banner and do it like Jean-Christophe suggested it.

 common/Kconfig   |    6 ++++++
 common/console.c |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
common/Kconfig +6 -0
index 617f640..d32c1ce 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 can define CONFIG_BOARD_BANNER_TEXT in your config.h)
+
 config HUSH_GETOPT
 	bool
 	depends on SHELL_HUSH
common/console.c +0 -0
index 82786f2..7caef11 100644
@@ -46,7 +46,12 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)

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

Quoted 10 lines
common/console.c +6 -1
 {
 	printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
-	printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+
+#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));
 }

I do not really understand this patch. CONFIG_BOARDINFO is board specific already, why would we want to add another option?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

2011/1/3 Sascha Hauer <[email protected]>

Quoted 54 lines

Hi Franck,

Quoted 5 lines · Franck JULLIEN

Allow a board specific fancy banner

---

I removed the default fancy banner and do it like Jean-Christophe

suggested it.

common/Kconfig config HUSH_FANCY_PROMPT · line 248

Quoted 11 lines
 common/Kconfig   |    6 ++++++
 common/console.c |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
common/Kconfig +0 -0
index 617f640..d32c1ce 100644
@@ -248,6 +248,12 @@ config HUSH_FANCY_PROMPT
        Allow to set PS1 from the command line. PS1 can have several

escaped commands

common/Kconfig config HUSH_FANCY_PROMPT · line 249

Quoted 1 line
common/Kconfig +0 -0
        like \h for CONFIG_BOARDINFO or \w for the current working

directory.

common/Kconfig config HUSH_FANCY_PROMPT

Quoted 6 lines
common/Kconfig +5 -0
+config BOARD_BANNER
+     bool
+     prompt "allow a board specific fancy banner"
+     help
+       Allow to define a custom board banner (you can define

CONFIG_BOARD_BANNER_TEXT in your config.h)

Quoted 10 lines
common/Kconfig +1 -0
+
 config HUSH_GETOPT
      bool
      depends on SHELL_HUSH
common/console.c +0 -0
index 82786f2..7caef11 100644
@@ -46,7 +46,12 @@ EXPORT_SYMBOL(console_list);
 static void display_banner (void)

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

Quoted 10 lines
common/console.c +6 -1
 {
      printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
-     printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+
+#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));
 }

I do not really understand this patch. CONFIG_BOARDINFO is board specific already, why would we want to add another option?

Quoted 8 lines

Sascha

--

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Hello,

I know CONFIG_BOARDINFO is board specific. However, I think it is more conveniant
to have the possibility to define a banner text outside the Kconfig. For example, I use
this in my config.h:

#define CONFIG_BOARD_BANNER_TEXT "\e[1;32m\
***********************************************************************\n\
* Communication board bootloader (ODSFT0152) *\n\
************************************************************************\
\e[0m\n\n"

So may be we could define this kind of banner in the Kconfig.....

Let me know if you don't like this. This patch was kind of a test for me and we could
forget about it.

Although this patch was very small, we had a lot of discussion around it and I don't
want to imagine what it is going to be when I submit the nios2 port :)

Best regards,
Franck.

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

#5 lore raw
Quoted 9 lines · Franck JULLIEN

2011/1/3 Sascha Hauer <[email protected]>

I know CONFIG_BOARDINFO is board specific. However, I think it is more conveniant
to have the possibility to define a banner text outside the Kconfig. For example, I use
this in my config.h:

Quoted 7 lines

#define CONFIG_BOARD_BANNER_TEXT "\e[1;32m\
***********************************************************************\n\
* Communication board bootloader (ODSFT0152) *\n\
************************************************************************\
\e[0m\n\n"

So may be we could define this kind of banner in the Kconfig.....

Ok, I can see your problem. I think we should rather define a board specific function to display a banner than a string, so something like:

config BOARD_BANNER
bool

#ifdef CONFIG_BOARD_BANNER
	display_board_banner();
#else
	printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));

#endif

This way we can also show runtime dependent information in the banner (like baseboard or whatever).

Quoted 7 lines

Let me know if you don't like this. This patch was kind of a test for me and we could
forget about it.

Although this patch was very small, we had a lot of discussion around it and I don't want to imagine what it is going to be when I submit the nios2 port :)

Don't worry, the amount of comments you receive usually is not proportional to the patch size you send ;)

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

2011/1/3 Sascha Hauer <[email protected]>

Quoted 25 lines · Franck JULLIEN
Quoted 11 lines

2011/1/3 Sascha Hauer <[email protected]>

I know CONFIG_BOARDINFO is board specific. However, I think it is more conveniant
to have the possibility to define a banner text outside the Kconfig. For example, I use
this in my config.h:

#define CONFIG_BOARD_BANNER_TEXT "\e[1;32m\

***********************************************************************\n\

Quoted 5 lines

* Communication board bootloader (ODSFT0152) *\n\
************************************************************************\
\e[0m\n\n"

So may be we could define this kind of banner in the Kconfig.....

Ok, I can see your problem. I think we should rather define a board specific function to display a banner than a string, so something like:

config BOARD_BANNER
bool

Quoted 9 lines
#ifdef CONFIG_BOARD_BANNER
       display_board_banner();
#else
        printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));

#endif

This way we can also show runtime dependent information in the banner (like baseboard or whatever).

Sounds great, I'll do this. Is there anyone responsible for the list in first place ?
Because if I do this in one way but someone would prefer do it another way and
finally the git boss wants it a third way.......

I'll try to post the new patch in response to this thread using the right git command...By the way, I there anything more user friendly
than the git command line to send email in the right format ?

I told you this is a practice/test patch so I have a lot of questions/comments !

Quoted 8 lines
Quoted 3 lines

Let me know if you don't like this. This patch was kind of a test for me

and

Quoted 4 lines

we could
forget about it.

Although this patch was very small, we had a lot of discussion around it

Quoted 9 lines

and

Quoted 1 line

I don't want to imagine what it is going to be when I submit the nios2

port :)

Don't worry, the amount of comments you receive usually is not proportional to the patch size you send ;)

Sascha

Ok, because I was worry :)

Quoted 7 lines

--

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Best regards,
FJ.

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

#7 lore raw
In reply to Sascha Hauer
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Sascha" == Sascha Hauer <[email protected]> writes:

Sascha> Ok, I can see your problem. I think we should rather define a Sascha> board specific function to display a banner than a string, so Sascha> something like:

Sascha> config BOARD_BANNER
Sascha> bool

Sascha> #ifdef CONFIG_BOARD_BANNER
Sascha> display_board_banner();
Sascha> #else
Sascha> printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
Sascha> #endif

Even better, stick:

#ifdef CONFIG_BOARD_BANNER
extern void display_board_banner(void);
#else
static inline void display_board_banner(void)

{
        printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
}

#endif

And get rid of the #ifdef in the C file.

Signature · 6 lines
Bye, Peter Korsgaard

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw
Quoted 17 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Sascha" == Sascha Hauer <[email protected]> writes:

Sascha> Ok, I can see your problem. I think we should rather define a Sascha> board specific function to display a banner than a string, so Sascha> something like:

Sascha> config BOARD_BANNER
Sascha> bool

Sascha> #ifdef CONFIG_BOARD_BANNER
Sascha> display_board_banner();
Sascha> #else
Sascha> printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
Sascha> #endif

Even better, stick:

Quoted 9 lines

#ifdef CONFIG_BOARD_BANNER
extern void display_board_banner(void);
#else
static inline void display_board_banner(void)

{
        printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
}

#endif

The printing of version_string is missing. We could add it to display_board_banner, but I really would like to keep this in a generic place to make sure barebox is recognizable by both users and automatic scripts. Or does anybody wants to fully customize the initial output of barebox?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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