[PATCH] Adding CONFIG_MESSAGES for deeply embedded systems

From: Graham Stoney (greyham@research.canon.com.au)
Date: Thu Apr 20 2000 - 02:10:27 EST


Hi gang,

As promised in my previous message, here's a patch which adds a CONFIG option
to silence the human-readable output from the kernel, for use in deeply
embedded systems. Or in boot floppies for the overly confident.

To get maximum benefit, you'll also need to apply the revised
-ffunction-sections patch I posted earlier today. This will allow the
compiler/linker to optimise away the unused code which remains, so I don't
have to spray #ifdef's _all_ over the place.

Once again, I'm very interested in any feedback. If anyone can suggest a
better way of handling the ext2 error/debug/warning stuff, I'm all ears.

I've only tested in on PowerPC, but I've patched config.in and defconfig for
all architectures. (It would be real nice to have the common stuff from
config.in unified, prod, prod...)

Be sure to run a 'make config' or 'make menuconfig' after applying, unless you
_want_ things to go awful quiet unexpectedly :-)

Index: Documentation/Configure.help
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Configure.help
--- Documentation/Configure.help 1999/12/30 05:55:23 1.1.1.1
+++ Documentation/Configure.help 2000/04/19 06:39:51
@@ -1518,6 +1518,21 @@
   building a kernel for install/rescue disks or your system is very
   limited in memory.
 
+Kernel messages
+CONFIG_MESSAGES
+ Kernel messages are invaluable for a wide range of system monitoring
+ and diagnostic uses. These include boot-time messages, messages sent
+ to the syslog daemon, debugging output and the strings printed during
+ kernel panics. However, they waste valuable runtime space in deeply
+ embedded systems which have no way to display them, so you can disable
+ them by saying N here. Beware that doing so will silence all human-
+ readable output from the kernel, making it virtually impossible to
+ diagnose boot and runtime problems.
+
+ You should almost certainly say Y, unless you are building for a
+ deeply embedded system which you are certain has no need for kernel
+ messages.
+
 Kernel support for ELF binaries
 CONFIG_BINFMT_ELF
   ELF (Executable and Linkable Format) is a format for libraries and
Index: arch/alpha/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/alpha/config.in 1999/12/30 05:55:38 1.1.1.1
+++ arch/alpha/config.in 2000/04/19 09:16:09
@@ -186,6 +186,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
Index: arch/alpha/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/alpha/defconfig 1999/12/30 05:55:38 1.1.1.1
+++ arch/alpha/defconfig 2000/04/19 09:15:09
@@ -50,6 +50,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
Index: arch/arm/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/arm/config.in 1999/12/30 05:55:43 1.1.1.1
+++ arch/arm/config.in 2000/04/19 09:16:11
@@ -113,6 +113,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
Index: arch/arm/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/arm/defconfig 1999/12/30 05:55:43 1.1.1.1
+++ arch/arm/defconfig 2000/04/19 09:15:18
@@ -35,6 +35,7 @@
 CONFIG_NET=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=m
 # CONFIG_BINFMT_JAVA is not set
Index: arch/i386/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/i386/config.in 1999/12/30 05:55:47 1.1.1.1
+++ arch/i386/config.in 2000/04/19 09:16:14
@@ -88,6 +88,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
Index: arch/i386/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/i386/defconfig 1999/12/30 05:55:47 1.1.1.1
+++ arch/i386/defconfig 2000/04/19 09:15:22
@@ -53,6 +53,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
Index: arch/m68k/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/m68k/config.in 1999/12/30 05:55:53 1.1.1.1
+++ arch/m68k/config.in 2000/04/19 09:16:17
@@ -75,6 +75,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
Index: arch/m68k/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/m68k/defconfig 1999/12/30 05:55:53 1.1.1.1
+++ arch/m68k/defconfig 2000/04/19 09:15:25
@@ -38,6 +38,7 @@
 CONFIG_NET=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_ZORRO=y
