Trouble with a ramdisk.

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
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Trouble with a ramdisk.

Post 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>>>
Last edited by Zz on Sat Apr 12, 2014 7:09 pm, edited 1 time in total.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Trouble with a ramdisk.

Post 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.
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: Trouble with a ramdisk.

Post 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.
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: Trouble with a ramdisk.

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