patch for 2.4.0 disable printk
Subsystems (2)
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
Documentation/Configure.help Thu Jan 18 12:14:41 2001 renamed from Documentation/Configure.help Thu Jan 4 22:00:55 2001 +8 -0
@@ -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
drivers/char/Config.in Thu Jan 18 10:33:07 2001 renamed from drivers/char/Config.in Fri Dec 29 23:07:21 2000 +1 -0
@@ -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
include/asm-i386/spinlock.h Thu Jan 25 23:07:43 2001 renamed from include/asm-i386/spinlock.h Thu Jan 4 23:50:46 2001 +2 -0
@@ -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
include/linux/kernel.h Thu Jan 25 16:15:17 2001 renamed from include/linux/kernel.h Mon Dec 11 21:49:54 2000 +5 -0
@@ -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
kernel/ksyms.c Thu Jan 18 12:14:41 2001 renamed from kernel/ksyms.c Wed Jan 3 01:45:37 2001 +2 -0
@@ -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
kernel/printk.c Thu Jan 25 23:03:37 2001 renamed from kernel/printk.c Sun Dec 31 03:16:13 2000 +17 -0
@@ -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) {
CREDITS Fri Jan 26 10:51:19 2001 renamed from CREDITS Sun Dec 31 18:27:57 2000 +8 -0
@@ -2395,6 +2395,14 @@ S: Oldenburg S: Germany +N: Stefani Seibold +E: [email protected] +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: [email protected] 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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 18 lines · Stefani Seibold
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.
Quoted 4 lines
Greetings,
StefaniBTW: 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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
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
Quoted 5 lines
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.
Quoted 12 lines
Thunder
---
Woah... I did a "cat/boot/vmlinuz>>/dev/audio" - and I think I heard god...Quoted 7 lines · Stefani Seibold
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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 7 lines
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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Am Montag, 29. Januar 2001 18:40 schrieb James Simmons:
Quoted 9 lines
Quoted 6 lines
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/consoleand stdin, stdout, stderr? The kernel needs a/dev/consoleto 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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/