Index: arch/mips/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/mips/config.in 1999/12/30 05:56:04 1.1.1.1
+++ arch/mips/config.in 2000/04/19 09:16:20
@@ -94,6 +94,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 
 if [ "$CONFIG_SGI" != "y" -a "$CONFIG_DECSTATION" != "y" -a "$CONFIG_BAGET_MIPS" != "y" ]; then
   tristate 'Parallel port support' CONFIG_PARPORT
Index: arch/mips/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/mips/defconfig 1999/12/30 05:56:04 1.1.1.1
+++ arch/mips/defconfig 2000/04/19 09:15:29
@@ -43,6 +43,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 # CONFIG_PARPORT is not set
 
 #
Index: arch/ppc/config.in
===================================================================
retrieving revision 1.3
diff -u -r1.3 config.in
--- arch/ppc/config.in 2000/04/19 02:39:23 1.3
+++ arch/ppc/config.in 2000/04/19 06:45:51
@@ -80,6 +80,7 @@
 fi
 bool 'Networking support' CONFIG_NET
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 
Index: arch/ppc/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/ppc/defconfig 1999/12/30 05:56:14 1.1.1.1
+++ arch/ppc/defconfig 2000/04/19 09:15:34
@@ -31,6 +31,7 @@
 CONFIG_PCI_OLD_PROC=y
 CONFIG_NET=y
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_BINFMT_ELF=y
Index: arch/ppc/8xx_io/uart.c
===================================================================
retrieving revision 1.4
diff -u -r1.4 uart.c
--- arch/ppc/8xx_io/uart.c 2000/04/10 09:52:13 1.4
+++ arch/ppc/8xx_io/uart.c 2000/04/20 03:17:08
@@ -78,7 +78,10 @@
 /*
  * Serial driver configuration section. Here are the various options:
  */
+#ifdef CONFIG_MESSAGES
 #define SERIAL_PARANOIA_CHECK
+#endif
+
 #define CONFIG_SERIAL_NOPAUSE_IO
 #define SERIAL_DO_RESTART
 
Index: arch/ppc/kernel/m8xx_setup.c
===================================================================
retrieving revision 1.2
diff -u -r1.2 m8xx_setup.c
--- arch/ppc/kernel/m8xx_setup.c 2000/04/04 08:43:46 1.2
+++ arch/ppc/kernel/m8xx_setup.c 2000/04/20 03:17:08
@@ -124,15 +124,6 @@
 #endif
 }
 
-void
-abort(void)
-{
-#ifdef CONFIG_XMON
- extern void xmon(void *);
- xmon(0);
-#endif
- machine_restart(NULL);
-}
 
 /* The decrementer counts at the system (internal) clock frequency divided by
  * sixteen, or external oscillator divided by four. We force the processor
Index: arch/ppc/mbxboot/misc.c
===================================================================
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 misc.c
--- arch/ppc/mbxboot/misc.c 2000/03/10 01:11:20 1.1.1.2
+++ arch/ppc/mbxboot/misc.c 2000/04/19 08:26:38
@@ -67,9 +67,16 @@
 char *zimage_start;
 int zimage_size;
 
+#ifdef CONFIG_MESSAGES
 void puts(const char *);
 void putc(const char c);
 void puthex(unsigned long val);
+#else
+#define puts(s)
+#define putc(c)
+#define puthex(v)
+#endif
+
 void _bcopy(char *src, char *dst, int len);
 void * memcpy(void * __dest, __const void * __src,
                             int __n);
@@ -86,6 +93,8 @@
         while(1);
 }
 
+#ifdef CONFIG_MESSAGES
+
 /* The MPC8xx is just the serial port.
 */
 tstc(void)
@@ -117,6 +126,8 @@
         }
 }
 
