Page 1 of 1

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

Posted: Thu Jun 27, 2024 3:05 am
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

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

Posted: Thu Jun 27, 2024 9:39 am
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

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

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

Somehow the example on the multiboot2 web manual makes the same mistake.

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

Posted: Fri Jun 28, 2024 11:11 am
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?

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

Posted: Fri Jun 28, 2024 11:26 am
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.

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

Posted: Fri Jun 28, 2024 11:32 am
by eekee
Thanks