public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* patch for 2.4.0 disable printk
@ 2001-01-26 11:05 Stefani Seibold
  2001-01-27  0:09 ` Thunder from the hill
  0 siblings, 1 reply; 12+ messages in thread
From: Stefani Seibold @ 2001-01-26 11:05 UTC (permalink / raw)
  To: torvalds, alan; +Cc: linux-kernel

Hi Linus,
Hi Alan,
Hi everybody,

this kernel patch allows to disable all printk messages, by overloading the 
printk function with a dummy printk macro.

This patch is usefull for embedded systems, where the hardware never changes 
and normaly no textconsole is attachted nor any user will see the boot 
messages. Also, it is nice for rescue disks.

On my system this saves about 10% of disk- and ramspace.
899664
For example: My standart desktop kernel is 994834 bytes, without printk 
messages it is only 899664 bytes long. The basic kernel ram usage is also 10% 
less than the same kernel with printk messages.

Greetings,
Stefani

BTW: this is my first try to submit a kernel patch

-----patch for 2.4.0 disable printk ---

diff -u --recursive --new-file linux/Documentation/Configure.help 
linux.noprintk/Documentation/Configure.help
--- linux/Documentation/Configure.help  Thu Jan  4 22:00:55 2001
+++ linux.noprintk/Documentation/Configure.help Thu Jan 18 12:14:41 2001
@@ -12139,6 +12179,14 @@
 
   If unsure, say Y, or else you won't be able to do much with your new
   shiny Linux system :-)
+
+Disable kernel messages
+CONFIG_PRINTK
+  This option allows you to disable all kernel messages by overriding
+  the printk function with an empty macro.
+  On small embedded systems, this save a lot of rom and ram space. On
+  server or desktop systems you want human readable outputs, so it is
+  normaly the best choice to say N to this option.
 
 Support for console on virtual terminal
 CONFIG_VT_CONSOLE
diff -u --recursive --new-file linux/drivers/char/Config.in 
linux.noprintk/drivers/char/Config.in
--- linux/drivers/char/Config.in        Fri Dec 29 23:07:21 2000
+++ linux.noprintk/drivers/char/Config.in       Thu Jan 18 10:33:07 2001
@@ -4,6 +4,7 @@
 mainmenu_option next_comment
 comment 'Character devices'
 
+bool 'Disable kernel messages' CONFIG_PRINTK
 bool 'Virtual terminal' CONFIG_VT
 if [ "$CONFIG_VT" = "y" ]; then
    bool '  Support for console on virtual terminal' CONFIG_VT_CONSOLE
diff -u --recursive --new-file linux/include/asm-i386/spinlock.h 
linux.noprintk/include/asm-i386/spinlock.h
--- linux/include/asm-i386/spinlock.h   Thu Jan  4 23:50:46 2001
+++ linux.noprintk/include/asm-i386/spinlock.h  Thu Jan 25 23:07:43 2001
@@ -5,8 +5,10 @@
 #include <asm/rwlock.h>
 #include <asm/page.h>
 
+#ifndef CONFIG_PRINTK
 extern int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
+#endif
 
 /* It seems that people are forgetting to
  * initialize their spinlocks properly, tsk tsk.
diff -u --recursive --new-file linux/include/linux/kernel.h 
linux.noprintk/include/linux/kernel.h
--- linux/include/linux/kernel.h        Mon Dec 11 21:49:54 2000
+++ linux.noprintk/include/linux/kernel.h       Thu Jan 25 16:15:17 2001
@@ -68,8 +68,13 @@
 
 extern int session_of_pgrp(int pgrp);
 
+#ifdef CONFIG_PRINTK
+#define        printk(x...)    ((void)0)
+#else
 asmlinkage int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
+#endif
+
 
 extern int console_loglevel;
 
diff -u --recursive --new-file linux/kernel/ksyms.c 
linux.noprintk/kernel/ksyms.c
--- linux/kernel/ksyms.c        Wed Jan  3 01:45:37 2001
+++ linux.noprintk/kernel/ksyms.c       Thu Jan 18 12:14:41 2001
@@ -439,7 +440,9 @@
 
 /* misc */
 EXPORT_SYMBOL(panic);
+#ifndef CONFIG_PRINTK
 EXPORT_SYMBOL(printk);
+#endif
 EXPORT_SYMBOL(sprintf);
 EXPORT_SYMBOL(vsprintf);
 EXPORT_SYMBOL(kdevname);
diff -u --recursive --new-file linux/kernel/printk.c 
linux.noprintk/kernel/printk.c
--- linux/kernel/printk.c       Sun Dec 31 03:16:13 2000
+++ linux.noprintk/kernel/printk.c      Thu Jan 25 23:03:37 2001
@@ -25,7 +25,9 @@
 #define LOG_BUF_LEN    (16384)
 #define LOG_BUF_MASK   (LOG_BUF_LEN-1)
 
+#ifndef CONFIG_PRINTK
 static char buf[1024];
+#endif
 
 /* printk's without a loglevel use this.. */
 #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -251,6 +253,20 @@
        return do_syslog(type, buf, len);
 }
 
+
+#ifdef CONFIG_PRINTK
+#undef printk
+
+#include <linux/module.h>
+
+asmlinkage int printk(const char *fmt, ...)
+{
+       return 0;
+}
+
+EXPORT_SYMBOL_NOVERS(printk);
+
+#else
 asmlinkage int printk(const char *fmt, ...)
 {
        va_list args;
@@ -311,6 +322,7 @@
        wake_up_interruptible(&log_wait);
        return i;
 }
+#endif
 
 void console_print(const char *s)
 {
diff -u --recursive --new-file linux/CREDITS linux.noprintk/CREDITS
--- linux/CREDITS       Sun Dec 31 18:27:57 2000
+++ linux.noprintk/CREDITS      Fri Jan 26 10:51:19 2001
@@ -2395,6 +2395,14 @@
 S: Oldenburg
 S: Germany
 
+N: Stefani Seibold
+E: Stefani@Seibold.net
+D: Possibility to disable all kernel messages by overload printk with a
+D: dummy macro (saves a lot of disk- and ramspace for embedded systems
+D: and rescue disks)
+S: Munich
+S: Germany
+
 N: Darren Senn
 E: sinster@darkwater.com
 D: Whatever I notice needs doing (so far: itimers, /proc)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* patch for 2.4.0 disable printk
@ 2001-01-26 20:46 Stefani Seibold
  2001-01-26 21:13 ` David Weinehall
  0 siblings, 1 reply; 12+ messages in thread
From: Stefani Seibold @ 2001-01-26 20:46 UTC (permalink / raw)
  To: torvalds, alan; +Cc: linux-kernel, Stefani

Hi Linus,
Hi Alan,
Hi everybody,

this kernel patch allows to disable all printk messages, by overloading the 
printk function with a dummy printk macro.

This patch is usefull for embedded systems, where the hardware never changes 
and normaly no textconsole is attachted nor any user will see the boot 
messages. Also, it is nice for rescue disks.

On my system this saves about 10% of disk- and ramspace.

For example: My standart desktop kernel is 994834 bytes, without printk 
messages it is only 899664 bytes long. The basic kernel ram usage is also 10% 
less than the same kernel with printk messages.

Greetings,
Stefani

BTW: this is my first try to submit a kernel patch

-----patch for 2.4.0 disable printk-----

diff -u --recursive --new-file linux/Documentation/Configure.help 
linux.noprintk/Documentation/Configure.help
--- linux/Documentation/Configure.help  Thu Jan  4 22:00:55 2001
+++ linux.noprintk/Documentation/Configure.help Thu Jan 18 12:14:41 2001
@@ -12139,6 +12179,14 @@
 
   If unsure, say Y, or else you won't be able to do much with your new
   shiny Linux system :-)
+
+Disable kernel messages
+CONFIG_PRINTK
+  This option allows you to disable all kernel messages by overriding
+  the printk function with an empty macro.
+  On small embedded systems, this save a lot of rom and ram space. On
+  server or desktop systems you want human readable outputs, so it is
+  normaly the best choice to say N to this option.
 
 Support for console on virtual terminal
 CONFIG_VT_CONSOLE
diff -u --recursive --new-file linux/drivers/char/Config.in 
linux.noprintk/drivers/char/Config.in
--- linux/drivers/char/Config.in        Fri Dec 29 23:07:21 2000
+++ linux.noprintk/drivers/char/Config.in       Thu Jan 18 10:33:07 2001
@@ -4,6 +4,7 @@
 mainmenu_option next_comment
 comment 'Character devices'
 
+bool 'Disable kernel messages' CONFIG_PRINTK
 bool 'Virtual terminal' CONFIG_VT
 if [ "$CONFIG_VT" = "y" ]; then
    bool '  Support for console on virtual terminal' CONFIG_VT_CONSOLE
diff -u --recursive --new-file linux/include/asm-i386/spinlock.h 
linux.noprintk/include/asm-i386/spinlock.h
--- linux/include/asm-i386/spinlock.h   Thu Jan  4 23:50:46 2001
+++ linux.noprintk/include/asm-i386/spinlock.h  Thu Jan 25 23:07:43 2001
@@ -5,8 +5,10 @@
 #include <asm/rwlock.h>
 #include <asm/page.h>
 