+#endif
+
 void * memcpy(void * __dest, __const void * __src,
                             int __n)
 {
@@ -365,6 +376,7 @@
         timer = 0;
         cp = cmd_line;
 
+#ifdef CONFIG_MESSAGES
         while (timer++ < 5*1000) {
                 if (tstc()) {
                         while ((ch = getc()) != '\n' && ch != '\r') {
@@ -382,6 +394,7 @@
                 }
                 udelay(1000); /* 1 msec */
         }
+#endif
         *cp = 0;
 
         /* If the command line is not filled in, we will automatically
@@ -412,6 +425,8 @@
         return (unsigned long)hold_residual;
 }
 
+#ifdef CONFIG_MESSAGES
+
 void puthex(unsigned long val)
 {
         unsigned char buf[10];
@@ -424,6 +439,8 @@
         buf[8] = '\0';
         puts(buf);
 }
+
+#endif
 
 /*
  * PCI/ISA I/O support
Index: arch/ppc/mbxboot/pci.c
===================================================================
retrieving revision 1.2
diff -u -r1.2 pci.c
--- arch/ppc/mbxboot/pci.c 2000/04/06 05:47:19 1.2
+++ arch/ppc/mbxboot/pci.c 2000/04/19 08:50:49
@@ -30,6 +30,11 @@
 void probe_addresses(int bus, int devfn);
 void map_pci_addrs(void);
 
+#ifndef CONFIG_MESSAGES
+#define puts(s)
+#define puthex(v)
+#endif
+
 /* This is a really stripped version of PCI bus scan. All we are
  * looking for are devices that exist.
  */
Index: arch/ppc/mm/init.c
===================================================================
retrieving revision 1.2
diff -u -r1.2 init.c
--- arch/ppc/mm/init.c 2000/04/04 08:43:50 1.2
+++ arch/ppc/mm/init.c 2000/04/19 08:49:45
@@ -614,8 +614,7 @@
                         return __va(a);
                 }
         }
- printk("Couldn't find %u bytes at %u alignment\n", size, align);
- abort();
+ panic("Couldn't find %u bytes at %u alignment", size, align);
         return NULL;
 }
 
@@ -787,9 +786,7 @@
 
         rp = (struct reg_property *) get_property(memory_node, name, &s);
         if (rp == NULL) {
- printk(KERN_ERR "error: couldn't get %s property on /memory\n",
- name);
- abort();
+ panic("couldn't get %s property on /memory", name);
         }
         mp->n_regions = s / sizeof(mp->regions[0]);
         memcpy(mp->regions, rp, s);
@@ -1275,8 +1272,7 @@
 
         memory_node = find_devices("memory");
         if (memory_node == NULL) {
- printk(KERN_ERR "can't find memory node\n");
- abort();
+ panic("can't find memory node");
         }
 
         /*
Index: arch/sparc/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/sparc/config.in 1999/12/30 05:56:31 1.1.1.1
+++ arch/sparc/config.in 2000/04/19 09:16:32
@@ -69,6 +69,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
Index: arch/sparc/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/sparc/defconfig 1999/12/30 05:56:31 1.1.1.1
+++ arch/sparc/defconfig 2000/04/19 09:15:42
@@ -77,6 +77,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
Index: arch/sparc64/config.in
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 config.in
--- arch/sparc64/config.in 1999/12/30 05:56:40 1.1.1.1
+++ arch/sparc64/config.in 2000/04/19 09:16:27
@@ -56,6 +56,7 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+bool 'Generate kernel messages' CONFIG_MESSAGES
 bool 'Kernel support for Linux/Sparc 32bit binary compatibility' CONFIG_SPARC32_COMPAT
 tristate 'Kernel support for 64-bit ELF binaries' CONFIG_BINFMT_ELF
 if [ "$CONFIG_SPARC32_COMPAT" != "n" ]; then
Index: arch/sparc64/defconfig
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 defconfig
--- arch/sparc64/defconfig 1999/12/30 05:56:40 1.1.1.1
+++ arch/sparc64/defconfig 2000/04/19 09:15:40
@@ -84,6 +84,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_MESSAGES=y
 CONFIG_SPARC32_COMPAT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_ELF32=y
Index: drivers/char/tty_io.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 tty_io.c
--- drivers/char/tty_io.c 1999/12/30 05:57:18 1.1.1.1
+++ drivers/char/tty_io.c 2000/03/30 05:35:10
@@ -98,8 +98,10 @@
 
 #undef TTY_DEBUG_HANGUP
 
+#ifdef CONFIG_MESSAGES
 #define TTY_PARANOIA_CHECK 1
 #define CHECK_TTY_COUNT 1
+#endif
 
 struct termios tty_std_termios; /* for the benefit of tty drivers */
 struct tty_driver *tty_drivers = NULL; /* linked list of tty drivers */
