grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sebihepp
Member
Member
Posts: 177
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by sebihepp »

Dear Forum,

I have a problem and can't find anything about it: I am using grub2 to boot my kernel on bochs. So far it works - But whenever I set the multiboot2 framebuffer header tag, grub2 in bochs is only displaying a console, instead of loading my kernel. When I remove the framebuffer header tag, it works again.
I made sure I only request a video mode which grub2 is reporting as supported by modeinfo, but even that doesn't work.

Here is my Header:

Code: Select all

.section ".multiboot"
.align 8
_multiboot_header:
	.long MULTIBOOT2_HEADER_MAGIC						# Multiboot magic number
	.long MULTIBOOT2_ARCHITECTURE_I386					# Architecture (0 = i386)
	.long _multiboot_header - _multiboot_header_end		# Size of Headers
	.long -MULTIBOOT2_HEADER_MAGIC - MULTIBOOT2_ARCHITECTURE_I386 - (_multiboot_header - _multiboot_header_end)		# Checksum 
	
	.short MULTIBOOT2_HEADER_TAG_FRAMEBUFFER			# Type 5 = Framebuffer request
	.short MULTIBOOT2_HEADER_TAG_OPTIONAL				# Flags
	.long 20											# Size
	.long 1024											# Width
	.long 768											# Heigth
	.long 32											# Depth
	
	.short MULTIBOOT2_HEADER_TAG_MODULE_ALIGN			# Type 6 = Modules must be page aligned
	.short MULTIBOOT2_HEADER_TAG_MANDATORY				# Flags
	.long 8												# Size

	.short MULTIBOOT2_HEADER_TAG_END					# Type 0 = end of tags
	.short MULTIBOOT2_HEADER_TAG_MANDATORY				# Flags
	.long 8												# Size
_multiboot_header_end:
Do you have any idea? Even if you only know why it fails it would help me.

Best regards
Sebi
sebihepp
Member
Member
Posts: 177
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by sebihepp »

I tested further and qemu shows the same behaviour. According to grub-file my kernel ist multiboot2 compliant - at least the multiboot2 header is correct... maybe I oversee something
sebihepp
Member
Member
Posts: 177
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by sebihepp »

I solved it: The tags were not 8 byte aligned.

Somehow the example on the multiboot2 web manual makes the same mistake.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by eekee »

sebihepp wrote: Thu Jun 27, 2024 9:54 am I solved it: The tags were not 8 byte aligned.

Somehow the example on the multiboot2 web manual makes the same mistake.
Is that alignment in the standard or is it another case of grub being incompatible with a multiboot standard?
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Octocontrabass
Member
Member
Posts: 5418
Joined: Mon Mar 25, 2013 7:01 pm

Re: grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by Octocontrabass »

Tags constitutes a buffer of structures following each other padded when necessary in order for each tag to start at 8-bytes aligned address.
Yep, it's in there.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: grub2 on bochs: doesn't load kernel when framebuffer header tag is set

Post by eekee »

Thanks
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply