Skip to contentSkip to conversation

Linux instrumentation for new loader

PATCH Robert Millan 2 participants 5 messages Jun 30, 2009 – Jul 1, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

These patches might be helpful in case someone runs in trouble with the new loader. They instrument Linux to obtain a screen_info structure dump, which can be used to compare the output of "linux16" vs "linux".

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
arch/x86/boot/main.c +24 -0
index 140172b..8cb5195 100644
@@ -172,6 +172,30 @@ void main(void)
 	if (cmdline_find_option_bool("quiet"))
 		boot_params.hdr.loadflags |= QUIET_FLAG;
 
+	puts ("screen_info dump:\n");
+	printf ("orig_x = 0x%x, orig_y =  0x%x\n", boot_params.screen_info.orig_x, boot_params.screen_info.orig_y);
+	printf ("ext_mem_k = 0x%x\n", boot_params.screen_info.ext_mem_k);
+	printf ("orig_video_page = 0x%x\n", boot_params.screen_info.orig_video_page);
+	printf ("orig_video_mode = 0x%x\n", boot_params.screen_info.orig_video_mode);
+	printf ("orig_video_cols = 0x%x\n", boot_params.screen_info.orig_video_cols);
+	printf ("orig_video_ega_bx = 0x%x\n", boot_params.screen_info.orig_video_ega_bx);
+	printf ("orig_video_lines = 0x%x\n", boot_params.screen_info.orig_video_lines);
+	printf ("orig_video_isVGA = 0x%x\n", boot_params.screen_info.orig_video_isVGA);
+	printf ("orig_video_points = 0x%x\n", boot_params.screen_info.orig_video_points);
+	printf ("lfb_width / lfb_height / lfb_depth = %dx%dx%d\n", boot_params.screen_info.lfb_width, boot_params.screen_info.lfb_height, boot_params.screen_info.lfb_depth);
+	printf ("lfb_base = 0x%x, lfb_size = 0x%x\n", boot_params.screen_info.lfb_base, boot_params.screen_info.lfb_size);
+	printf ("cl_magic = 0x%x, cl_offset = 0x%x\n", boot_params.screen_info.cl_magic, boot_params.screen_info.cl_offset);
+	printf ("lfb_linelength = 0x%x\n", boot_params.screen_info.lfb_linelength);
+	printf ("red_size = 0x%x, red_pos = 0x%x\n", boot_params.screen_info.red_size, boot_params.screen_info.red_pos);
+	printf ("green_size = 0x%x, green_pos = 0x%x\n", boot_params.screen_info.green_size, boot_params.screen_info.green_pos);
+	printf ("blue_size = 0x%x, blue_pos = 0x%x\n", boot_params.screen_info.blue_size, boot_params.screen_info.blue_pos);
+	printf ("rsvd_size = 0x%x, rsvd_pos = 0x%x\n", boot_params.screen_info.rsvd_size, boot_params.screen_info.rsvd_pos);
+	printf ("vesapm = 0x%x:0x%x\n", boot_params.screen_info.vesapm_seg, boot_params.screen_info.vesapm_off);
+	printf ("pages = 0x%x\n", boot_params.screen_info.pages);
+	printf ("vesa_attributes = 0x%x\n", boot_params.screen_info.vesa_attributes);
+	printf ("capabilities = 0x%x\n", boot_params.screen_info.capabilities);
+	die ();
+
 	/* Do the last things and invoke protected mode */
 	go_to_protected_mode();
 }
drivers/video/vesafb.c +26 -0
index bd37ee1..52a27e7 100644
@@ -465,6 +465,32 @@ static int __init vesafb_probe(struct platform_device *dev)
 		fb_dealloc_cmap(&info->cmap);
 		goto err;
 	}
