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..
Modular kernel basic design question..
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
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.
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.
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..
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
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.
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.