Index: fs/ext2/super.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 super.c
--- fs/ext2/super.c 1999/12/30 05:59:35 1.1.1.1
+++ fs/ext2/super.c 2000/04/19 09:52:24
@@ -35,12 +35,20 @@
 #include <linux/blkdev.h>
 #include <linux/init.h>
 
+#ifdef CONFIG_MESSAGES
 static char error_buf[1024];
+#endif
 
+#ifdef CONFIG_MESSAGES
 void ext2_error (struct super_block * sb, const char * function,
                  const char * fmt, ...)
+#else
+void (ext2_error) (struct super_block * sb)
+#endif
 {
+#ifdef CONFIG_MESSAGES
         va_list args;
+#endif
 
         if (!(sb->s_flags & MS_RDONLY)) {
                 sb->u.ext2_sb.s_mount_state |= EXT2_ERROR_FS;
@@ -49,9 +57,11 @@
                 mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
                 sb->s_dirt = 1;
         }
+#ifdef CONFIG_MESSAGES
         va_start (args, fmt);
         vsprintf (error_buf, fmt, args);
         va_end (args);
+#endif
         if (test_opt (sb, ERRORS_PANIC) ||
             (le16_to_cpu(sb->u.ext2_sb.s_es->s_errors) == EXT2_ERRORS_PANIC &&
              !test_opt (sb, ERRORS_CONT) && !test_opt (sb, ERRORS_RO)))
@@ -67,10 +77,16 @@
         }
 }
 
+#ifdef CONFIG_MESSAGES
 NORET_TYPE void ext2_panic (struct super_block * sb, const char * function,
                             const char * fmt, ...)
+#else
+NORET_TYPE void (ext2_panic) (struct super_block * sb)
+#endif
 {
+#ifdef CONFIG_MESSAGES
         va_list args;
+#endif
 
         if (!(sb->s_flags & MS_RDONLY)) {
                 sb->u.ext2_sb.s_mount_state |= EXT2_ERROR_FS;
@@ -79,9 +95,11 @@
                 mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
                 sb->s_dirt = 1;
         }
+#ifdef CONFIG_MESSAGES
         va_start (args, fmt);
         vsprintf (error_buf, fmt, args);
         va_end (args);
+#endif
         /* this is to prevent panic from syncing this filesystem */
         if (sb->s_lock)
                 sb->s_lock=0;
@@ -90,9 +108,14 @@
                bdevname(sb->s_dev), function, error_buf);
 }
 
+#ifdef CONFIG_MESSAGES
 void ext2_warning (struct super_block * sb, const char * function,
                    const char * fmt, ...)
+#else
+void (ext2_warning) (struct super_block * sb)
+#endif
 {
+#ifdef CONFIG_MESSAGES
         va_list args;
 
         va_start (args, fmt);
@@ -100,6 +123,7 @@
         va_end (args);
         printk (KERN_WARNING "EXT2-fs warning (device %s): %s: %s\n",
                 bdevname(sb->s_dev), function, error_buf);
+#endif
 }
 
 void ext2_put_super (struct super_block * sb)
Index: fs/proc/Makefile
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- fs/proc/Makefile 1999/12/30 05:59:56 1.1.1.1
+++ fs/proc/Makefile 2000/03/30 06:48:41
@@ -9,7 +9,7 @@
 
 O_TARGET := proc.o
 O_OBJS := inode.o root.o base.o generic.o mem.o link.o fd.o array.o \
