Do I need multiboot2?

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
User avatar
mrjbom
Member
Member
Posts: 315
Joined: Sun Jul 21, 2019 7:34 am

Do I need multiboot2?

Post by mrjbom »

Hi.
I am writing a simple 32-bit protected mode kernel and now I plan to start implementing memory management tools, for this I should refer to the information that GRUB gives me. I am currently using the multiboot specification of the first version and I am thinking whether it is worth implementing multiboot2 first. Should I use multiboot2 in my core? What will it give me?
Please advise how to solve this issue.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: Do I need multiboot2?

Post by Octocontrabass »

For memory management, the only thing Multiboot2 gives you that Multiboot doesn't is the relocatable header tag, which you can use to tell the bootloader it can load your kernel at a different address if the one you specified in your linker script isn't available. If you're not planning on using that tag, then Multiboot2 makes no real difference to your memory management. (UEFI doesn't guarantee memory will be available at 1MiB the way legacy BIOS does, so the relocatable header tag gives you a way to make your OS run on more PCs. However, you have to write the code to handle being loaded at a different address.)

In general, Multiboot2 gives you better UEFI support. Even if you don't use the relocatable header tag, it still gives you access to the EFI system table and the ACPI RSDP on UEFI PCs.
User avatar
mrjbom
Member
Member
Posts: 315
Joined: Sun Jul 21, 2019 7:34 am

Re: Do I need multiboot2?

Post by mrjbom »

Octocontrabass wrote:UEFI doesn't guarantee memory will be available at 1MiB the way legacy BIOS does
Does GRUB boot the kernel using UEFI or BIOS? I would like to be sure that the BIOS will boot me, how can I ask GRUB for this?
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: Do I need multiboot2?

Post by Octocontrabass »

mrjbom wrote:Does GRUB boot the kernel using UEFI or BIOS?
GRUB uses whatever is available.
mrjbom wrote:I would like to be sure that the BIOS will boot me, how can I ask GRUB for this?
GRUB doesn't control that. If you want to choose BIOS or UEFI, you have to use the firmware's boot menu. Some new PCs don't support BIOS.
Post Reply