+#ifndef CONFIG_PRINTK
 extern int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
+#endif
 
 /* It seems that people are forgetting to
  * initialize their spinlocks properly, tsk tsk.
diff -u --recursive --new-file linux/include/linux/kernel.h 
linux.noprintk/include/linux/kernel.h
--- linux/include/linux/kernel.h        Mon Dec 11 21:49:54 2000
+++ linux.noprintk/include/linux/kernel.h       Thu Jan 25 16:15:17 2001
@@ -68,8 +68,13 @@
 
 extern int session_of_pgrp(int pgrp);
 
+#ifdef CONFIG_PRINTK
+#define        printk(x...)    ((void)0)
+#else
 asmlinkage int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
+#endif
+
 
 extern int console_loglevel;
 
diff -u --recursive --new-file linux/kernel/ksyms.c 
linux.noprintk/kernel/ksyms.c
--- linux/kernel/ksyms.c        Wed Jan  3 01:45:37 2001
+++ linux.noprintk/kernel/ksyms.c       Thu Jan 18 12:14:41 2001
@@ -439,7 +440,9 @@
 
 /* misc */
 EXPORT_SYMBOL(panic);
+#ifndef CONFIG_PRINTK
 EXPORT_SYMBOL(printk);
+#endif
 EXPORT_SYMBOL(sprintf);
 EXPORT_SYMBOL(vsprintf);
 EXPORT_SYMBOL(kdevname);
diff -u --recursive --new-file linux/kernel/printk.c 
linux.noprintk/kernel/printk.c
--- linux/kernel/printk.c       Sun Dec 31 03:16:13 2000
+++ linux.noprintk/kernel/printk.c      Thu Jan 25 23:03:37 2001
@@ -25,7 +25,9 @@
 #define LOG_BUF_LEN    (16384)
 #define LOG_BUF_MASK   (LOG_BUF_LEN-1)
 
+#ifndef CONFIG_PRINTK
 static char buf[1024];
+#endif
 
 /* printk's without a loglevel use this.. */
 #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -251,6 +253,20 @@
        return do_syslog(type, buf, len);
 }
 
+
+#ifdef CONFIG_PRINTK
+#undef printk
+
+#include <linux/module.h>
+
+asmlinkage int printk(const char *fmt, ...)
+{
+       return 0;
+}
+
+EXPORT_SYMBOL_NOVERS(printk);
+
+#else
 asmlinkage int printk(const char *fmt, ...)
 {
        va_list args;
@@ -311,6 +322,7 @@
        wake_up_interruptible(&log_wait);
        return i;
 }