- kmsg.o scsi.o proc_tty.o
+ scsi.o proc_tty.o
 ifdef CONFIG_OMIRR
 O_OBJS := $(O_OBJS) omirr.o
 endif
@@ -26,6 +26,10 @@
 
 ifeq ($(CONFIG_PROC_DEVICETREE),y)
 O_OBJS += proc_devtree.o
+endif
+
+ifeq ($(CONFIG_MESSAGES),y)
+O_OBJS += kmsg.o
 endif
 
 include $(TOPDIR)/Rules.make
Index: fs/proc/root.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 root.c
--- fs/proc/root.c 1999/12/30 05:59:57 1.1.1.1
+++ fs/proc/root.c 2000/03/30 06:50:46
@@ -520,11 +520,13 @@
         S_IFREG | S_IRUGO, 1, 0, 0,
         0, &proc_array_inode_operations
 };
+#ifdef CONFIG_MESSAGES
 static struct proc_dir_entry proc_root_kmsg = {
         PROC_KMSG, 4, "kmsg",
         S_IFREG | S_IRUSR, 1, 0, 0,
         0, &proc_kmsg_inode_operations
 };
+#endif
 static struct proc_dir_entry proc_root_version = {
         PROC_VERSION, 7, "version",
         S_IFREG | S_IRUGO, 1, 0, 0,
@@ -682,7 +684,9 @@
         proc_register(&proc_root, &proc_root_loadavg);
         proc_register(&proc_root, &proc_root_uptime);
         proc_register(&proc_root, &proc_root_meminfo);
+#ifdef CONFIG_MESSAGES
         proc_register(&proc_root, &proc_root_kmsg);
+#endif
         proc_register(&proc_root, &proc_root_version);
         proc_register(&proc_root, &proc_root_cpuinfo);
         proc_register(&proc_root, &proc_root_self);
Index: include/linux/ext2_fs.h
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ext2_fs.h
--- include/linux/ext2_fs.h 1999/12/30 06:00:49 1.1.1.1
+++ include/linux/ext2_fs.h 2000/04/19 06:40:23
@@ -589,6 +589,7 @@
                         struct inode *, struct dentry *);
 
 /* super.c */
+#ifdef CONFIG_MESSAGES
 extern void ext2_error (struct super_block *, const char *, const char *, ...)
         __attribute__ ((format (printf, 3, 4)));
 extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
@@ -596,6 +597,17 @@
         __attribute__ ((NORET_AND format (printf, 3, 4)));
 extern void ext2_warning (struct super_block *, const char *, const char *, ...)
         __attribute__ ((format (printf, 3, 4)));
+#else
+/* Rewrite calls to drop the message strings */
+#define ext2_error(sb, func, fmt, ...) ext2_error(sb)
+#define ext2_panic(sb, func, fmt, ...) ext2_panic(sb)
+#define ext2_warning(sb, func, fmt, ...) ext2_warning(sb)
+
+extern void (ext2_error) (struct super_block *);
+extern NORET_TYPE void (ext2_panic) (struct super_block *);
+extern void (ext2_warning) (struct super_block *);
+#endif
+
 extern void ext2_put_super (struct super_block *);
 extern void ext2_write_super (struct super_block *);
 extern int ext2_remount (struct super_block *, int *, char *);
Index: include/linux/kernel.h
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 kernel.h
--- include/linux/kernel.h 1999/12/30 06:00:53 1.1.1.1
+++ include/linux/kernel.h 2000/04/19 09:26:24
@@ -42,8 +42,6 @@
 
 extern void math_error(void);
 extern struct notifier_block *panic_notifier_list;
-NORET_TYPE void panic(const char * fmt, ...)
- __attribute__ ((NORET_AND format (printf, 1, 2)));
 NORET_TYPE void do_exit(long error_code)
         ATTRIB_NORET;
 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
@@ -53,8 +51,17 @@
 
 extern int session_of_pgrp(int pgrp);
 