+
+	printk(KERN_INFO "screen_info dump:\n");
+	printk(KERN_INFO "orig_x = 0x%x, orig_y =  0x%x\n", screen_info.orig_x, screen_info.orig_y);
+	printk(KERN_INFO "ext_mem_k = 0x%x\n", screen_info.ext_mem_k);
+	printk(KERN_INFO "orig_video_page = 0x%x\n", screen_info.orig_video_page);
+	printk(KERN_INFO "orig_video_mode = 0x%x\n", screen_info.orig_video_mode);
+	printk(KERN_INFO "orig_video_cols = 0x%x\n", screen_info.orig_video_cols);
+	printk(KERN_INFO "orig_video_ega_bx = 0x%x\n", screen_info.orig_video_ega_bx);
+	printk(KERN_INFO "orig_video_lines = 0x%x\n", screen_info.orig_video_lines);
+	printk(KERN_INFO "orig_video_isVGA = 0x%x\n", screen_info.orig_video_isVGA);
+	printk(KERN_INFO "orig_video_points = 0x%x\n", screen_info.orig_video_points);
+	printk(KERN_INFO "lfb_width / lfb_height / lfb_depth = %dx%dx%d\n", screen_info.lfb_width, screen_info.lfb_height, screen_info.lfb_depth);
+	printk(KERN_INFO "lfb_base = 0x%x, lfb_size = 0x%x\n", screen_info.lfb_base, screen_info.lfb_size);
+	printk(KERN_INFO "cl_magic = 0x%x, cl_offset = 0x%x\n", screen_info.cl_magic, screen_info.cl_offset);
+	printk(KERN_INFO "lfb_linelength = 0x%x\n", screen_info.lfb_linelength);
+	printk(KERN_INFO "red_size = 0x%x, red_pos = 0x%x\n", screen_info.red_size, screen_info.red_pos);
+	printk(KERN_INFO "green_size = 0x%x, green_pos = 0x%x\n", screen_info.green_size, screen_info.green_pos);
+	printk(KERN_INFO "blue_size = 0x%x, blue_pos = 0x%x\n", screen_info.blue_size, screen_info.blue_pos);
+	printk(KERN_INFO "rsvd_size = 0x%x, rsvd_pos = 0x%x\n", screen_info.rsvd_size, screen_info.rsvd_pos);
+	printk(KERN_INFO "vesapm = 0x%x:0x%x\n", screen_info.vesapm_seg, screen_info.vesapm_off);
+	printk(KERN_INFO "pages = 0x%x\n", screen_info.pages);
+	printk(KERN_INFO "vesa_attributes = 0x%x\n", screen_info.vesa_attributes);
+	printk(KERN_INFO "capabilities = 0x%x\n", screen_info.capabilities);
+
+	while (1);
+
 	printk(KERN_INFO "fb%d: %s frame buffer device\n",
 	       info->node, info->fix.id);
 	return 0;
#1 lore raw

Robert Millan wrote, on 01/07/09 00:10:

Quoted 3 lines

These patches might be helpful in case someone runs in trouble with the new loader. They instrument Linux to obtain a screen_info structure dump, which can be used to compare the output of "linux16" vs "linux".

This is with a Radeon 9200SE [RV280], which I think has 128 MiB of RAM.

I applied these to a kernel 2.6.30 and built and installed the kernel.

I set vga=0x311 on the linux command line

linux16 gave me a dump in green text and went no further:

all typos and omissions (usually because values were 0x0) are mine:

orig_x = 0x0 orig_y = 0x4

ext_mem_k = 0xffc0
video_mode = 0x3
cols = 0x50
egabx = 0x3
wnes ? = 0x19
points = 0x10
640x480x16
fb_base = 0xd8000000
fbsize = 0x100
fb_line_length = 0x500
red size 0x5 red pos 0xb
green size 0x6 green pos 0x5
blue size 0x5 blue pos 0x0
reserved size 0x0 pos 0x0
vesapm 0xc000:0x57aa
pages 0x18
vesa attr 0xbb

linux told me to set vgamode=640x480x16;640x480 then that it was booting anyway, no dump of screen_info

when I tried booting with:

set vgamode=640x480x16;640x480

I received the error message about 640x480 not being a recognised command.

Regards,

Arthur.

#4 lore raw
In reply to Robert Millan

And this one should help in case Linux can't display anything after GRUB transfers control to it.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
i386/linux.c +25 -0
Index: loader/i386/linux.c
===================================================================
@@ -541,6 +540,31 @@
       params->video_cursor_y = grub_getxy () & 0xff;
     }
 