+#endif
 
 void console_print(const char *s)
 {
diff -u --recursive --new-file linux/CREDITS linux.noprintk/CREDITS
--- linux/CREDITS       Sun Dec 31 18:27:57 2000
+++ linux.noprintk/CREDITS      Fri Jan 26 10:51:19 2001
@@ -2395,6 +2395,14 @@
 S: Oldenburg
 S: Germany
 
+N: Stefani Seibold
+E: Stefani@Seibold.net
+D: Possibility to disable all kernel messages by overload printk with a
+D: dummy macro (saves a lot of disk- and ramspace for embedded systems
+D: and rescue disks)
+S: Munich
+S: Germany
+
 N: Darren Senn
 E: sinster@darkwater.com
 D: Whatever I notice needs doing (so far: itimers, /proc)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-26 20:46 Stefani Seibold
@ 2001-01-26 21:13 ` David Weinehall
  0 siblings, 0 replies; 12+ messages in thread
From: David Weinehall @ 2001-01-26 21:13 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: torvalds, alan, linux-kernel

On Fri, Jan 26, 2001 at 09:46:02PM +0100, Stefani Seibold wrote:
> Hi Linus,
> Hi Alan,
> Hi everybody,
> 
> this kernel patch allows to disable all printk messages, by
> overloading the printk function with a dummy printk macro.
> 
> This patch is usefull for embedded systems, where the hardware never
> changes and normaly no textconsole is attachted nor any user will see
> the boot messages. Also, it is nice for rescue disks.
> 
> On my system this saves about 10% of disk- and ramspace.
> 
> For example: My standart desktop kernel is 994834 bytes, without
> printk messages it is only 899664 bytes long. The basic kernel ram
> usage is also 10% less than the same kernel with printk messages.

This could probably be a useful hack, but I suggest you move the
config-option to the "Kernel hacking"-section.


/David
  _                                                                 _
 // David Weinehall <tao@acc.umu.se> /> Northern lights wander      \\
//  Project MCA Linux hacker        //  Dance across the winter sky //
\>  http://www.acc.umu.se/~tao/    </   Full colour fire           </
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-26 11:05 Stefani Seibold
@ 2001-01-27  0:09 ` Thunder from the hill
  2001-01-27 10:57   ` Stefani Seibold
  0 siblings, 1 reply; 12+ messages in thread
From: Thunder from the hill @ 2001-01-27  0:09 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: linux-kernel

Stefani Seibold wrote:
> 
> Hi Linus,
> Hi Alan,
> Hi everybody,
> 
> this kernel patch allows to disable all printk messages, by overloading the
> printk function with a dummy printk macro.
> 
> This patch is usefull for embedded systems, where the hardware never changes
> and normaly no textconsole is attachted nor any user will see the boot
> messages. Also, it is nice for rescue disks.
> 
> On my system this saves about 10% of disk- and ramspace.
> 899664
> For example: My standart desktop kernel is 994834 bytes, without printk
> messages it is only 899664 bytes long. The basic kernel ram usage is also 10%
> less than the same kernel with printk messages.
> 
> Greetings,
> Stefani
> 
> BTW: this is my first try to submit a kernel patch
What sense does it make to ripp the kernel off its "tongue"? This means
to make it completely silent, a oops() could _not_ be noticed! This
means that you don't know when your system has nearly crashed.
You'd better leave printk where it is.

Thunder
---
Woah... I did a "cat /boot/vmlinuz >> /dev/audio" - and I think I heard
god...


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-27  0:09 ` Thunder from the hill
@ 2001-01-27 10:57   ` Stefani Seibold
  2001-01-29 17:40     ` James Simmons
  0 siblings, 1 reply; 12+ messages in thread
From: Stefani Seibold @ 2001-01-27 10:57 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: linux-kernel, Stefani

You are right... this patch make no sense on a computer system with human 
interactions. But think on tiny hidden computers, like in a dishwasher or a 
traffic light. This computer are standalone, if it crash, then it will be 
rebooted.
Nobody will attach a terminal to this kind of computer, nobody is interessted 
on a logfile. Nobody will see a oops, because nobdy is there. 
The hardware of this computer are espacilly designed and will never be 
changed. It is not like a pc, where many different hardware will be attached.
Believe me, i am programming embedded systems since 10 years... i know this 
buissines.
It is also a fine thing for rescued disk, where you never have enough space 
to put all the tools togetehr which are needed.
And rememberf: It is an option, you should it only use, iof u know what u do, 
like many other building a kernel.

Greetings,
Stefani

> What sense does it make to ripp the kernel off its "tongue"? This means
> to make it completely silent, a oops() could _not_ be noticed! This
> means that you don't know when your system has nearly crashed.
> You'd better leave printk where it is.
>
> Thunder
> ---
> Woah... I did a "cat /boot/vmlinuz >> /dev/audio" - and I think I heard
> god...
> Stefani Seibold wrote:
> > this kernel patch allows to disable all printk messages, by overloading
> > the printk function with a dummy printk macro.
> >
> > This patch is usefull for embedded systems, where the hardware never
> > changes and normaly no textconsole is attachted nor any user will see the
> > boot messages. Also, it is nice for rescue disks.
> >
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
@ 2001-01-27 22:31 Stefani Seibold
  2001-01-28  0:44 ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Stefani Seibold @ 2001-01-27 22:31 UTC (permalink / raw)
  To: torvalds, alan; +Cc: Andrew Morton, David Weinehall, linux-kernel, Stefani

Hi guys,

thanks for the feedback. This is now the second try of my disable printk 
patch.

First i moved the option for disabling the prinbtk messages form the menu 
character devices to kernel hacking.

Second, i had change the macro so it calls now a inline funciton 
printk_inline which always return 0. So it should be now compatibel to the 
standard printk funciton.

I hope you like the patch...

Greetings,
Stefani

-----patch for 2.4.0 disable printk-----

diff -u --recursive --new-file linux/Documentation/Configure.help 
linux.noprintk/Documentation/Configure.help
--- linux/Documentation/Configure.help	Thu Jan  4 22:00:55 2001
+++ linux.noprintk/Documentation/Configure.help	Thu Jan 18 12:14:41 2001
@@ -12139,6 +12179,14 @@
 
   If unsure, say Y, or else you won't be able to do much with your new
   shiny Linux system :-)
+
+Disable kernel messages
+CONFIG_PRINTK
+  This option allows you to disable all kernel messages by overriding
+  the printk function with an empty macro.
+  On small embedded systems, this save a lot of rom and ram space. On
+  server or desktop systems you want human readable outputs, so it is
+  normally the best choice to say N to this option.
 
 Support for console on virtual terminal
 CONFIG_VT_CONSOLE
