Page 1 of 1
Trouble with a ramdisk.
Posted: Sat Apr 12, 2014 7:01 pm
by Zz
Alright so for a while I've been toying with my kernel trying to get things working. So I got through some issues but one thing stuck. When specifying this and using mkrescue and running the resulting image on vpc...
Code: Select all
menuentry "example" {
multiboot /boot/os.bin
module /boot/initrd.img
}
I would panic loading my allocator. I thought I had messed up somewhere specifying all the required multiboot goodies, but I could not find anything wrong. Since Jame's has his tutorial source available I headed over and tried out his ramdisk sample BUT I managed to get a page fault which appears to be related to my allocator woes but I am no expert on his code. Any ideas? Hey, a link to something that will lead me in remotely the right direction would be greatly appreciated!
Update: <<<My main concern is that I am not correctly understanding how to implement a module>>>
Re: Trouble with a ramdisk.
Posted: Sat Apr 12, 2014 7:05 pm
by Bender
Um, how can we tell anything about your allocator with such a vague description , please debug for a while and post the relevant source code.
Re: Trouble with a ramdisk.
Posted: Sat Apr 12, 2014 7:19 pm
by Zz
Alright will do, but I'm sorry I was a little vague. I'll debug a little further then update. What I should have clarified is that I feel I'm faulting on properly setting up a module.
Re: Trouble with a ramdisk.
Posted: Sat Apr 12, 2014 9:00 pm
by Zz
Ok. So my allocator was actually fine, I just forgot to panic if I did not find the ramdisk, a stupid mistake. My kernel does not even find the ramdisk yey revelation! If mine is fussing that the address given makes no sense, and Jame's has code that says its finding the module but apparently incorrectly I'm messing up early on.
From Jame's tutorial...
Code: Select all
// Find the location of our initial ramdisk.
ASSERT(mboot_ptr->mods_count > 0);
u32int initrd_location = *((u32int*)mboot_ptr->mods_addr);
u32int initrd_end = *(u32int*)(mboot_ptr->mods_addr+4);
// Don't trample our module with placement accesses, please!
placement_address = initrd_end;
// Start paging.
initialise_paging();
This errors at paging ONLY when it attempts to add a module and retrieve the information!
The only addition I have made (I used his kernel binary and ramdisk)...
Code: Select all
menuentry "example" {
multiboot /boot/os.bin
module /boot/initrd.img
}
Using typical mkrescue command
Code: Select all
grub-mkrescue --output=example.iso isodir
So in summary, what I thought I had right back yonder and started questioning again is still wrong.
SO.. I was under the impression that this was sufficient to give grub the file location to handle so I could take from grub the address pointer to the file and be golden, but this points to the contrary. Is this enough to get a bit of help? I mean it seems like it probably is basic but it's eluding me.