BetaArchive Logo
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 25d, 8h, 23m | CPU: 26% | MEM: 5984MB of 11022MB used
{The community for beta collectors}

Forum rules


Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it


Post new topic Reply to topic  [ 13 posts ] 
Author Message
 PostPost subject: Writing an operating system        Posted: Thu Nov 15, 2007 7:01 am 
Reply with quote
Donator
User avatar
Offline

Joined
Mon Feb 12, 2007 12:50 pm

Posts
973

Favourite OS
First Edition UNIX
I've been curious for a while about how one would go about writing an operating system. I've had some ideas (very basic), but I'm not sure that they're really correct.

What I'm wanting to do is write a very simple, yet functional, command line-driven operating system for use on any x86-compatible computer.

I'm not a particularly adept programmer, due to a lack of studying time, but I would like to get the ideas together for when I am capable of writing it.

What would a basic operating system require? I understand that I need a boot sector, a kernel, a command processor, a filing system, etc... but what makes these up?

Thanks.

_________________
Have a day.


Top  Profile
 PostPost subject:        Posted: Thu Nov 15, 2007 7:22 am 
Reply with quote
Donator
User avatar
Offline

Joined
Thu Aug 31, 2006 2:45 pm

Posts
1432

Location
UK

Favourite OS
Longhorn 4074
You realy have to know asm good. It would be good to know C/C#/C++ too. Oh and you need a lot of free time.
I would choose grub as a boot loader. Keep the kernel clean - i think it's better to have 25 well organised files than 3 big messed up.
This site may become helpful for you: http://www.osdev.org/ :)


Top  Profile  WWW
 PostPost subject:        Posted: Thu Nov 15, 2007 11:52 am 
Reply with quote
FTP Access
Offline

Joined
Thu Nov 01, 2007 2:29 pm

Posts
42
Check this also:
http://alexfru.chat.ru/epm.html
http://members.tripod.com/protected_mod ... mtuts.html

I don't want to put you down, believe me, but I do not recommend starting yet another project, that, sorry to say so, will probably finish as being not functional/incomplete/abandoned before it's ALPHA stage - nothing against the idea - mind you - but there are literally dozens of similar projects lying unfinished on internet sites.

You could make good use of your programming skills by joining FREEdos development or targeting (initially) a small chore so that it will have definitely some use.

Some ideas (projects that actually NEED a good ASM - lowlevel programmer):
1) USB stack for DOS and/or BIOS USB stck for grub4dos
2) Windows 3.x .vxd modding for new hardware
3) DOS UDF and EXT2/3 FS driver

jaclaz


Top  Profile
 PostPost subject:        Posted: Thu Nov 15, 2007 4:00 pm 
Reply with quote
Permanently Banned
Offline

Joined
Mon Dec 11, 2006 3:09 am

Posts
463
Do what Linux did, but do it right. Make a POSIX compliant OS. Create a modular hybrid kernel, with the basics, and then create drivers for ufs or zfs (sun has that opensourced i believe) (don't do ext2/3, there crap), generic display, text io, tcpip stack, agp/pci bus stack, etc.. and port some basic unix utilities to it (I recommend some form of sysinit, netbsd baseutils, gcc, bash for starters).


Top  Profile
 PostPost subject:        Posted: Fri Nov 16, 2007 1:25 am 
Reply with quote
Donator
Offline

Joined
Sat Aug 19, 2006 1:25 am

Posts
590

Location
Israel
I don't think the original poster is looking for ideas on what to make of his OS. I think he is asking where to begin. It looks as if he already has an idea of what's it's going to be like.

Writing an operating system isn't an easy task. You should make yourself familiar with the basics of how a computer works, how the different subsystems connect to each other on the most basic level, and how the different parts of your code will work together (e.g. how you intend to call a low-level assembly video driver from a high-level windowing routine).

I tried writing operating system on several occasions. The very first one was an attempt to squeeze a functional CLI-based OS into a single boot sector. The result was not very useful. It could only process single-character commands and mostly provided services for applications which, ironically, I never got around to writing.

Obviously, the first lesson I learned was that the first step in writing an OS (or any software, for that matter) is designing the different subsystems and the interfaces between them.

I'd say start with something basic. Write something that runs on top of DOS (but not entirely dependent on it, like early Windows releases), using DOS and BIOS services. When that part is working, gradually write replacements for the underlying DOS services, and later do the same for BIOS services, communicating directly with the hardware. Then, modify the basics and make it a protected mode OS. The end result will not be very useful, but will provide you with the necessary knowledge and experience to write a great OS from scratch.


Top  Profile
 PostPost subject:        Posted: Fri Nov 16, 2007 1:17 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Mon May 21, 2007 5:08 pm

Posts
192
Personally, I would write your OS in Qbasic...


Just kidding! This sounds really interesting, sounds like something I'd like to do one day...Alas, I only know Visual Basic, but I want to learn C/C#/C++ some day...


Top  Profile
 PostPost subject:        Posted: Tue Nov 27, 2007 5:21 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Wed Oct 24, 2007 12:21 am

Posts
2068

Location
Australia

Favourite OS
Neptune/Whistler2419/Linux Mint
why not do something usefull and join the reactos project, if you can code c# then these guys could use your help and in the process they would teach you everything there is to know about operating systems.


Top  Profile
 PostPost subject:        Posted: Sun Dec 23, 2007 5:59 pm 
Reply with quote
http://www.nondot.org/sabre/os/articles


Top
 PostPost subject:        Posted: Sun Dec 23, 2007 6:05 pm 
Reply with quote
Here can you download a Linux Kernel

http://www.kernel.org/


Top
 PostPost subject:        Posted: Sat Dec 29, 2007 4:29 pm 
Reply with quote
Please, take some advice from someone who's tried OSDEV before.

Don't :-P

Well, in all seriousness, OSDEV can be extremely rewarding. Just to get a 32-bit kernel loading is an achievement in and of itself. You'll need to have some basic assembly language skills for the low-level stuff like your bootsector, but the rest can be written in C, C++, or even Pascal. If you're daring enough and feel that you're proficient enough in assembly language, you can write your entire OS in assembly language. Whichever language you choose, you need to be very skilled in it before you expect to start.

Alot of the beginner tutorials you're gonna come across are going to tell you to start by making a simple real-mode kernel. Which is fine, since real-mode (16-bit, native mode of 8086, limited to 1MB of ram) is simple to use, you have access to the BIOS functions for I/O, and memory addressing is straightforward. However, don't get yourself stuck in this state of mind.

If you want your OS to go anywhere you'll need to modernize and learn protected mode (32-bit mode offered beginning on the 286 [16MB limit], and more fully on the 386 [4GB limit]). Protected mode offers features such as memory protection (hence the name), paging, virtual 8086 mode, a larger address space (up to 4GB on the 386), and virtual memory. The downside: you lose the pre-made BIOS interrupts for I/O. Which is probably a good thing, since you can do better :-)

Also, the key word here is PATIENCE. Rome wasn't built in a day and neither was Microsoft Windows. You will run into bug after bug that will make your entire kernel crash, but that's probably being caused by a misplaced colon or pound sign in your source code. Moments like this can have you on your knees, but like I said, you need patience for this type of thing. Should you accept this mission, and should you succeed, the results will be very rewarding.

Good luck and godspeed, soldier :-P

-512

PS: Don't use the Linux kernel as an example to learn off of...it's much too large and complex to use as a starting point...


Top
 PostPost subject:        Posted: Mon Dec 31, 2007 9:56 am 
Reply with quote
FTP Access
Offline

Joined
Mon Dec 24, 2007 6:07 pm

Posts
63
A missing point in your description is a memory manager (to handle malloc/free calls)

As an example, you can also check the loader of ReactOS

Boot sectors can be viewed here:
http://svn.reactos.org/viewcvs/reactos/trunk/reactos/boot/freeldr/bootsect/

And pass control to Freeldr, available at
http://svn.reactos.org/viewcvs/reactos/trunk/reactos/boot/freeldr/freeldr/

It can read (but not write) from ext2, fat12/16/32, iso and ntfs partitions.

Sources seem to be not too big, and you can maybe simply change it to a command line OS ;)

Rififi


Top  Profile
 PostPost subject:        Posted: Mon Dec 31, 2007 10:50 am 
Reply with quote
Donator
User avatar
Offline

Joined
Sat Jan 27, 2007 10:56 pm

Posts
600

Location
Vienna, Austria
Help us, we still need Ideas for the UI and functionality

we are actually coding an OS from scratch using asm and c++


Top  Profile  WWW
 PostPost subject:        Posted: Mon Dec 31, 2007 9:55 pm 
Reply with quote
Donator
Offline

Joined
Sat Aug 19, 2006 1:25 am

Posts
590

Location
Israel
512dev wrote:
If you want your OS to go anywhere you'll need to modernize and learn protected mode (32-bit mode offered beginning on the 286 [16MB limit], and more fully on the 386 [4GB limit]).

No matter what you do, stay away from 286's Protected Mode. Also, Long Mode (64-bit Protected Mode) is basically the same as 386's Protected Mode, but you get full access to the 16 EB of RAM, and you don't get vm86 (but you can run 32-bit tasks in an emulation mode similar to vm86).

512dev wrote:
The downside: you lose the pre-made BIOS interrupts for I/O. Which is probably a good thing, since you can do better :-)

BIOS interrupts can be called in protected mode using a vm86 task. It's nice to make a working kernel and only at a later stage replace the BIOS interrupt wrappers with real drivers (although, this can create interface inefficiencies).

BTW it's nice to see you again, 512dev.


Top  Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 




Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2018

 

Sitemap | XML | RSS