+#ifdef CONFIG_MESSAGES
+NORET_TYPE void panic(const char * fmt, ...)
+ __attribute__ ((NORET_AND format (printf, 1, 2)));
 asmlinkage int printk(const char * fmt, ...)
         __attribute__ ((format (printf, 1, 2)));
+#else
+#define panic(fmt, args...) abort()
+#define printk(fmt, args...)
+#endif
+
+NORET_TYPE void abort(void) ATTRIB_NORET; /* use panic instead */
 
 #if DEBUG
 #define pr_debug(fmt,arg...) \
Index: init/main.c
===================================================================
retrieving revision 1.3
diff -u -r1.3 main.c
--- init/main.c 2000/03/10 02:01:28 1.3
+++ init/main.c 2000/03/30 00:19:44
@@ -598,8 +598,10 @@
 #ifdef CONFIG_FB
         { "video=", video_setup },
 #endif
+#ifdef CONFIG_MESSAGES
         { "panic=", panic_setup },
         { "console=", console_setup },
+#endif
 #ifdef CONFIG_VGA_CONSOLE
         { "no-scroll", no_scroll },
 #endif
@@ -1075,10 +1077,12 @@
                         root_mountflags &= ~MS_RDONLY;
                         continue;
                 }
+#ifdef CONFIG_MESSAGES
                 if (!strcmp(line,"debug")) {
                         console_loglevel = 10;
                         continue;
                 }
+#endif
                 if (!strncmp(line,"init=",5)) {
                         line += 5;
                         execute_command = line;
Index: kernel/ksyms.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ksyms.c
--- kernel/ksyms.c 1999/12/30 06:01:14 1.1.1.1
+++ kernel/ksyms.c 2000/04/20 06:48:23
@@ -331,10 +341,14 @@
 EXPORT_SYMBOL(kstat);
 
 /* misc */
+#if CONFIG_MESSAGES
 EXPORT_SYMBOL(panic);
 EXPORT_SYMBOL(printk);
 EXPORT_SYMBOL(sprintf);
 EXPORT_SYMBOL(vsprintf);
+#else
+EXPORT_SYMBOL(abort);
+#endif
 EXPORT_SYMBOL(kdevname);
 EXPORT_SYMBOL(bdevname);
 EXPORT_SYMBOL(cdevname);
Index: kernel/panic.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 panic.c
--- kernel/panic.c 1999/12/30 06:01:14 1.1.1.1
+++ kernel/panic.c 2000/04/19 08:46:51
@@ -34,6 +34,7 @@
                 panic_timeout = ints[1];
 }
 
+#ifdef CONFIG_MESSAGES
 NORET_TYPE void panic(const char * fmt, ...)
 {
         static char buf[1024];
@@ -43,14 +44,26 @@
         vsprintf(buf, fmt, args);
         va_end(args);
         printk(KERN_EMERG "Kernel panic: %s\n",buf);
+
+ unblank_console();
+
+ abort();
+}
+#endif
+
+NORET_TYPE void abort()
+{
+#ifdef CONFIG_XMON
+ extern void xmon(void *);
+ xmon(0);
+#endif
+
         if (current == task[0])
                 printk(KERN_EMERG "In swapper task - not syncing\n");
         else if (in_interrupt())
                 printk(KERN_EMERG "In interrupt handler - not syncing\n");
         else
                 sys_sync();
-
- unblank_console();
 
 #ifdef __SMP__
         smp_send_stop();
Index: kernel/printk.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 printk.c
--- kernel/printk.c 1999/12/30 06:01:14 1.1.1.1
+++ kernel/printk.c 2000/04/19 09:49:25
@@ -25,7 +25,6 @@
 #define LOG_BUF_LEN (16384)
 #define LOG_BUF_MASK (LOG_BUF_LEN-1)
 
-static char buf[1024];
 
 /* printk's without a loglevel use this.. */
 #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -46,9 +45,12 @@
 spinlock_t console_lock = SPIN_LOCK_UNLOCKED;
 
 struct console *console_drivers = NULL;
+
+#ifdef CONFIG_MESSAGES
 static char log_buf[LOG_BUF_LEN];
 static unsigned long log_start = 0;
 static unsigned long logged_chars = 0;
+#endif
 struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
 static int preferred_console = -1;
 
@@ -104,6 +106,7 @@
         c->index = idx;
 }
 
