Bug#565160: Linux console garbled after experimental grub-pc boot

Jonathan Nieder jrnieder at gmail.com
Wed Jan 20 11:09:13 UTC 2010


Yves-Alexis Perez wrote:

> [    0.000000] Console: colour dummy device 80x25

So the VGA console was not initialized.

I asked Linux why, and here is what I learned:

...
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:16
[    0.000000] CPU 0 irqstacks, hard=c03f2000 soft=c03f3000
[    0.000000] --- no vga ---
[    0.000000] screen_info.orig_video_isVGA: 23
[    0.000000] Console: colour dummy device 80x25
[    0.000000] console [tty0] enabled
...

0x23 is VIDEO_TYPE_VLFB.

This is odd, since the only places I can see that set
orig_video_isVGA are

 - vesa_store_mode_params_graphics() in arch/x86/boot/video-vesa.c
and
 - vga_probe() in arch/x86/boot/video-vga.c

The latter sets it to 1, not 0x23, so the former looks to be at
fault.  The former is only called by vesa_set_mode() in the
same file, and only if is_graphic is 1; and is_graphic only can
be 1 if CONFIG_FB_BOOT_VESA_SUPPORT; and adding a #error line
shows that for me, CONFIG_FB_BOOT_VESA_SUPPORT is not defined
('make arch/x86/boot/video-vesa.lst' confirms).

I’m not sure where to go from here.  printf()s so early do not
get logged, and the screen is not in text mode so I cannot see
messages on the console.  Maybe there are enough clues for a
GRUB hacker to approach it from their end.  I would be happy to
try patches to either GRUB or Linux to help figure this out.

Hope that helps,
Jonathan

The patch used to produce the above output is attached.
Unfortunately, I think the more useful information is what I
don't know how to tell it to print.
-------------- next part --------------
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index cc4bbbe..cb61ab1 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -378,6 +378,9 @@ static const char *vgacon_startup(void)
 
 	if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) {
 	      no_vga:
+		printk(KERN_WARNING "--- no vga ---\n");
+		printk(KERN_WARNING "screen_info.orig_video_isVGA: %x\n",
+			(int) screen_info.orig_video_isVGA);
 #ifdef CONFIG_DUMMY_CONSOLE
 		conswitchp = &dummy_con;
 		return conswitchp->con_startup();
@@ -389,16 +392,20 @@ static const char *vgacon_startup(void)
 	/* boot_params.screen_info initialized? */
 	if ((screen_info.orig_video_mode  == 0) &&
 	    (screen_info.orig_video_lines == 0) &&
-	    (screen_info.orig_video_cols  == 0))
+	    (screen_info.orig_video_cols  == 0)) {
+		printk(KERN_WARNING "screen_info not initialized\n");
 		goto no_vga;
+	}
 
 	/* VGA16 modes are not handled by VGACON */
 	if ((screen_info.orig_video_mode == 0x0D) ||	/* 320x200/4 */
 	    (screen_info.orig_video_mode == 0x0E) ||	/* 640x200/4 */
 	    (screen_info.orig_video_mode == 0x10) ||	/* 640x350/4 */
 	    (screen_info.orig_video_mode == 0x12) ||	/* 640x480/4 */
-	    (screen_info.orig_video_mode == 0x6A))	/* 800x600/4 (VESA) */
+	    (screen_info.orig_video_mode == 0x6A))	/* 800x600/4 (VESA) */ {
+		printk(KERN_WARNING "VGA16 mode %x\n", screen_info.orig_video_mode);
 		goto no_vga;
+	}
 
 	vga_video_num_lines = screen_info.orig_video_lines;
 	vga_video_num_columns = screen_info.orig_video_cols;
@@ -520,6 +527,7 @@ static const char *vgacon_startup(void)
 	if (scr_readw(p) != 0xAA55 || scr_readw(p + 1) != 0x55AA) {
 		scr_writew(saved1, p);
 		scr_writew(saved2, p + 1);
+		printk(KERN_WARNING "vga_vram_base not writable\n");
 		goto no_vga;
 	}
 	scr_writew(0x55AA, p);
@@ -527,6 +535,7 @@ static const char *vgacon_startup(void)
 	if (scr_readw(p) != 0x55AA || scr_readw(p + 1) != 0xAA55) {
 		scr_writew(saved1, p);
 		scr_writew(saved2, p + 1);
+		printk(KERN_WARNING "vga_vram_base not rewritable\n");
 		goto no_vga;
 	}
 	scr_writew(saved1, p);


More information about the Pkg-grub-devel mailing list