InitRD, HELP!!!

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.
Locked
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

InitRD, HELP!!!

Post 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!
Last edited by roelforg on Mon Aug 08, 2011 11:56 am, edited 1 time in total.
Image

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
Neolander
Member
Member
Posts: 228
Joined: Tue Mar 23, 2010 3:01 pm
Location: Uppsala, Sweden
Contact:

Re: InitRD, HELP!!!

Post by Neolander »

Could this and this, perchance, be what you're looking for ?
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

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

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
Neolander
Member
Member
Posts: 228
Joined: Tue Mar 23, 2010 3:01 pm
Location: Uppsala, Sweden
Contact:

Re: InitRD, HELP!!!

Post 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.
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

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

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: InitRD, HELP!!!

Post 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?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

Post 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... :| ).
Image

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: InitRD, HELP!!!

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

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

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: InitRD, HELP!!!

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Jezze
Member
Member
Posts: 395
Joined: Thu Jul 26, 2007 1:53 am
Libera.chat IRC: jfu
Contact:

Re: InitRD, HELP!!!

Post 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).
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

Post by roelforg »

@Jezze:

Looks good, i'll give it a try
Image

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
roelforg
Posts: 22
Joined: Mon Aug 08, 2011 6:27 am

Re: InitRD, HELP!!!

Post by roelforg »

Jezze's tut really works!!! :D
THX.

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

@Moderators: close this topic pls
Image

Jokes:
Q. Why did the scarecrow got promoted?
A. Because he was OUTSTANDING in his field!
=====================
Q. What's blue and isn't heavy?
A. Lightblue!
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: InitRD, HELP!!!

Post 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
Locked