Page 1 of 1

OS development - Need help.

Posted: Wed Aug 02, 2006 10:58 pm
by extremecoder
Hey OS geeks,
I am need of help from all you people, in developing my own operating system. I can say i am expert in C programming (linux / win) and i am not strong in asm, but I can code little in asm and learning it. i have been coding in C for the past 10 years (right my age of 13!). I want to design, build, code my own os, since I believe this is the only way where one can really do system software development. i don't like application devel or some crap. I expect a kind of help for my following doubts


1) I started studying and exploring about os concepts, and tech's to build my own OS. since, this area is not like app development, where people will study about objective, libraries and stuff. This area is something like understanding machine, architecture and stuff. I would be happy if anyone can exactly show a starting path, like where to start of, materials, links and stuff.. as chaase and Jaaman pointed out I started from learning about bootloaders, nyway.

2) as far as I have explored and exploring the web (as well as osdev.org), i learned that there should be some base os (dos, win or linux) in order to code the kernel and other core components. so am confused to chooe one. I am a linux lover, but most of the project / people here talk about devel Dos based os and stuff. so I want someone to throw light on this.

3) this question is because of machine resource availability I have. I have only one laptop, which is for my company use. so I can't do much testing on it and moreover i can't buy a extra computer at this time. what's the best possibility and other stuff i can do...but offcourse I can install ny legal software and do programming, not a problem for that ...


Extreme Coder

Posted: Thu Aug 03, 2006 12:55 am
by josephjah
Hey extremecoder, and welcome to the realm of osdev :), First lets define the term 'OSdev':

OS·dev Noun/Verb - A type of extremely intense programming and system development, shows almost no instant gradification, and has been known to drive some to the brink of insanity.

Ok, in other words... osdeving takes a long time, and is not something to attempt as a summer project, but from the sound of it, you have already done some basic research and probly already knew that... ok, now to the meat of the message.

http://www.osdever.net <- great place for tutorials
http://www.osdever.net/cottontail/ <- a VERY large archive
http://mega-tokyo.com/osfaq2/ <- A great beginner's FAQ

After you have taken a quick look at those site to get a basic feel of them, your ready to start outlining your os... it sounds like you're aiming for the x86 architecture, and since that's my only area of knowledge in osdev... I might be of some help, lol.

First... A bootloader or (Boot Strap)... do you want to write your own?
- YES: Ok, take a look at this http://osdever.net/tutorials/hello_btldr.php?the_id=85 and make sure you're VERY familiar with Assembly language
- NO: Take a look at GRUB or LILO (just to name two)

Second... Your language of choice
Basically you can write your os in just about any language.. ovbiously not ones like VB or PHP, but rather Assembly(asm), C, C++, Pascal, Fortran... etc
Generally people who want speed go for Assembly, people who aren't as enthusiastic about getting that intimate with the hardware tipically go for C and sometimes C++

A great compiler for C and C++ is GCC which I'm sure your familiar with but you can find a windows port under the name of DJGPP which you can find neatly packaged on the www.osdever.net download page.

And a good assembler is NASM, there is also MASM, and YASM

Third... Outlining your OS
You will want to figure out what type of kernel you would like, Monolithic, Microkernel, Exo-kernel, (Mac's Hybrid)... etc (Read through here for more info: http://mega-tokyo.com/osfaq2/)


Here are a few things you should read up on, kinda get your feet wet and write some notes, and draw some pictures to help conceptualize things :wink:
- IRQs/Interrupts - These are what you use to read data from devices attached to or within the computer (PIT, Mouse, Keyboard... etc)
- Memory Management - Accomplished through either Paging or Segmentation.
- Multitasking - If your serious about this, then you will want a memory manager, you can either go Preemptive or Cooperative
- File System support (allowing you to read data from a disk/disc), you could go for any one of the numerous file types, FAT, NTFS, EXT2... etc, but most people just start by implementing FAT

And as for your "lack of hardware" problem, um.. you could after you write and compile your code, pack that into an image and emulate your os with an emulator a good one that many of use use is Bochs http://www.bochs.sourceforge.net/

I hope that helps ya' out man, and good luck on your new adventure!

EDIT: I just realized I left one of your questions unanswered: As for your development OS the one you're writing your code on, Anything goes man... whatever your comfortable with, and linux is a great choice, there are a plethora of tools and documents for both DOW-WIN and Linux, however.. I think Mac is feeling a little left out.

Posted: Thu Aug 03, 2006 11:55 pm
by Daedalus
The OS you do your developing on is simply a matter of choice, in most cases.

The OS that you are creating will still be standard x86 machine code, regardless of what platform you use (though some header stuff and misc other details may be slightly different.)

For OS dev, I use Windows. My current layout is thus:
  • Editor: EditPlus (soon to be replaced when I restart my coding)
  • Emulator: Bochs (occasionally VMWare)
  • Compiler: DJGPP (GCC ported to DOS/Windows)
  • Other: WinImage, to put my kernel and apps onto disk and boot them in Bochs
It may be helpful to read over some example OS'. Chris Geise has some excellent example kernels, and lots of info on his OSD site.
I cheated (perhaps) a bit and based my OS on Chris' Borealis 11 OS.
I recommend the OSD example kernels first though, they're a great read and give you lots of good leads.

Good luck!

Posted: Fri Aug 04, 2006 7:55 am
by JAAman
nobody mentioned the intel manuals?
(there is a link in my signature)
these tell you everything you could ever want to know about the processor (and assembly language)

also:
A great compiler for C and C++ is GCC which I'm sure your familiar with but you can find a windows port under the name of DJGPP
DJGPP is not a windows port, it is a DOS port, and (for obvious reasons) is generally not recommended:

the windows port is called cygwin,

also if you use windows you could use MS VC++, or for linux, the Intel compiler (both of which are considered top performing compilers, and availible free) -- just to mention some less popular alternatives

Posted: Fri Aug 04, 2006 4:06 pm
by rexlunae
JAAman wrote:nobody mentioned the intel manuals?
It would be nice if we could have a link at the top of the page so you don't need to mention this in every thread.

Anyway, in response to the original question...

Before you select the tools and development environment, set some goals. Figure out what you are trying to accomplish. Find the features of other OSes that you like, and the ones you want to change. If your goal is to learn, figure out what you want to learn. These will impact your decisions like which language to use, which OS to start your development in, what code to write from scratch, and what to adapt from other sources.

It's hard to answer the question "How do I write an operating system." It's much easier to explore specific ideas.

Posted: Fri Aug 04, 2006 8:02 pm
by earlz
do you ever feel like your repeating yourself
"djgpp is much too unstable it has a layer of emulation which is never good..."
yes djgpp is just too unstable

I recommend Codeblocks(an ide) which includes all the cygwin toolset and gets it setup and everything for you easy
just goto http://codeblocks.org and download their latest release with cygwin

for a bootloader I use bootf02(look under downloads at osdever.net)

all of this info though is for if you are going for 32bit though if your a 16biter then turboc is good, though tasm is not free


btw
if you need an example codeblocks project file then try ripping off mine at my website(below) and download version 0.0.4(the latest uses a different booting address so...)

Posted: Sat Aug 05, 2006 10:01 am
by josephjah
JAAman wrote:
A great compiler for C and C++ is GCC which I'm sure your familiar with but you can find a windows port under the name of DJGPP
DJGPP is not a windows port, it is a DOS port, and (for obvious reasons) is generally not recommended:

the windows port is called cygwin,
Ok, my bad, lol :wink: