Page 1 of 1

InitRD, HELP!!!

Posted: Mon Aug 08, 2011 7:32 am
by roelforg
Hello everyone,
I'm creating my own os,
it's almost done, the biggest problem is that i can't get initrd working. :(
I can't find any information on how to implement the initrd.
Yes, i have read the wiki and several other documents.
Theory enough...
Now to put it in to practice.

Basicly: Does anyone have a c/c++ sample of how to implement an initrd??? [-o<
I do know from the multiboot pointer where the initrd is.
I always find it more informative to see a working example and then comparing it to the theory to see exactly which call does what.

Please help!!! :?: :?: :?:

PS: Nice smilies, where did they get them? I want them to!

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 7:38 am
by Neolander
Could this and this, perchance, be what you're looking for ?

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 7:45 am
by roelforg
Well,
No.

The os is almost done, it already has multitasking, paging, advanced mmu, login, ring 3, etc

The great wall where i can't get through is VFS/FS (but since it should run from cd, FS isn't important),
That's because to me, it's not clear how i'm supposed to implement VFS.

Besides dynamic loading and a few bugs in my VGA driver (it crashed when you press the reset button instead of the power button), i have it almost done.

The kernel itself is 95% done.
I'm already working on gui since the mouse/keyboard are already done.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 7:54 am
by Neolander
Well, at least I understand much better where you are right now :)

(For me "initrd" only means "that stuff which has to run before the kernel may execute properly", unless you're thinking about an OS in particular)

As for an example of VFS&associated initrd code implementation, JamesM's tutorials contain one, if it can help you.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 8:08 am
by roelforg
Thanx for the fast reply...
But i already tried, although it loads and i can access files, it won't recorgnise directory's and messes up any files not in ascii, and is really unstable :shock: .
I know that people use cpio and other stuff,
maybe something like that :?:

Also,
The initRD will be the primary fs.
The problem is just the lack of documentation and examples.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 10:57 am
by Combuster
roelforg wrote:I know that people use cpio and other stuff,
maybe something like that
Since you started about it: Do you know what cpio is? How may it be relevant to your situation? Does it apply in your case? Was it therefore necessary to post that?

It's not a good practice to post some random keywords and hope that some of us will magically fix your problem. Right now you make me believe you either neglected your own research or worse.
although it loads and i can access files, it won't recorgnise directory's and messes up any files not in ascii, and is really unstable
And your attempts at narrowing down the problem taught you what?

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 11:47 am
by roelforg
Let's see...

1. I know what cpio is, i just don't know if it is what i need or do i need something else? :?
2. The problem: there's no way to store what nodes are directories and no way to say this file in that dir :x
which is a problem since the initrd is the main FS (it's supposed to only run from cdrom/floppy, so no use for normal fs drivers :roll: , for now... :| ).

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 12:28 pm
by Combuster
roelforg wrote:1. I know what cpio is, i just don't know if it is what i need or do i need something else?
You made the ramdisk right? Did you use CPIO?
2. The problem: there's no way to store what nodes are directories and no way to say this file in that dir
Who told you that? And continuing from #1, what indexing system are you actually using that makes it unable to do that?
since the initrd is the main FS (it's supposed to only run from cdrom/floppy, so no use for normal fs drivers :roll: , for now... :| ).
That's nonsesne. FS drivers don't need to know that the storage is in RAM rather than persistent storage. Many will even go as far as that the FS driver should not know.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 12:30 pm
by roelforg
I did not create the file.

And i was telling you in point 2 about the problems i had with the initrd-system from the article you linked.

Also i meant that there is no need for drivers for hd's since it will only use a ramfs.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 12:42 pm
by Combuster
I did not create the file.
That basically confirmed the worst case: you didn't actually know what you were doing. Well, at least we have something you can fix now. I hope you learnt now not to simply copy other's people stuff without knowing the specifications and then just expecting it to just work.

I hope you can figure out from my other questions what you were supposed to know.

Re: InitRD, HELP!!!

Posted: Mon Aug 08, 2011 1:18 pm
by Jezze
I wrote a tutorial on how to use tar as an initrd if that helps. http://forum.osdev.org/viewtopic.php?f=8&t=23339

To create a virtual filesystem you are on your own though but the basics are very easy (and actually well described in JamesM's tutorial).

Re: InitRD, HELP!!!

Posted: Tue Aug 09, 2011 4:50 am
by roelforg
@Jezze:

Looks good, i'll give it a try

Re: InitRD, HELP!!!

Posted: Tue Aug 09, 2011 5:09 am
by roelforg
Jezze's tut really works!!! :D
THX.

I declare this topic SOLVED!!! =D> =D> =D>

@Moderators: close this topic pls

Re: InitRD, HELP!!!

Posted: Tue Aug 09, 2011 12:50 pm
by AJ
Hi,

Have locked the topic as I don't see it going anywhere, but there are a couple of things that are slightly worrying:
  • You have declared your kernel 95% complete but are unable to work out how to make a FS work or carry out basic debugging / research.
  • You may well have 'solved' your problem by copying more code from a tutorial.
  • You are about to start on the GUI despite the above 2 points.
Can I suggest that now is the time to do some more research, go back through your kernel and do general debugging and ensure that you understand every line of code in your kernel before continuing. Also, ensure that the design of your kernel is up to scratch from the outset. You don't want to spend time on a GUI, find that the kernel does not have the required support to make it all work nicely and end up deciding to write everything from scratch later on...

Cheers,
Adam