mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* most xxx_defconfig stop linking when console support set to CONSOLE_NONE
@ 2014-10-08  5:42 Kevin Du Huanpeng
  2014-10-08  6:08 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Du Huanpeng @ 2014-10-08  5:42 UTC (permalink / raw)
  To: barebox

Hi,
I find that most xxx_defconfig stop linking when console support set
to CONSOLE_NONE
compile log like:
http://paste.ubuntu.com/8518456/

- - - -
  | Symbol: CONSOLE_NONE [=y]                                               |
  | Type  : boolean                                                         |
  | Prompt: none                                                            |
  |   Location:                                                             |
  |     -> General Settings                                                 |
  |       -> console support (<choice> [=y])                                |
  |   Defined at common/Kconfig:522                                         |
  |   Depends on: <choice>                                                  |

- - - -

most error causes by pr_print undefined.

this macro/function is
defined in:
common/console_common.c
declare in:
include/printk.h

when CONSOLE_NONE is defined,
pr_print is not compiled (rid by #ifndef/#endif) with common/console_common.o
but <printk.h> is included allmost anywhere by including <common.h>
- - - -
#ifndef __COMMON_H_
#define __COMMON_H_     1

#include <stdio.h>
...
#include <asm/common.h>
#include <printk.h>
- - - -
so using pr_print always can past compile because it is declared by
including <common.h>.
but breaks link.

I am confusing with CONSOLE_NONE, what is it mean?
1. the board don't have a console?
        is the board still can have a serial port, but not accepts input?
2. where should the debug messages go?
        the serial port is not a console but
        when CONSOLE_NONE defined, printf just a nothing but return a 0,
        but the pr_print() declared but not defined.
- - - -
FILE: include/stdio.h
static inline int printf(const char *fmt, ...)
{
        return 0;
}
- - - -


- - - -
duhuanpeng
(+86)13719074147

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: most xxx_defconfig stop linking when console support set to CONSOLE_NONE
  2014-10-08  5:42 most xxx_defconfig stop linking when console support set to CONSOLE_NONE Kevin Du Huanpeng
@ 2014-10-08  6:08 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-10-08  6:08 UTC (permalink / raw)
  To: Kevin Du Huanpeng; +Cc: barebox

Hi Kevin,

On Wed, Oct 08, 2014 at 01:42:36PM +0800, Kevin Du Huanpeng wrote:
> 
> I am confusing with CONSOLE_NONE, what is it mean?
> 1. the board don't have a console?
>         is the board still can have a serial port, but not accepts input?
> 2. where should the debug messages go?
>         the serial port is not a console but
>         when CONSOLE_NONE defined, printf just a nothing but return a 0,
>         but the pr_print() declared but not defined.

CONSOLE_NONE is for boards which a) Don't have anything usable for
console or b) have a console but you want to build a quiet,
non-interactive barebox. The idea is to drop all the strings from the
binary to make it smaller.It seems noone ever used CONSOLE_NONE, so it
bitrotted. The following patch fixes this.

Sascha

----------------------------8<---------------------------

From fbb191fd416de27148bc977c320e07c95b4ca36c Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Wed, 8 Oct 2014 08:05:44 +0200
Subject: [PATCH] console: Fix CONSOLE_NONE support

Without console support we need a static inline version of
pr_print and dev_printf, otherwise we get link errors.

Reported-by: Kevin Du Huanpeng <u74147@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/printk.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/printk.h b/include/printk.h
index fb63586..22c6c73 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -21,11 +21,23 @@
 
 /* debugging and troubleshooting/diagnostic helpers. */
 
+#ifndef CONFIG_CONSOLE_NONE
 int pr_print(int level, const char *format, ...)
 	__attribute__ ((format(__printf__, 2, 3)));
 
 int dev_printf(int level, const struct device_d *dev, const char *format, ...)
 	__attribute__ ((format(__printf__, 3, 4)));
+#else
+static inline int pr_print(int level, const char *format, ...)
+{
+	return 0;
+}
+
+static inline int dev_printf(int level, const struct device_d *dev, const char *format, ...)
+{
+	return 0;
+}
+#endif
 
 #define __dev_printf(level, dev, format, args...) \
 	({	\
-- 
2.1.0


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-08  6:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-08  5:42 most xxx_defconfig stop linking when console support set to CONSOLE_NONE Kevin Du Huanpeng
2014-10-08  6:08 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox