OSDev.org
https://forum.osdev.org/

Modular kernel basic design question..
https://forum.osdev.org/viewtopic.php?f=1&t=53512
Page 1 of 1

Author:  coolsun20 [ Fri Sep 17, 2021 8:35 am ]
Post subject:  Modular kernel basic design question..

Hello There,
Am in mist of designing and writing up modular OS with ability to load and unload various modules once kernel loads up. Have written my own basic boot loader code to load up my custom OS . However researching further shows that I can also use GRUB2 as a boot loader. GRUB2 has various stock modules that it can load before booting my kernel. GRUB2 documentation mentions that it complies with multiboot 2 spec. Seems like once my kernel is booted I can use multiboot2 structure to locate and identify the modules that are loaded by GRUB2 boot loader.
Am wondering if I can take advantage of these modules that are loaded by GRUB2 in my kernel. or if I can access any functionality from these modules within my kernel.

Thanks in advance..

Author:  Octocontrabass [ Fri Sep 17, 2021 8:52 am ]
Post subject:  Re: Modular kernel basic design question..

It sounds like you've mixed up GRUB modules and Multiboot modules.

GRUB modules are used by GRUB to do things like access different filesystems. GRUB includes GRUB modules.

Multiboot modules are whatever additional files you want the bootloader to put into memory before your kernel starts running. GRUB does not include Multiboot modules.

Author:  coolsun20 [ Fri Sep 17, 2021 9:25 am ]
Post subject:  Re: Modular kernel basic design question..

Yes you are correct.. sorry about mixup..I was referring to mutiboot2 compliant modules that GRUB2 can load.. Wondering if I can use that architecture and and if so are there any examples surrounding that anyone knows of.. thanks again..

Author:  Octocontrabass [ Fri Sep 17, 2021 10:07 am ]
Post subject:  Re: Modular kernel basic design question..

I don't know of any examples, but Multiboot2 modules are extremely simple. The bootloader copies the file into memory and gives you a pointer to it. Your kernel is responsible for parsing the file's contents.

If you include the module alignment tag in your Multiboot header, the modules will be loaded at page-aligned addresses. You can then use paging to put your module's code and data at reasonable virtual addresses without having to copy the entire file elsewhere in memory.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/