Page 1 of 1

Using VESA in the GRUB Multiboot header.

Posted: Sat Jan 26, 2008 10:02 pm
by Shalted
I recently started wanting to switch into a new video mode. Now, I thought I'd go about writing a VM86 Monitor, and call the interrupt through my kernel. Which, in the long run, is a better idea, and will be implemented, but due to certain circumstances, I want to switch into a video mode prior to booting my kernel. The multiboot header specification actually allows us to set a desired video mode within the header. Unfortunately, GRUB doesn't allow this. So I applied a patch and re-built and installed. The funny thing is, it still doesn't set the desired video mode.

The size of stage2 is much bigger than before (A few KB) so I assume that it IS made properly, and includes the newer code.

The patch is here:
http://www.smk.co.za/software/vbe-grub/

Actually, since Brynet is the author of the patch, maybe he'd like to shed some light on this subject?

Oh, yes, I almost forgot, I AM setting up the data within the header itself:

Code: Select all


MULTIBOOT_PAGE_ALIGN	equ 1<<0
MULTIBOOT_MEMORY_INFO	equ 1<<1
MULTIBOOT_AOUT_KLUDGE	equ 1<<16
MULTIBOOT_VESA			equ 1<<2

MULTIBOOT_HEADER_MAGIC	equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS	equ (MULTIBOOT_PAGE_ALIGN) | (MULTIBOOT_MEMORY_INFO) | (MULTIBOOT_VESA) | (MULTIBOOT_AOUT_KLUDGE) 
MULTIBOOT_CHECKSUM	equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
;;;;;;;;;
VESA_MODE	equ 0 ;;linear
VESA_WIDTH	800
VESA_HEIGHT	600
VESA_DEPTH	32 ;;;24
;;;;;;

_mboot:
	dd MULTIBOOT_HEADER_MAGIC
	dd MULTIBOOT_HEADER_FLAGS
	dd MULTIBOOT_CHECKSUM
; aout kludge. These must be PHYSICAL addresses
	dd _mboot
_k_start:	dd code
		dd bss
_k_end:	dd end
	dd kernel_entry
_VESA:
	dd	VESA_MODE
	dd	VESA_WIDTH
	dd	VESA_HEIGHT
	dd	VESA_DEPTH

Posted: Sun Jan 27, 2008 12:00 am
by Brynet-Inc
I just made the patches, I didn't write the code.. ask Durand.

Posted: Sun Jan 27, 2008 12:04 pm
by Shalted
Sorry, I made a blind assumption, thanks anyway Brynet, I got it working, but not with that patch.

The one here:
http://www.mail-archive.com/bug-grub@gn ... 09873.html
Seems to work nicely : )

Although if anyone's going to build it I suggest patching the grub-0.97 code to grub-0.97-1 first, or you may run into some odd drive reading problems.

Edit: Now I only have to remember where to draw...
Edit2: It's all working nicely now, except, how do I know when the VBLANK is? Does/can the video card send an interrupt?