+#ifdef CONFIG_MESSAGES
 
 /*
  * Commands to do_syslog:
@@ -257,6 +260,7 @@
         int line_feed;
         static signed char msg_level = -1;
         long flags;
+ static char buf[1024];
 
         spin_lock_irqsave(&console_lock, flags);
         va_start(args, fmt);
@@ -341,6 +345,15 @@
         spin_unlock_irqrestore(&console_lock,flags);
 }
 
+#else /* CONFIG_MESSAGES */
+
+asmlinkage int sys_syslog(int type, char * buf, int len)
+{
+ return -EINVAL;
+}
+
+#endif /* CONFIG_MESSAGES */
+
 /*
  * The console driver calls this routine during kernel initialization
  * to register the console printing procedure with printk() and to
@@ -349,11 +362,14 @@
  */
 void register_console(struct console * console)
 {
- int i, j,len;
+ int i;
+#ifdef CONFIG_MESSAGES
+ int j,len;
         int p;
         char buf[16];
         signed char msg_level = -1;
         char *q;
+#endif
         unsigned long flags;
 
         /*
@@ -410,6 +426,8 @@
         }
         if ((console->flags & CON_PRINTBUFFER) == 0)
                 goto done;
+
+#ifdef CONFIG_MESSAGES
         /*
          * Print out buffered log messages.
          */
@@ -442,6 +460,7 @@
                         msg_level = -1;
                 j = 0;
         }
+#endif
 done:
         spin_unlock_irqrestore(&console_lock,flags);
 }
@@ -473,6 +492,8 @@
         return res;
 }
         
+#ifdef CONFIG_MESSAGES
+
 /*
  * Write a message to a certain tty, not just the console. This is used for
  * messages that need to be redirected to a specific tty.
@@ -485,3 +506,5 @@
                 tty->driver.write(tty, 0, msg, strlen(msg));
         return;
 }
+
+#endif
Index: kernel/sysctl.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sysctl.c
--- kernel/sysctl.c 1999/12/30 06:01:14 1.1.1.1
+++ kernel/sysctl.c 2000/04/20 04:54:21
@@ -200,8 +202,10 @@
 #endif
         {KERN_CTLALTDEL, "ctrl-alt-del", &C_A_D, sizeof(int),
          0644, NULL, &proc_dointvec},
+#ifdef CONFIG_MESSAGES
         {KERN_PRINTK, "printk", &console_loglevel, 4*sizeof(int),
          0644, NULL, &proc_dointvec},
+#endif
 #ifdef CONFIG_KMOD
         {KERN_MODPROBE, "modprobe", &modprobe_path, 256,
          0644, NULL, &proc_dostring, &sysctl_string },
Index: mm/slab.c
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 slab.c
--- mm/slab.c 1999/12/30 06:01:16 1.1.1.1
+++ mm/slab.c 2000/03/30 05:26:47
@@ -1255,6 +1255,8 @@
         return 0;
 }
 
+#ifdef CONFIG_MESSAGES
+
 static void
 kmem_report_alloc_err(const char *str, kmem_cache_t * cachep)
 {
@@ -1272,6 +1274,11 @@
         printk(KERN_ERR "kmem_free: %s (objp=%p, name=%s)\n",
                str, objp, cachep ? cachep->c_name : "unknown");
 }
+
+#else
+#define kmem_report_alloc_err(str, cachep)
+#define kmem_report_free_err(str, objp, cachep)
+#endif
 
 /* Search for a slab whose objs are suitable for DMA.
  * Note: since testing the first free slab (in __kmem_cache_alloc()),

Regards,
Graham

-- 
Graham Stoney
Principal Hardware/Software Engineer
Canon Information Systems Research Australia
Ph: +61 2 9805 2909  Fax: +61 2 9805 2929

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



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:16 EST