diff -u --recursive --new-file linux/include/asm-i386/spinlock.h 
linux.noprintk/include/asm-i386/spinlock.h
--- linux/include/asm-i386/spinlock.h	Thu Jan  4 23:50:46 2001
+++ linux.noprintk/include/asm-i386/spinlock.h	Thu Jan 25 23:07:43 2001
@@ -5,8 +5,10 @@
 #include <asm/rwlock.h>
 #include <asm/page.h>
 
+#ifndef CONFIG_PRINTK
 extern int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
+#endif
 
 /* It seems that people are forgetting to
  * initialize their spinlocks properly, tsk tsk.
diff -u --recursive --new-file linux/include/linux/kernel.h 
linux.noprintk/include/linux/kernel.h
--- linux/include/linux/kernel.h	Mon Dec 11 21:49:54 2000
+++ linux.noprintk/include/linux/kernel.h	Sat Jan 27 22:22:59 2001
@@ -68,8 +68,18 @@
 
 extern int session_of_pgrp(int pgrp);
 
+#ifdef CONFIG_PRINTK
+#define	printk(x...)	printk_inline()
+
+static inline int printk_inline(void) __attribute__ ((const,unused));
+
+static inline int printk_inline(void)	{ return 0; }
+#else
+
 asmlinkage int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
+#endif
+
 
 extern int console_loglevel;
 
diff -u --recursive --new-file linux/kernel/ksyms.c 
linux.noprintk/kernel/ksyms.c
--- linux/kernel/ksyms.c	Wed Jan  3 01:45:37 2001
+++ linux.noprintk/kernel/ksyms.c	Thu Jan 18 12:14:41 2001
@@ -439,7 +440,9 @@
 
 /* misc */
 EXPORT_SYMBOL(panic);
+#ifndef CONFIG_PRINTK
 EXPORT_SYMBOL(printk);
+#endif
 EXPORT_SYMBOL(sprintf);
 EXPORT_SYMBOL(vsprintf);
 EXPORT_SYMBOL(kdevname);
diff -u --recursive --new-file linux/kernel/printk.c 
linux.noprintk/kernel/printk.c
--- linux/kernel/printk.c	Sun Dec 31 03:16:13 2000
+++ linux.noprintk/kernel/printk.c	Thu Jan 25 23:03:37 2001
@@ -25,7 +25,9 @@
 #define LOG_BUF_LEN	(16384)
 #define LOG_BUF_MASK	(LOG_BUF_LEN-1)
 
+#ifndef CONFIG_PRINTK
 static char buf[1024];
+#endif
 
 /* printk's without a loglevel use this.. */
 #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -251,6 +253,20 @@
 	return do_syslog(type, buf, len);
 }
 
+
+#ifdef CONFIG_PRINTK
+#undef printk
+
+#include <linux/module.h>
+
+asmlinkage int printk(const char *fmt, ...)
+{
+	return 0;
+}
+
+EXPORT_SYMBOL_NOVERS(printk);
+
+#else
 asmlinkage int printk(const char *fmt, ...)
 {
 	va_list args;
@@ -311,6 +322,7 @@
 	wake_up_interruptible(&log_wait);
 	return i;
 }