+  grub_printf ("screen_info dump:\n");
+  grub_printf ("orig_x = 0x%x, orig_y =  0x%x\n", params->video_cursor_x, params->video_cursor_y);
+  grub_printf ("ext_mem_k = 0x%x\n", params->ext_mem);
+  grub_printf ("orig_video_page = 0x%x\n", params->video_page);
+  grub_printf ("orig_video_mode = 0x%x\n", params->video_mode);
+  grub_printf ("orig_video_cols = 0x%x\n", params->video_width);
+  grub_printf ("orig_video_ega_bx = 0x%x\n", params->video_ega_bx);
+  grub_printf ("orig_video_lines = 0x%x\n", params->video_height);
+  grub_printf ("orig_video_isVGA = 0x%x\n", params->have_vga);
+  grub_printf ("orig_video_points = 0x%x\n", params->font_size);
+  grub_printf ("lfb_width / lfb_height / lfb_depth = %dx%dx%d\n", params->lfb_width, params->lfb_height, params->lfb_depth);
+  grub_printf ("lfb_base = 0x%x, lfb_size = 0x%x\n", params->lfb_base, params->lfb_size);
+  grub_printf ("cl_magic = 0x%x, cl_offset = 0x%x\n", params->cl_magic, params->cl_offset);
+  grub_printf ("lfb_linelength = 0x%x\n", params->lfb_line_len);
+  grub_printf ("red_size = 0x%x, red_pos = 0x%x\n", params->red_mask_size, params->red_field_pos);
+  grub_printf ("green_size = 0x%x, green_pos = 0x%x\n", params->green_mask_size, params->green_field_pos);
+  grub_printf ("blue_size = 0x%x, blue_pos = 0x%x\n", params->blue_mask_size, params->blue_field_pos);
+  grub_printf ("rsvd_size = 0x%x, rsvd_pos = 0x%x\n", params->reserved_mask_size, params->reserved_field_pos);
+  grub_printf ("vesapm = 0x%x:0x%x\n", params->vesapm_segment, params->vesapm_offset);
+  grub_printf ("pages = 0x%x\n", params->lfb_pages);
+  grub_printf ("vesa_attributes = 0x%x\n", params->vesa_attrib);
+  grub_printf ("capabilities = 0x%x\n", params->capabilities);
+  grub_printf ("press a key to continue");
+  grub_getkey ();
+
 #ifdef __x86_64__
 
   grub_memcpy ((char *) prot_mode_mem + (prot_mode_pages << 12),
#2 lore raw
In reply to Arthur Marsh

Arthur Marsh wrote, on 01/07/09 03:21:

Quoted 39 lines

Robert Millan wrote, on 01/07/09 00:10:

Quoted 3 lines

These patches might be helpful in case someone runs in trouble with the new loader. They instrument Linux to obtain a screen_info structure dump, which can be used to compare the output of "linux16" vs "linux".

This is with a Radeon 9200SE [RV280], which I think has 128 MiB of RAM.

I applied these to a kernel 2.6.30 and built and installed the kernel.

I set vga=0x311 on the linux command line

linux16 gave me a dump in green text and went no further:

all typos and omissions (usually because values were 0x0) are mine:

orig_x = 0x0 orig_y = 0x4

ext_mem_k = 0xffc0
video_mode = 0x3
cols = 0x50
egabx = 0x3
wnes ? = 0x19
points = 0x10
640x480x16
fb_base = 0xd8000000
fbsize = 0x100
fb_line_length = 0x500
red size 0x5 red pos 0xb
green size 0x6 green pos 0x5
blue size 0x5 blue pos 0x0
reserved size 0x0 pos 0x0
vesapm 0xc000:0x57aa
pages 0x18
vesa attr 0xbb

linux told me to set vgamode=640x480x16;640x480 then that it was booting anyway, no dump of screen_info

when I tried booting with:

Quoted 7 lines

set vgamode=640x480x16;640x480

I received the error message about 640x480 not being a recognised command.

Regards,

Arthur.

when using linux instead of linux16, the differences I noted were:

Firstly, linux shows the text white, with a press any key to continue message.

linux16 showed the text green, and locked up, when I pressed any keys.

On the linux boot:

org_y = 0x9
ext_mem_k = 0x8000
egabx = 0x0
width / height / depth 0x0x0
lfb_base 0x0
lfbsize = 0x100
cloffset = 0x1000
clfb line length = 0x0

then everything from red-size onwards being 0x0.

Arthur.

#3 lore raw

Arthur Marsh wrote, on 01/07/09 06:18:

Quoted 65 lines

Arthur Marsh wrote, on 01/07/09 03:21:

Quoted 39 lines

Robert Millan wrote, on 01/07/09 00:10:

Quoted 3 lines

These patches might be helpful in case someone runs in trouble with the new loader. They instrument Linux to obtain a screen_info structure dump, which can be used to compare the output of "linux16" vs "linux".

This is with a Radeon 9200SE [RV280], which I think has 128 MiB of RAM.

I applied these to a kernel 2.6.30 and built and installed the kernel.

I set vga=0x311 on the linux command line

linux16 gave me a dump in green text and went no further:

all typos and omissions (usually because values were 0x0) are mine:

orig_x = 0x0 orig_y = 0x4

ext_mem_k = 0xffc0
video_mode = 0x3
cols = 0x50
egabx = 0x3
wnes ? = 0x19
points = 0x10
640x480x16
fb_base = 0xd8000000
fbsize = 0x100
fb_line_length = 0x500
red size 0x5 red pos 0xb
green size 0x6 green pos 0x5
blue size 0x5 blue pos 0x0
reserved size 0x0 pos 0x0
vesapm 0xc000:0x57aa
pages 0x18
vesa attr 0xbb

linux told me to set vgamode=640x480x16;640x480 then that it was booting anyway, no dump of screen_info

when I tried booting with:

Quoted 7 lines

set vgamode=640x480x16;640x480

I received the error message about 640x480 not being a recognised command.

Regards,

Arthur.

when using linux instead of linux16, the differences I noted were:

Firstly, linux shows the text white, with a press any key to continue message.

linux16 showed the text green, and locked up, when I pressed any keys.

On the linux boot:

org_y = 0x9
ext_mem_k = 0x8000
egabx = 0x0
width / height / depth 0x0x0
lfb_base 0x0
lfbsize = 0x100
cloffset = 0x1000
clfb line length = 0x0

Quoted 3 lines

then everything from red-size onwards being 0x0.

Arthur.

After applying applying lfb_size.diff, building and installing with set gfxmode=640x480x16, output was:

origx = 0x0;
orig_y = 0x4;
ext_menu_k = 0x8000;
page = 0x0;
mod = 0x3;
cols = 0x50;
ega_bx = 0x0;
lines = 0x19;
isVGA = 0x1;
points = 0x10;
0x0x0 then
everything = 0 except:

clmagic = 0xa33f; cl_offset = 0x1000

Arthur.