Modular kernel basic design question..

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
coolsun20
Posts: 2
Joined: Thu May 30, 2013 5:17 am

Modular kernel basic design question..

Post by coolsun20 »

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..
Octocontrabass
Member
Member
Posts: 5443
Joined: Mon Mar 25, 2013 7:01 pm

Re: Modular kernel basic design question..

Post by Octocontrabass »

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.
coolsun20
Posts: 2
Joined: Thu May 30, 2013 5:17 am

Re: Modular kernel basic design question..

Post by coolsun20 »

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..
Octocontrabass
Member
Member
Posts: 5443
Joined: Mon Mar 25, 2013 7:01 pm

Re: Modular kernel basic design question..

Post by Octocontrabass »

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.
Post Reply