Thanks to a suggestion by William Kucharski (like all good ideas, this
one is obviously correct), the kdb serial console sequence is now
tweakable.  The patch below is incremental on kdb-v1.8-2.4.5-pre1 and
will be included in the next kdb patch set.

Index: 5-pre1.2/drivers/char/serial.c
--- 5-pre1.2/drivers/char/serial.c Thu, 26 Apr 2001 16:48:50 +1000 kaos 
(linux-2.4/b/c/22_serial.c 1.4.1.2 644)
+++ 5-pre1.2(w)/drivers/char/serial.c Tue, 15 May 2001 16:17:03 +1000 kaos 
+(linux-2.4/b/c/22_serial.c 1.4.1.2 644)
@@ -212,16 +212,25 @@ static char *serial_revdate = "2001-03-2
 #if defined(CONFIG_KDB)
 #include <linux/kdb.h>
 /*
- * kdb_serial_line records the serial line number of the
- * first serial console.  kdb_info will be set upon receipt
- * of the first ^A (which cannot happen until the port is
- * opened and the interrupt handler attached).  To enter
- * kdb before this on a serial console-only system, you must
- * use the 'kdb=early' flag to lilo and set the appropriate
- * breakpoints.
+ * kdb_serial_line records the serial line number of the first serial console.
+ * NOTE: The kernel ignores characters on the serial line unless a user space
+ * program has opened the line first.  To enter kdb before user space has opened
+ * the serial line, you can use the 'kdb=early' flag to lilo and set the
+ * appropriate breakpoints.
+ *
+ * kdb_serial_str[] is the sequence that the user must enter on the serial
+ * console to invoke kdb.  It can be a single character such as "\001"
+ * (control-A) or multiple characters such as "\eKdB".  NOTE: All except the
+ * last character are passed through to the application reading from the serial
+ * console.
+ *
+ * I tried to make the sequence a CONFIG_ option but most of CML1 cannot cope
+ * with '\' in strings, CML2 should be able to do it.  KAO.
  */
 
 static int  kdb_serial_line = -1;
+static char kdb_serial_str[] = "\001";
+static char *kdb_serial_ptr = kdb_serial_str;
 #endif /* CONFIG_KDB */
 /*
  * All of the compatibilty code so we can compile serial.c against
@@ -581,11 +590,15 @@ static _INLINE_ void receive_chars(struc
        do {
                ch = serial_inp(info, UART_RX);
 #if defined(CONFIG_KDB)
-               if ((info->line == kdb_serial_line)
-                && (ch == 1)   /* CNTRL-A */
-                && kdb_on) {
-                       kdb(KDB_REASON_KEYBOARD, 0, (kdb_eframe_t)regs);
-                       break;
+               if ((info->line == kdb_serial_line) && kdb_on) {
+                   if (ch == *kdb_serial_ptr) {
+                       if (!(*++kdb_serial_ptr)) {
+                           kdb(KDB_REASON_KEYBOARD, 0, (kdb_eframe_t)regs);
+                           kdb_serial_ptr = kdb_serial_str;
+                           break;
+                       }
+                   } else
+                       kdb_serial_ptr = kdb_serial_str;
                }
 #endif /* CONFIG_KDB */
                if (tty->flip.count >= TTY_FLIPBUF_SIZE)

Reply via email to