Page 1 of 1

Simple OS Development

Posted: Fri Oct 24, 2014 8:34 am
by dromenox
I'm crazy to create an operating system from scratch, where I can run programs on it. For now I'm only planning but I have many doubts.

Some features of it (I'm still planning):
  • -The graphical interface it will be simple like the BIOS interface.
    -For now will be single-tasking.
    -I want to create a simple filesystem.
    -I'm planning to do the bootloader in assembly and the rest in C
    -Users can develop and run applications in C on my system
    -I'll make some C libraries to create windows and simple controls. Users will include these libraries to develop your applications.
    -Not need to be portable. Only needs to run on my computer (Intel i5).
So, I only found tutorials explaining how to make a bootloader and maximum call a file in C. I have not found the resources to implement more things in the system.

The main questions I have are:
  • -How to create a file system?
    -How to run programs made ​​in C on my system? They need to run at a level above the kernel.
    -How to organize the structure of the system? What to do in Assembly and what to do in C?
    -How can I use my entire screen to draw and not just the 25x80?
    -If you can answer my questions and show me links to help me develop other things! The bootloader I know already do.
I have advanced knowledge in C
Good Knowledge in Assembly

Re: Simple OS Development

Posted: Fri Oct 24, 2014 8:52 am
by Cjreek
Welcome to OSDev ;-)

You probably should start from here:

http://wiki.osdev.org/Main_Page

On the Main page there's a category "Introduction" with many articles on how to start and what to consider before and while making your own OS.

And the questions you asked are the wrong questions ;-) So you probably should first read some of those articles/tutorials and then you should kind of know what this new hobby you chose is all about :)

Hint there are things like interrupts, PIC, paging, physical/virtual memory mangement, processor modes (realmode, protected mode) which you should know about and probably address before all those things you had in mind.

Re: Simple OS Development

Posted: Fri Oct 24, 2014 12:17 pm
by SpyderTL
dromenox wrote:The main questions I have are:

-How to create a file system?
I would recommend starting with a piece of paper (or notepad.exe). You will need to come up with the structures and fields that you will need to:
  • -Find a list of files and folders on your "volume".
    -Find the relationships between those files and folders.
    -Find which logical "block" your file is located in. (or blocks)
    -Find one or more blocks that are "empty"
These are the bare minimum for a file system. If you want your file system to be fast, or fault tolerant, you will need even more structures.
dromenox wrote:-How to run programs made ​​in C on my system? They need to run at a level above the kernel.
For this, you will need a memory manager. These come in all shapes and sizes, and it will arguably be the single most important component of your OS. A simple memory manager will get you up and running, but you will eventually need a "smart" memory manager if you want your system to be truly usable.
dromenox wrote:-How to organize the structure of the system? What to do in Assembly and what to do in C?
That is entirely up to you. There are pros and cons to each approach. However, most OS developers would recommend not writing any Assembly, at all, and only using C. For this, however, you will need to use a 3rd party Boot Loader. The good news is that there are free Boot Loaders that have all of the functionality that you will ever need.
dromenox wrote:-How can I use my entire screen to draw and not just the 25x80?
I would recommend sticking with 25x80 for your first attempt, as switching video modes and writing pixels to the screen is a truly significant problem, assuming that you want more than 800x600 pixels. Using software to render at higher resolutions is difficult, and slow, and you probably won't be happy with the results. You are really going to want some level of hardware graphics support. But, unfortunately, there are no common interfaces for video hardware acceleration, which means you will have to write code for each video card that you want to support. Most Operating Systems (except Windows) start up in 25x80 text mode, and only switch to Graphics Mode when everything has been setup and configured properly.

But the simple answer to your question is to call interrupt 10h while you are in 16-bit mode. See the wiki page for: How do I set a graphics mode
dromenox wrote:I have advanced knowledge in C
Good Knowledge in Assembly
Good! You are going to need them.. :)

But, the good news is that you've come to the right place. If you have any specific questions about how a particular component works, we will be happy to help you wherever possible.

Good Luck!

Re: Simple OS Development

Posted: Fri Oct 24, 2014 1:11 pm
by dromenox
SpyderTL wrote:
dromenox wrote:The main questions I have are:

-How to create a file system?
I would recommend starting with a piece of paper (or notepad.exe). You will need to come up with the structures and fields that you will need to:
  • -Find a list of files and folders on your "volume".
    -Find the relationships between those files and folders.
    -Find which logical "block" your file is located in. (or blocks)
    -Find one or more blocks that are "empty"
These are the bare minimum for a file system. If you want your file system to be fast, or fault tolerant, you will need even more structures.
dromenox wrote:-How to run programs made ​​in C on my system? They need to run at a level above the kernel.
For this, you will need a memory manager. These come in all shapes and sizes, and it will arguably be the single most important component of your OS. A simple memory manager will get you up and running, but you will eventually need a "smart" memory manager if you want your system to be truly usable.
dromenox wrote:-How to organize the structure of the system? What to do in Assembly and what to do in C?
That is entirely up to you. There are pros and cons to each approach. However, most OS developers would recommend not writing any Assembly, at all, and only using C. For this, however, you will need to use a 3rd party Boot Loader. The good news is that there are free Boot Loaders that have all of the functionality that you will ever need.
dromenox wrote:-How can I use my entire screen to draw and not just the 25x80?
I would recommend sticking with 25x80 for your first attempt, as switching video modes and writing pixels to the screen is a truly significant problem, assuming that you want more than 800x600 pixels. Using software to render at higher resolutions is difficult, and slow, and you probably won't be happy with the results. You are really going to want some level of hardware graphics support. But, unfortunately, there are no common interfaces for video hardware acceleration, which means you will have to write code for each video card that you want to support. Most Operating Systems (except Windows) start up in 25x80 text mode, and only switch to Graphics Mode when everything has been setup and configured properly.

But the simple answer to your question is to call interrupt 10h while you are in 16-bit mode. See the wiki page for: How do I set a graphics mode
dromenox wrote:I have advanced knowledge in C
Good Knowledge in Assembly
Good! You are going to need them.. :)

But, the good news is that you've come to the right place. If you have any specific questions about how a particular component works, we will be happy to help you wherever possible.

Good Luck!
Thank you so much! I will study more!

Thank you so much! I will study more!

But I still do not understand one thing:

Suppose I had already created a file system and a text editor for my system. How would I compile this file in C so it could be run ON TOP of my system using the libraries that I created? I would have to make a compiler for it?

Re: Simple OS Development

Posted: Fri Oct 24, 2014 8:20 pm
by SpyderTL
I believe that is the recommended way to do it. There are a few basic functions that you need to implement in order to compile C code for your specific OS. Things like malloc() and free() to connect the compiler to your memory manager. This is why you need a memory manager first, before you can compile C libraries.