What now?

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
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

What now?

Post by eXeCuTeR »

After I created the GDT, IDT, enabled paging, got into usermode, written a keyboard driver, got a basic VFS, written a memory manager, and got multitasking (which apparently doesn't work in usermode, gotta fix this)..., and all that basic stuff, what should I be working on now? What eventually I wanna get is a kernel that has got some thirdparty programs installed in it (gcc/python/some console games, etc'), and a tcp/ip stack (get lynks in my kernel also for web browsing), but these days, I don't know what to work on now. Any kind of suggestions are welcomed. Thanks.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: What now?

Post by AJ »

Hi,

First, as you're aware, fix that ring 3 multitasking and get everything as tested and "bug-free" as possible. Next, have a look at porting a C library (see Porting Newlib). After you've done that, what you do will largely depend on the dependencies of your desired programs.

So, If you want to compile something natively, work through its dependencies and get those compiling first. Oh - I didn't spot disk drivers on your list - you'll need them first :)

Cheers,
Adam
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

Re: What now?

Post by eXeCuTeR »

AJ wrote:Hi,

First, as you're aware, fix that ring 3 multitasking and get everything as tested and "bug-free" as possible. Next, have a look at porting a C library (see Porting Newlib). After you've done that, what you do will largely depend on the dependencies of your desired programs.

So, If you want to compile something natively, work through its dependencies and get those compiling first. Oh - I didn't spot disk drivers on your list - you'll need them first :)

Cheers,
Adam
Ow ok, I'll try to fix this. Anyways, what exactly is a disk driver? why do I need it?
PHPnerd
Member
Member
Posts: 34
Joined: Mon Nov 05, 2007 11:15 am
Location: The Netherlands
Contact:

Re: What now?

Post by PHPnerd »

You need disk drivers to read from hard disks, floppy drives, etc etc. When written, you can implement a filesystem, so you can store files and folders on the disk. Then, you can read programs from the disk, and starting them would be nice (you have to write code for this too).
Then, port newlib to your OS, and compile GCC and others with it. Then you may be able to compile your OS via your OS :mrgreen:

Success

// PHPnerd
Jinix
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: What now?

Post by Troy Martin »

One of the most standard things (I would think) to implement is a floppy driver, and then probably the FAT filesystem (FAT12 for floppies, 16 and 32 for hard drives.)
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

Re: What now?

Post by eXeCuTeR »

I don't understand it. If you look at JamesM's VFS code, he is able to go over the directories/files that exists so why do I need a disk driver?
purage
On Probation
Posts: 119
Joined: Wed Feb 11, 2009 1:04 am

Re: What now?

Post by purage »

That's because JamesM created a *virtual* file system. It is loaded in RAM. It isn't supposed to be used the way you are probably using it. Plus, his vfs is incomplete (a good start, but incomplete) so I hope you further developed it if you are using it at all; which you really should not be doing if you are. My 2 cents.

I don't know how you have your OS working, if you rolled your own loader. If you did roll your own then you probably already have the basics for creating a FAT12 or FAT32 driver anyway, assuming you actually wrote your own loader. If you are using GRUB or something pre-made like that, then you are probably still like, WTF are you talking about?

So, take a minute to look over your code and decide where you need to go next on your own, because no one here can tell you that with certainty. Like was said, just fix the bugs you have now and then contemplate the rest later when you actually reach that point. You will find that your decisions will be more informed and you should have less trouble navigating your project to completion on your own. You might find that you never wanted to be in user mode anyway, or that you never really wanted networking capabilities, etc. Think about what your OS will do, does it have a specific function or is it just a clone for shits and giggles? Things that only you can decide.
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

Re: What now?

Post by eXeCuTeR »

purage wrote:That's because JamesM created a *virtual* file system. It is loaded in RAM. It isn't supposed to be used the way you are probably using it. Plus, his vfs is incomplete (a good start, but incomplete) so I hope you further developed it if you are using it at all; which you really should not be doing if you are. My 2 cents.

I don't know how you have your OS working, if you rolled your own loader. If you did roll your own then you probably already have the basics for creating a FAT12 or FAT32 driver anyway, assuming you actually wrote your own loader. If you are using GRUB or something pre-made like that, then you are probably still like, WTF are you talking about?

So, take a minute to look over your code and decide where you need to go next on your own, because no one here can tell you that with certainty. Like was said, just fix the bugs you have now and then contemplate the rest later when you actually reach that point. You will find that your decisions will be more informed and you should have less trouble navigating your project to completion on your own. You might find that you never wanted to be in user mode anyway, or that you never really wanted networking capabilities, etc. Think about what your OS will do, does it have a specific function or is it just a clone for shits and giggles? Things that only you can decide.

