Please help me(somehow beginner)

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
Administrator2004

Please help me(somehow beginner)

Post by Administrator2004 »

Thank all you for your best forums with more info.

I'm a beginner and I wanna write an OS :D,so I wanna know about it's sequences means where to put mbr(not sector0,I mean how to end the files) where to put pmode codes,where to load FS,where and where and where.It makes a gap in my mind.please help me.
[email protected]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Please help me(somehow beginner)

Post by Solar »

http://www.osdev.org/osfaq2/ is the WikiFAQ we keep handy for such purposes. Also try the thread "quick links".
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Please help me(somehow beginner)

Post by Pype.Clicker »

"where" as "where in the system RAM" ?

If this is the question, just check out Perica's tutorial about realmode memory organization and do whatever you want in the 'free area'...
Administrator2004

Re:Please help me(somehow beginner)

Post by Administrator2004 »

I checked all the things you said and will say but ...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Please help me(somehow beginner)

Post by Solar »

Administrator2004 wrote: I checked all the things you said...
Really?
...and will say...
Hm, you can see into the future? 8)
but...
OK, let's try to work out the question. What are you asking?

Are you asking about what order to make things in, or are you asking about how Boot Sectors are loaded? Do you wonder how to determine the layout of your RAM?

Come on, help us. The better the question, the better the answers.
Every good solution is obvious once you've found it.
Administrator2004

Re:Please help me(somehow beginner)

Post by Administrator2004 »

Excuse me if i annoy you.

Think that i have all the files(mbr,pmode,fs,kernel),how to make them work together.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Please help me(somehow beginner)

Post by Pype.Clicker »

Excuse me if i annoy you.
'intriguing" is a better word for the current situation.

Let's try to sketch a battle plan:

MBR has to know where the 2nd stage loader reside on disk and where it should be placed in memory. "where on disk" will be decided by the tool that installs 2nd stage, which will have to patch the MBR appropriately (e.g. keep the last free bytes for a first sector/sector count)

The second stage loader will contain code to switch to pmode and FS driver (optionnal) It will use the FS driver to locate the kernel file and load it in memory (whatever location your kernel wishes. It could be at 0x10000 if 512KB is enough for your kernel or starting at 1MB (using unreal mode) if you need more room). Then it invokes the part that switches to pmode and finally jumps to the kernel.

Hope it Helps ...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Please help me(somehow beginner)

Post by Solar »

Administrator2004 wrote: Excuse me if i annoy you.
Pype had the right word - 'intriguing'. Your initial posts didn't tell us enough to give good answers.

You mention "pmode", "fs", and "kernel". I take it that "pmode" is the code enabling Protected Mode. What is "fs"? Yes, I know it stands for "file system", but... is that just a piece of code allowing to localize the kernel image on-disk? Or is it a driver module that's loaded by your kernel?

And (please, people from the "write your own bootloader" camp, don't flame me), have you considered using an existing bootloader like GRUB, which relieves you of mbr, pmode, and fs?
Every good solution is obvious once you've found it.
Administrator2004

Re:Please help me(somehow beginner)

Post by Administrator2004 »

Thank you so much more.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Please help me(somehow beginner)

Post by distantvoices »

*gg*

GRUB helps getting stright into the real thing.

Althou, bear with me, writing some small boot loader, which fetches a few blocks from disk, sets an initial GDT enables protected mode and jumps to the previously loaded executeable - it is some kind of extremely satisfying experience about the barest nitty gritty of OS dev to see the own hacked-together bootloader fetching some program from disk and starting it.

Mark: it is not required to do this kind of lowlevel stuff, but it's a useful experience lateron: you know what happens and can set maybe appropriate actions if something doesn't work. At least you know what to expect.

mark2: I don't advocate for writing an own bootloader. I just think it is a cool experience.

stay safe.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Administrator2004

Re:Please help me(somehow beginner)

Post by Administrator2004 »

I will ask more questions because I love to know :D
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Please help me(somehow beginner)

Post by distantvoices »

Feel invited to do so, but do some research on your own too.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
bkilgore

Re:Please help me(somehow beginner)

Post by bkilgore »

beyond infinity wrote:Althou, bear with me, writing some small boot loader, which fetches a few blocks from disk, sets an initial GDT enables protected mode and jumps to the previously loaded executeable - it is some kind of extremely satisfying experience about the barest nitty gritty of OS dev to see the own hacked-together bootloader fetching some program from disk and starting it.
I wholeheartedly second this. Although I have long since left my own bootloader on the wayside and succumbed to the benefits of GRUB (read: my bootloader stopped working when my kernel grew bigger and I decided my time was better spent working on actual OS development), there have been few experiences while developing my OS that rival that of being able to say "I turned the computer on and I was actually able to make it DO something with nobody else's code helping me out"

I would recommend it for anybody that is just getting into OS development and doesn't mind struggling through it. It really gives you an appreciation and greater knowledge of what exactly is involved in getting from a freshly booted computer to a running operating system. If nothing else, as BI said, it can certainly come in handy with any low-level problems in the future.
Post Reply