+#endif
 
 void console_print(const char *s)
 {
diff -u --recursive --new-file linux/CREDITS linux.noprintk/CREDITS
--- linux/CREDITS	Sun Dec 31 18:27:57 2000
+++ linux.noprintk/CREDITS	Fri Jan 26 10:51:19 2001
@@ -2395,6 +2395,14 @@
 S: Oldenburg
 S: Germany
 
+N: Stefani Seibold
+E: Stefani@Seibold.net
+D: Possibility to disable all kernel messages by overload printk with a
+D: dummy macro (saves a lot of disk- and ramspace for embedded systems
+D: and rescue disks)
+S: Munich
+S: Germany
+
 N: Darren Senn
 E: sinster@darkwater.com
 D: Whatever I notice needs doing (so far: itimers, /proc)
diff -u --recursive --new-file linux/arch/alpha/config.in 
linux.noprintk/arch/alpha/config.in
--- linux/arch/alpha/config.in	Fri Dec 29 23:07:19 2000
+++ linux.noprintk/arch/alpha/config.in	Sat Jan 27 22:37:20 2001
@@ -359,6 +359,7 @@
 fi
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 
 bool 'Legacy kernel start address' CONFIG_ALPHA_LEGACY_START_ADDRESS
 
diff -u --recursive --new-file linux/arch/arm/config.in 
linux.noprintk/arch/arm/config.in
--- linux/arch/arm/config.in	Thu Nov 16 21:51:28 2000
+++ linux.noprintk/arch/arm/config.in	Sat Jan 27 22:34:57 2001
@@ -414,6 +414,7 @@
 bool 'Verbose user fault messages' CONFIG_DEBUG_USER
 bool 'Include debugging information in kernel binary' CONFIG_DEBUG_INFO
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 if [ "$CONFIG_CPU_26" = "y" ]; then
    bool 'Disable pgtable cache' CONFIG_NO_PGT_CACHE
 fi
diff -u --recursive --new-file linux/arch/i386/config.in 
linux.noprintk/arch/i386/config.in
--- linux/arch/i386/config.in	Fri Dec 29 23:35:47 2000
+++ linux.noprintk/arch/i386/config.in	Sat Jan 27 22:36:09 2001
@@ -374,4 +374,5 @@
 
 #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
diff -u --recursive --new-file linux/arch/ia64/config.in 
linux.noprintk/arch/ia64/config.in
--- linux/arch/ia64/config.in	Thu Jan  4 21:50:17 2001
+++ linux.noprintk/arch/ia64/config.in	Sat Jan 27 22:36:48 2001
@@ -249,6 +249,7 @@
 fi
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 bool 'Early printk support (requires VGA!)' CONFIG_IA64_EARLY_PRINTK
 bool 'Turn on compare-and-exchange bug checking (slow!)' 
CONFIG_IA64_DEBUG_CMPXCHG
 bool 'Turn on irq debug checks (slow!)' CONFIG_IA64_DEBUG_IRQ
diff -u --recursive --new-file linux/arch/m68k/config.in 
linux.noprintk/arch/m68k/config.in
--- linux/arch/m68k/config.in	Thu Jan  4 22:00:55 2001
+++ linux.noprintk/arch/m68k/config.in	Sat Jan 27 22:36:57 2001
@@ -538,4 +538,5 @@
 
 #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
diff -u --recursive --new-file linux/arch/mips/config.in 
linux.noprintk/arch/mips/config.in
--- linux/arch/mips/config.in	Thu Nov 16 21:51:28 2000
+++ linux.noprintk/arch/mips/config.in	Sat Jan 27 22:37:02 2001
@@ -397,4 +397,5 @@
   bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
 fi
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
diff -u --recursive --new-file linux/arch/mips64/config.in 
linux.noprintk/arch/mips64/config.in
--- linux/arch/mips64/config.in	Wed Nov 29 06:42:04 2000
+++ linux.noprintk/arch/mips64/config.in	Sat Jan 27 22:37:45 2001
@@ -266,4 +266,5 @@
 fi
 bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
diff -u --recursive --new-file linux/arch/parisc/config.in 
linux.noprintk/arch/parisc/config.in
--- linux/arch/parisc/config.in	Tue Dec  5 21:29:39 2000
+++ linux.noprintk/arch/parisc/config.in	Sat Jan 27 22:37:51 2001
@@ -204,5 +204,6 @@
 
 #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
 
diff -u --recursive --new-file linux/arch/ppc/config.in 
linux.noprintk/arch/ppc/config.in
--- linux/arch/ppc/config.in	Thu Nov 16 21:51:28 2000
+++ linux.noprintk/arch/ppc/config.in	Sat Jan 27 22:35:33 2001
@@ -324,6 +324,7 @@
 comment 'Kernel hacking'
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 bool 'Include kgdb kernel debugger' CONFIG_KGDB
 bool 'Include xmon kernel debugger' CONFIG_XMON
 endmenu
diff -u --recursive --new-file linux/arch/s390/config.in 
linux.noprintk/arch/s390/config.in
--- linux/arch/s390/config.in	Thu Nov 16 21:51:28 2000
+++ linux.noprintk/arch/s390/config.in	Sat Jan 27 22:37:14 2001
@@ -77,5 +77,6 @@
   bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
 fi
 # this does not work. bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
 
diff -u --recursive --new-file linux/arch/sh/config.in 
linux.noprintk/arch/sh/config.in
--- linux/arch/sh/config.in	Thu Jan  4 22:19:13 2001
+++ linux.noprintk/arch/sh/config.in	Sat Jan 27 22:35:09 2001
@@ -260,6 +260,7 @@
 comment 'Kernel hacking'
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 bool 'Use LinuxSH standard BIOS' CONFIG_SH_STANDARD_BIOS
 if [ "$CONFIG_SH_STANDARD_BIOS" = "y" ]; then
    bool 'GDB Stub kernel debug' CONFIG_DEBUG_KERNEL_WITH_GDB_STUB
diff -u --recursive --new-file linux/arch/sparc/config.in 
linux.noprintk/arch/sparc/config.in
--- linux/arch/sparc/config.in	Wed Nov 29 06:53:44 2000
+++ linux.noprintk/arch/sparc/config.in	Sat Jan 27 22:37:29 2001
@@ -258,4 +258,5 @@
 comment 'Kernel hacking'
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 endmenu
diff -u --recursive --new-file linux/arch/sparc64/config.in 
linux.noprintk/arch/sparc64/config.in
--- linux/arch/sparc64/config.in	Thu Nov 16 21:51:28 2000
+++ linux.noprintk/arch/sparc64/config.in	Sat Jan 27 22:37:38 2001
@@ -331,5 +331,6 @@
 comment 'Kernel hacking'
 
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Disable kernel messages' CONFIG_PRINTK
 #bool 'ECache flush trap support at ta 0x72' CONFIG_EC_FLUSH_TRAP
 endmenu
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-27 22:31 patch for 2.4.0 disable printk Stefani Seibold
@ 2001-01-28  0:44 ` Andrew Morton
  2001-01-28  9:27   ` Stefani Seibold
  2001-01-29  2:48   ` Paul Gortmaker
  0 siblings, 2 replies; 12+ messages in thread
From: Andrew Morton @ 2001-01-28  0:44 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: linux-kernel

Stefani Seibold wrote:
> 
> Second, i had change the macro so it calls now a inline funciton
> printk_inline which always return 0. So it should be now compatibel to the
> standard printk funciton.

A #define is better.

You see, even if printk is a null inline function,

	printk("foo");

will still cause "foo" to appear in your output. Apparently
very recent versions of gcc have fixed this.

BTW: Graham Stoney prepared a similar patch for 2.2 last year.
You may be able to borrow some ideas from that work, and the
followup discussion.

http://www.uwsg.iu.edu/hypermail/linux/kernel/0004.2/0709.html

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-28  0:44 ` Andrew Morton
@ 2001-01-28  9:27   ` Stefani Seibold
  2001-01-28 17:32     ` Jamie Lokier
  2001-01-29  2:48   ` Paul Gortmaker
  1 sibling, 1 reply; 12+ messages in thread
From: Stefani Seibold @ 2001-01-28  9:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Stefani

Hi Andrew,

thanks for your feddback, but... you are not right. Because i override the 
printk with a macro thats call a inline function printk_inline with no 
paramters and only return 0. So the compiler sill removes the paramters.
If you try this patch, you will see, that none of the parameters appear in 
the output.
The inline function is the best choice, because it it full compatible to old 
old printk. No side effects are expeted.
Thanks also for the link. I had a look on it and i think i will add a extrac 
option to disable also the panic messages.

Greetings,
Stefani

> Stefani Seibold wrote:
> > Second, i had change the macro so it calls now a inline funciton
> > printk_inline which always return 0. So it should be now compatibel to
> > the standard printk funciton.
>
> A #define is better.
>
> You see, even if printk is a null inline function,
>
> 	printk("foo");
>
> will still cause "foo" to appear in your output. Apparently
> very recent versions of gcc have fixed this.
>
> BTW: Graham Stoney prepared a similar patch for 2.2 last year.
> You may be able to borrow some ideas from that work, and the
> followup discussion.
>
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0004.2/0709.html
>
> -
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-28  9:27   ` Stefani Seibold
@ 2001-01-28 17:32     ` Jamie Lokier
  0 siblings, 0 replies; 12+ messages in thread
From: Jamie Lokier @ 2001-01-28 17:32 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: Andrew Morton, linux-kernel

Stefani Seibold wrote:
> The inline function is the best choice, because it it full compatible to old 
> old printk. No side effects are expeted.

What is the difference?
I can't think of any difference between:

  #define printk(format, args...) ((int) 0)

and:

  static inline int printk_inline (void) { return 0; }
  #define printk(format, args...) (printk_inline ())

If you wanted to be fully compatible in the sense of evaluating the
printk arguments, in case those have side effects, there would be:

  #define printk(format, args...) ((0 , ## args), (int) 0)

By the way, CONFIG_NO_PRINTK or CONFIG_DISABLE_PRINTK would be better
names.  CONFIG_PRINTK suggests that enabling that option enabled printk.

enjoy,
-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-28  0:44 ` Andrew Morton
  2001-01-28  9:27   ` Stefani Seibold
@ 2001-01-29  2:48   ` Paul Gortmaker
  1 sibling, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2001-01-29  2:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Stefani Seibold, linux-kernel

Andrew Morton wrote:
> 
> Stefani Seibold wrote:
> >
> > Second, i had change the macro so it calls now a inline funciton
> > printk_inline which always return 0. So it should be now compatibel to the
> > standard printk funciton.
> 
> A #define is better.
> 
> You see, even if printk is a null inline function,
> 
>         printk("foo");
> 
> will still cause "foo" to appear in your output. Apparently
> very recent versions of gcc have fixed this.

I missed earlier parts of this, so maybe I'm not even on the same page...

Here is part of an old patch I made to replace panic messages with
a simple EIP that you could still look up in System.map to cut down on 
the text in the image for small kernels.  One could use the same macro
trickery for printk() which is what I think Andrew is recommending.

Paul.

--- /mnt2/linux/include/linux/kernel.h	Wed Feb 12 14:17:00 1997
+++ linux/include/linux/kernel.h	Wed Feb 12 13:57:47 1997
@@ -34,8 +34,16 @@
 # define NORET_AND     noreturn,
 
 extern void math_error(void);
-NORET_TYPE void panic(const char * fmt, ...)
-	__attribute__ ((NORET_AND format (printf, 1, 2)));
+
+NORET_TYPE void panic_at(const void *location)
+	ATTRIB_NORET;
+
+#define panic(fmt,arg...)	\
+({ __label__ whoops;		\
+whoops:				\
+	panic_at(&&whoops);	\
+})
+ 
 NORET_TYPE void do_exit(long error_code)
 	ATTRIB_NORET;
 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
--- /mnt2/linux/kernel/panic.c	Wed Feb 12 14:17:00 1997
+++ linux/kernel/panic.c	Wed Feb 12 14:23:06 1997
@@ -19,50 +19,18 @@
 extern void do_unblank_screen(void);
 extern int C_A_D;
 
-NORET_TYPE void panic(const char * fmt, ...)
+NORET_TYPE void panic_at(const void *location)
 {
-	static char buf[1024];
-	va_list args;
-	int i;
-
-	va_start(args, fmt);
-	vsprintf(buf, fmt, args);
-	va_end(args);
-	printk(KERN_EMERG "Kernel panic: %s\n",buf);
+	printk(KERN_EMERG "Kernel panic at: %p\n",location);
 	if (current == task[0])
 		printk(KERN_EMERG "In swapper task - not syncing\n");
 	else



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-27 10:57   ` Stefani Seibold
@ 2001-01-29 17:40     ` James Simmons
  2001-01-29 20:17       ` Stefani Seibold
  0 siblings, 1 reply; 12+ messages in thread
From: James Simmons @ 2001-01-29 17:40 UTC (permalink / raw)
  To: Stefani Seibold; +Cc: Thunder from the hill, linux-kernel


> You are right... this patch make no sense on a computer system with human 
> interactions. But think on tiny hidden computers, like in a dishwasher or a 
> traffic light. This computer are standalone, if it crash, then it will be 
> rebooted.
> Nobody will attach a terminal to this kind of computer, nobody is interessted 
> on a logfile. Nobody will see a oops, because nobdy is there. 

What do you suggest we do with /dev/console and stdin, stdout, stderr?
The kernel needs a /dev/console to boot with.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: patch for 2.4.0 disable printk
  2001-01-29 17:40     ` James Simmons
@ 2001-01-29 20:17       ` Stefani Seibold
  0 siblings, 0 replies; 12+ messages in thread
From: Stefani Seibold @ 2001-01-29 20:17 UTC (permalink / raw)
  To: James Simmons; +Cc: Thunder from the hill, linux-kernel

Am Montag, 29. Januar 2001 18:40 schrieb James Simmons:
> > You are right... this patch make no sense on a computer system with human
> > interactions. But think on tiny hidden computers, like in a dishwasher or
> > a traffic light. This computer are standalone, if it crash, then it will
> > be rebooted.
> > Nobody will attach a terminal to this kind of computer, nobody is
> > interessted on a logfile. Nobody will see a oops, because nobdy is there.
>
> What do you suggest we do with /dev/console and stdin, stdout, stderr?
> The kernel needs a /dev/console to boot with.

This patch does not modify the /dev/console, nor stdin/stdout/stderr. I think 
you should try it, bevor you are posting...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2001-01-29 20:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-27 22:31 patch for 2.4.0 disable printk Stefani Seibold
2001-01-28  0:44 ` Andrew Morton
2001-01-28  9:27   ` Stefani Seibold
2001-01-28 17:32     ` Jamie Lokier
2001-01-29  2:48   ` Paul Gortmaker
  -- strict thread matches above, loose matches on Subject: below --
2001-01-26 20:46 Stefani Seibold
2001-01-26 21:13 ` David Weinehall
2001-01-26 11:05 Stefani Seibold
2001-01-27  0:09 ` Thunder from the hill
2001-01-27 10:57   ` Stefani Seibold
2001-01-29 17:40     ` James Simmons
2001-01-29 20:17       ` Stefani Seibold

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