Well, In my kernel I'm using GRUB but I also know the basic idea on writing a bootloader on your own, i've read an assembly code that reads from disk sectors and loads the kernel that is loaded to this sector. Anyways, I already said what are my goals: get a kernel that has thirdparty programs in it and networking capabilities, with a more advanced working VFS and some more commands in the shell (I already have a shell with 4 basic commands: echo, reset, help, and clear). I just want lynks (the program) to be eventually working on my OS so I can surf on the kernel.
Just to clarify, basically JamesM's VFS exist over the RAM and not on the actual drive?
Last edited by eXeCuTeR on Thu Apr 30, 2009 1:11 pm, edited 1 time in total.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: What now?

Post by earlz »

Ok, the VFS in the tutorial is meant really for temporary use. To get the "feel" of having a FS. But the problem with that is the ramdisk is compiled at compiletime and can not be rewritten back to disk(it's not persistent after a reboot) unless you have a diskdriver that can handle doing that. Also, I don't think his FS for his initrd wasn't designed for writing, it is really only for reading until you can get a real FS up and running.

Oh, and there is a difference between a FS driver and a disk driver..
purage
On Probation
Posts: 119
Joined: Wed Feb 11, 2009 1:04 am

Re: What now?

Post by purage »

Yes, that is sort of correct. Technically, yes the VFS you have is on your disk, but GRUB loads it in RAM so that you can read it without a disk driver, which is faster. You should only be using it to load drivers or keep preferences, etc.You could create your own and attach it to the back of your kernel and be done with GRUB if that is why you like GRUB; for the module thing. If you are serious about your project, then you might want to roll your own loader at some point. How will you do graphics modes with GRUB? Yeah, you can hack it to let you do that, but I don't know, I think that it is better to just make your own loader. Just keep it simple.
User avatar
einsteinjunior
Member
Member
Posts: 90
Joined: Tue Sep 11, 2007 6:42 am

Re: What now?

Post by einsteinjunior »

purage wrote: How will you do graphics modes with GRUB? Yeah, you can hack it to let you do that, but I don't know, I think that it is better to just make your own loader. Just keep it simple.
As far a graphics is concerned,i heard about a hacked version of GRUB that could get you all the
VESA video modes of the installed graphics card on the system(if the card supports VESA of course).
Still to find out but from what i hear from guys,it works.But you could also do it the hard way with a v86 machine monitor in pmode with a little app running there that could get you all the video modes and a pointer to the lfb for use by the video driver.
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: What now?

Post by skyking »

Strictly speaking you don't need a disk driver to be able to port programs like python. Disk driver is only needed if you want to save your work, for the rest a RAM file system will work.

Until your system supports everything there will be things that are unsupported, you will have to cope with that and get round these shortcomings in order to be able to make the next step...

Next step could be:
* Write a disk driver.
* Write a disk filesystem (that does not need a disk driver since you can use RAM as block device)
* Implement a subset of the POSIX C library that is required for the programs you want to port.
* Jump straight to porting a program, removing obstacles as you go.
it's just to make a choice.
purage
On Probation
Posts: 119
Joined: Wed Feb 11, 2009 1:04 am

Re: What now?

Post by purage »

That just seems like a waste of valuable RAM space. Also, it's *much* easier to setup the VESA mode from real mode and then pass a struct to your kernel sitting pretty in protected mode. You wont be able to change the mode after this, unless you do some sort of back and forth routine. Plus, you have to map the LFB address to a memory location in which you can access from pmode, a pointer alone will fault the CPU.
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

Re: What now?

Post by eXeCuTeR »

What I've understood is that a VFS is loaded into RAM and can only be read and not written (in runtime), and if I would like also to write to disk and make it stay there after reboot, I will have to write a disk driver and a disk filesystem (and also a VFS). Then I'll have to port Newlib into my OS so the thirdparty programs could use them but my question is how will I know which functions do exactly the program I wish to port in my system require? and how will the programs know how to use my functions and libraries?
BTW, any references or tutorials on how these things exactly work and how to implement these will be very much appreciated.
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: What now?

Post by skyking »

eXeCuTeR wrote:Then I'll have to port Newlib into my OS so the thirdparty programs could use them but my question is how will I know which functions do exactly the program I wish to port in my system require? and how will the programs know how to use my functions and libraries?
BTW, any references or tutorials on how these things exactly work and how to implement these will be very much appreciated.
When you try to build the third party program you will get compile/link errors since you don't have the required header file/library functions in place yet. These errors are valuable since they tell exactly what needs to be done in order to build the program. Of course you have to know how to build a library and link with that library (static linking may be the easiest way), but that should be prerequisite knowledge for OS programming.
Post Reply