Does Grub load modules in the memory or the module names are just passed to the kernel??
If it loads the modules in the memory, what memory position does it use?
Grub Module
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
GRUB loads the modules into memory, and then it passes you the locations via the multiboot header (mods_addr field).
Example:
Example:
Code: Select all
// the module list
module_t* mods = (module_t*) MultiBootHeader->mods_addr;
// temporary ELF relocation class
ELFRelocation tmpreloc;
// loop through and load each module
for( int i = 0; i < MultiBootHeader->mods_count; i++ )
{
// load it, and execute it
tmpreloc.LoadFile( mods[i].mod_start );
tmpreloc.RelocateExecutable();
}