Page 1 of 1

GRUB won't set video mode above 640x480x32 [Solved]

Posted: Wed Jan 18, 2017 11:45 am
by codyd51
Hello,

I'm trying to use GRUB to set a video mode instead of querying available modes myself. This is my multiboot header:

Code: Select all

mboot:
	dd MBOOT_HEADER_MAGIC	; header value for GRUB
	dd MBOOT_HEADER_FLAGS	; grub settings
	dd MBOOT_CHECKSUM	; ensure above values are correct

	dd 0 ; these flags are unused
	dd 0
	dd 0
	dd 0
	dd 0 

	dd 0 ; set video mode
	;1024 x 768 x 24
	dw 1024
	dw 768
	dw 24
No matter what resolution/bpp I set there, GRUB always sets 640x480x32. I'm running my OS in QEMU.

Has anyone encountered a similar issue?

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 12:18 pm
by glauxosdever
Hi,


If GRUB can't find a video mode of the specified properties, it will set whatever best it can find.

It would be useful to also provide the qemu command.

Hope this helps. :-)


Regards,
glauxosdever

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 12:19 pm
by matt11235
What do you have for MBOOT_HEADER_FLAGS? I think that you need to set the second bit to 1.

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 12:33 pm
by hannah
Try putting -vga std on your QEMU command line.

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 1:01 pm
by codyd51
These are my multiboot flags:

Code: Select all

MBOOT_PAGE_ALIGN	equ 1<<0	; load kernel and modules on page boundary
MBOOT_MEM_INFO		equ 1<<1	; provide kernel. with memory info
MBOOT_VBE_MODE		equ 1<<2	; have GRUB set video mode
MBOOT_HEADER_MAGIC	equ 0x1BADB002	; multiboot magic value
MBOOT_HEADER_FLAGS	equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO | MBOOT_VBE_MODE
MBOOT_CHECKSUM		equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
And this is the command I'm using to launch QEMU:

Code: Select all

	$(EMULATOR) -vga std -net nic,model=ne2k_pci -d cpu_reset -D qemu.log -serial file:syslog.log -cdrom $^

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 2:43 pm
by Kazinsal
The mode parameters in the header should be stored as dd (32 bits), not dw (16 bits).

Re: GRUB won't set video mode above 640x480x32

Posted: Wed Jan 18, 2017 2:54 pm
by codyd51
Kazinsal wrote:The mode parameters in the header should be stored as dd (32 bits), not dw (16 bits).
Whoops! That's a goof. Thanks a lot! That solved the issue.