Early printk/console for 2.5.12
Subsystems (2)
PATCH 1/1 Early printk/console for 2.5.12
Hello Linus,
The following patch provides the ability to add early
consoles (to use with printk calls before console_init) and then have them automatically removed right before the real consoles are added. This is useful if a kernel doesn't boot past console init.
Included in the patch are 3 drivers for i386. Primarily
there is a VGA driver and a serial console driver that both work well with i386. This has been tested on a desktop PC, an SMP machine, and a 16 processor NUMA-Q.
An earlier variation was submitted by Bill Irwin in
November. This is a cleaned up version a few more features.
I would like this to be added to the kernel to make
early debugging (before console_init) easier and a provide a standard early console.
Thanks for your time,
Keith Mannthey
PS. The patch was generated against 2.5.11, but applies cleanly against 2.5.12
arch/i386/Config.help +20 -0
@@ -940,3 +940,23 @@ CONFIG_DEBUG_OBSOLETE Say Y here if you want to reduce the chances of the tree compiling, and are prepared to dig into driver internals to fix compile errors. + +Early printk support +NO_CONFIG_EARLY_CONSOLE + If you are not doing early kernel devolopment NONE is what you want. + The other will add a early console for you (in i386) + This will allow you see printk output before console_init is called. + This is handy if you need to debug the kernel before this point. + + VGA will give you a VGA console, your screen. + SERIAL will give you out put on your serial line. + +Location of serial port +CONFIG_EARLY_CONSOLE_SERIAL_PORT + 0x3F8 == COMM 1 + 0x3E8 == COMM 2 + +Baud rate +CONFIG_EARLY_CONSOLE_SERIAL_BAUD + Set the the Baud of your serial console. +
arch/i386/config.in +10 -0
@@ -408,6 +408,16 @@ if [ "$CONFIG_HIGHMEM" = "y" ]; then bool ' Highmem debugging' CONFIG_DEBUG_HIGHMEM fi + choice 'Early printk support' \ + "NONE NO_CONFIG_EARLY_CONSOLE \ + VGA CONFIG_EARLY_CONSOLE_VGA \ + Serial_PORT CONFIG_EARLY_CONSOLE_SERIAL\ + Bochs_0xE9_hack CONFIG_EARLY_CONSOLE_BOCHS_E9_HACK " NONE + if [ "$CONFIG_EARLY_CONSOLE_SERIAL" = "y" ]; then + hex "Location of serial port " CONFIG_EARLY_CONSOLE_SERIAL_PORT 0x3F8 + int "Baud rate " CONFIG_EARLY_CONSOLE_SERIAL_BAUD 38400 + fi + fi endmenu
arch/i386/kernel/Makefile +1 -1
@@ -19,7 +19,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \ pci-dma.o i386_ksyms.o i387.o bluesmoke.o dmi_scan.o \ - bootflag.o + bootflag.o early_consoles.o ifdef CONFIG_PCI
arch/i386/kernel/early_consoles.c +417 -0
417 lines not on this page · raw message
arch/i386/kernel/setup.c +3 -1
@@ -672,7 +672,9 @@unsigned long bootmap_size, low_mem_size;unsigned long start_pfn, max_low_pfn;int i; - + +add_early_consoles (); +#ifdef CONFIG_VISWS visws_get_board_type_and_rev ();#endif
drivers/char/console.c +7 -2
@@ -2437,7 +2437,8 @@ {const char *display_desc =NULL ;unsigned int currcons =0 ; - +int removed =0 ; +if (conswitchp) display_desc = conswitchp->con_startup ();if (!display_desc) {
@@ -2513,10 +2514,14 @@ display_desc, video_num_columns, video_num_lines); printable =1 ;printk ("\n" ); - + +/*clear any early consoles*/ + removed =clear_early_consoles (); +#ifdef CONFIG_VT_CONSOLE register_console (&vt_console_driver);#endif +printk ("removed %d early consoles \n" ,removed); }#ifndef VT_SINGLE_DRIVER
include/linux/console.h +5 -1
@@ -90,7 +90,7 @@#define CON_PRINTBUFFER (1)#define CON_CONSDEV (2)/* Last on the command line */ #define CON_ENABLED (4) - +#define EARLY_CONSOLE (8)/* Early flag. Remove in con_init */ struct console {char name[8 ];
@@ -105,6 +105,7 @@struct console *next; }; +extern void register_console (struct console *);extern int unregister_console (struct console *);extern struct console *console_drivers;
@@ -112,6 +113,9 @@extern void release_console_sem (void );extern void console_conditional_schedule (void );extern void console_unblank (void ); +extern int clear_early_consoles (void ); +extern void register_early_console (struct console *); +/* VESA Blanking Levels */ #define VESA_NO_BLANKING 0
kernel/printk.c +44 -0
50 lines not on this page · raw message