Could anyone tell me what GRUB does with files you specify as 'modules' for it to load?
It sounds like it could possibly be handy for keymaps (in the beginning, anyway), possibly drivers - and maybe loading some simply tasks to test multitasking before writing floppy drivers.
GRUB modules?
GRUB modules?
Regards,
Angus [Óengus] 'Midas' Lepper
Angus [Óengus] 'Midas' Lepper
Re:GRUB modules?
This thread probably gives you some insight.Midas wrote: Could anyone tell me what GRUB does with files you specify as 'modules' for it to load?
Exactly, that's the point of multiboot modules. I plan to use them excessively, for exactly those purposes.Midas wrote: It sounds like it could possibly be handy for keymaps (in the beginning, anyway), possibly drivers - and maybe loading some simply tasks to test multitasking before writing floppy drivers.
cheers Joe
Re:GRUB modules?
They all also cool for loading initial process for a microkernel system which doesn't have kernel mode drivers. I wonder what they were designed for...
Re:GRUB modules?
Okay, I get the general idea now...
I've made a keymap, a simple .bin file. I load this as a module (module /boot/keymap.bin). I get the address that the module's loaded at from the multiboot data structure, and then try to load my keymap from there (using the following code - although I strongly suspect the code is right, and that the bug lies in loading the module somehow).
However, this is bizarre, it has to be said. I get all sorts of alternative characters - I'm guessing I'm reading uninitialized memory. Using a debug build of bochs, and doing
xp /8b 0x20B40
I can see that the keymap isn't there, at all (this is the address that is printed as being loaded - and is in the data structure (I've got code that dumps that to the bochs i/o console ports)). So basically - what do I have to do with this address to get where my module has actually been loaded?
I've made a keymap, a simple .bin file. I load this as a module (module /boot/keymap.bin). I get the address that the module's loaded at from the multiboot data structure, and then try to load my keymap from there (using the following code - although I strongly suspect the code is right, and that the bug lies in loading the module somehow).
Code: Select all
void loadKeymap(void *mbdata)
{
unsigned long *modadd = mbdata;
modadd = &modadd[6];
unsigned char *modkeymap;
modkeymap = (unsigned char*) *modadd; /* Get a pointer to our keymap
module - lowercase is at the
start and is 88 chars long */
unsigned char *modkeymapshift = &modkeymap[88]; /* Get a pointer to the uppercase
section of our keymap module -
lowercase is 88 chars long, starting
at 0 so our uppercase starts at
index 88 */
puts(" from 0x");
char buf[10];
puts(itoa((long) modkeymap, buf, 16));
for(int i = 0; i < 88; i++)
{
keymap[i] = modkeymap[i];
keymapshift[i] = modkeymapshift[i+88];
}
puts("...");
}
xp /8b 0x20B40
I can see that the keymap isn't there, at all (this is the address that is printed as being loaded - and is in the data structure (I've got code that dumps that to the bochs i/o console ports)). So basically - what do I have to do with this address to get where my module has actually been loaded?
Regards,
Angus [Óengus] 'Midas' Lepper
Angus [Óengus] 'Midas' Lepper
Re:GRUB modules?
I suggest you have a read of the multiboot spec, and use a structure with proper names (theres an incomplete sample one in the multiboot docs) rather than array indices to access members of the multiboot info.
The mods_addr member points to an array of module data structures, and the number of entries in this list is given by mods_count.
The mods_addr member points to an array of module data structures, and the number of entries in this list is given by mods_count.
Re:GRUB modules?
I suspected that was the case, but did have a reasonable look at the multiboot spec earlier, but couldn't find anything detailing how exactly it worked. Could you point me in the direction of which particular section I should be looking at?paulbarker wrote: I suggest you have a read of the multiboot spec, and use a structure with proper names (theres an incomplete sample one in the multiboot docs) rather than array indices to access members of the multiboot info.
The mods_addr member points to an array of module data structures, and the number of entries in this list is given by mods_count.
EDIT: This is what I read: http://www.gnu.org/software/grub/manual ... iboot.html
Now, I'm a little tired - but I certainly didn't see anything the couple times I looked through that. Sorry! :-[
EDIT2: Ah, wait, it is on there! D'oh. Sorry, got it. Think I'll leave it to read tonight and work on tomorrow. Thanks. ;D
Regards,
Angus [Óengus] 'Midas' Lepper
Angus [Óengus] 'Midas' Lepper