🔒 Locked
making a os
Advertisement
Original Post
Just out of curiosity what’s involved in making a OS for a 80x86 machine, nothing big, just typing some characters to the screen. 1) Can you use C++ or only C 2) Can you use standard ASCII header files or do you need to just write strait to key memory spots 3) How do you make it bootable
I'd like to hear some answers for this as well. I'm going to add some of my own questions though...
4) Is knowledge of ASM mandatory, and what percentage of the OS is written in ASM?
5) How/where is the OS tested? In WIndowsXP? By booting into the OS? In Linux?
6) Is there an operating system that is best for developing an OS on?
7) Any other thoughts you'd liek to share about OS development?
THanks :)
4) Is knowledge of ASM mandatory, and what percentage of the OS is written in ASM?
5) How/where is the OS tested? In WIndowsXP? By booting into the OS? In Linux?
6) Is there an operating system that is best for developing an OS on?
7) Any other thoughts you'd liek to share about OS development?
THanks :)
With my experiance in this subject I can tell you:
It is not something for someone with little or no experiance to attempt.
You will have to write your own drivers and bootloader.
You cannot use any standard library(as it is not supported by your OS unless you write it in)
ASM is manditory for a lot of things such as the boot loader.
You can boot it, or test it in Virtual Machines such as VMWare and Bochs.
You must use compilers that don't compile in OS specific stuff(straight GCC DJGPP and Cygwin work)
A good resource spot is osdever.net.
It is not something for someone with little or no experiance to attempt.
You will have to write your own drivers and bootloader.
You cannot use any standard library(as it is not supported by your OS unless you write it in)
ASM is manditory for a lot of things such as the boot loader.
You can boot it, or test it in Virtual Machines such as VMWare and Bochs.
You must use compilers that don't compile in OS specific stuff(straight GCC DJGPP and Cygwin work)
A good resource spot is osdever.net.
Quote:
Original post by Deranged
With my experiance in this subject I can tell you:
It is not something for someone with little or no experiance to attempt.
You will have to write your own drivers and bootloader.
You cannot use any standard library(as it is not supported by your OS unless you write it in)
ASM is manditory for a lot of things such as the boot loader.
You can boot it, or test it in Virtual Machines such as VMWare and Bochs.
You must use compilers that don't compile in OS specific stuff(straight GCC DJGPP and Cygwin work)
A good resource spot is osdever.net.
To make a propper OS you will need a good bit of experience under your belt, but there is no harm in making a basic hello world OS by following some tuts. In fact it can be quite educational.
And as for writing your own bootloader, GRUB is a much better choice if you are new to OS dev.
Quote:
Original post by stro Quote:
Original post by Deranged
With my experiance in this subject I can tell you:
It is not something for someone with little or no experiance to attempt.
You will have to write your own drivers and bootloader.
You cannot use any standard library(as it is not supported by your OS unless you write it in)
ASM is manditory for a lot of things such as the boot loader.
You can boot it, or test it in Virtual Machines such as VMWare and Bochs.
You must use compilers that don't compile in OS specific stuff(straight GCC DJGPP and Cygwin work)
A good resource spot is osdever.net.
To make a propper OS you will need a good bit of experience under your belt, but there is no harm in making a basic hello world OS by following some tuts. In fact it can be quite educational.
And as for writing your own bootloader, GRUB is a much better choice if you are new to OS dev.
I found writing a custom one a good experiance.
(So far it supports Booting, IDT, GDT, PIC, IRQ, IRQ safe Keyboard driver, VGA, a good start to a standard library, but I'm about to start a rewrite soon)
linky. Go over there, and you can find out how to do most anything. Anyways, you don't need any ASM if you download an already made bootloader. There is a nice one on the site I mentioned that boots the OS from a floppy. And you don't need VMware. Just download Bochs. Works nice.
EDIT: Fixed Link
EDIT: Fixed Link
How can you run anything if you don't have a file system? I.e. Games.
Quote:
Original post by ranakor
are there any c++ os frameworks? (something like a set of asm libs that support non driver specific stuff ie no io but at least vectors & such maybe wrote in full assembler) that you can just use from the boot?
No. Honestly I reccomend you don't get into this field just yet, it took me 2 years of learning to program before I could boot, and 3 before I could really do anything.
Quote:
Original post by ranakor
are there any c++ os frameworks? (something like a set of asm libs that support non driver specific stuff ie no io but at least vectors & such maybe wrote in full assembler) that you can just use from the boot?
Doubt it. Assembly languages vary from machine to machine. Maybe there's something like that for x86, tough I've never heard of it and it would have to take into account the different memory modes that the OSes want to support.
Quote:
Original post by Yosh
I'm surprised jumpjumpjump hasn't posted yet.
Anyway, I'm sure he can tell you how much you're thinking of undertaking.
Sir yes sir. [wink] Nah, I'm busy debugging my kernel right now, it's calling an Intel reserved exception. :x
First off, stray away from writing your own bootloader, you will never get any better than GNU grub.
Once you have your image of grub compiled(most people use grub 0.94-0.97), I use a patched version of 0.97 with splashimage and various other features.
Head over to osdever.net and http://oslib.codymays.net. On osdever.net follow Bran's Kernel Development Tutorial, as it's the best in the hobby osdev world right now.
Then read up on Volume 3: System Developers Manual from the intel manuals.
Asm isn't required, but will come in handy, because you will end up needing to debug it sometimes.
C++ requires adding some basic stuff to your linker script. You will not have new and delete until after you have a malloc and free.
If you have any questions, until I get the new osdever.net forums up, join #osdev irc.wyldryde.org and we can get you some help.
Quote:
Original post by Kaze
1) Can you use C++ or only C
You can use any language you like provided you can build a standalone executable with it (i.e. one which does not require *any* library to work).
The problem with using C++ is that you need to have a certain proportion of the C++ library implemented just to do *anything*.
It can certainly be done, but is more problematic.
The situation which springs to mind, is that you do something which implicitly creates a temporary object in free store, but you do this inside your memory management code. Allocating memory inside the memory allocator is a sure way to screw things up.
Using exceptions is probably a no-no (Unless you understand their implications).
Quote:
2) Can you use standard ASCII header files or do you need to just write strait to key memory spots
I'm not totally sure what "standard ascii header files" are, but I think it's safe to say that you can't use them.
An OS is a program which runs completely standalone. If you want to call a function you need to write it. There's no printf(), no strlen() and no malloc().
Quote:
3) How do you make it bootable
Get a bootloader someone else has written. Some will put the CPU in pmode for you, relocate your code to a predefined address (usually 0x1000000 or somewhere) and then jump into your entry point.
Of course at this point nothing is set up, hardware wise, interrupts will be disabled, and you'll need to start interrogating the hardware to do anything.
Quote:
4) Is knowledge of ASM mandatory, and what percentage of the OS is written in ASM?
Some knowledge of asm is beneficial. Very little of the OS is likely to be written in asm. The only bits that really require it are a few things setting up CPU-specific memory-mapping registers, and interrupt / syscall entry / exit I think.
Quote:
5) How/where is the OS tested? In WIndowsXP? By booting into the OS? In Linux?
You can't run the OS under another OS unless you use some sort of emulation (Bochs, dosbox) or virtualisation (vmware, Qemu, MSVPC) system.
Using virtualisation or emulation is usually the way to go. You'd typically load the kernel on to a virtual floppy disc, and have the emulator load from that.
Quote:
6) Is there an operating system that is best for developing an OS on?
Not really. It's entirely independent of any particular libraries. In principle you can use any compiler, provided it can output in the format you want (i.e. flat memory model, no libraries)
Mark
I'm a firm believer linux is easier to develop an OS on. Just because of the tools, none of the zealot crap. Cygwin would be worth the install, but the tools work better on linux in my oppinion. You definately need binutils(ld, ar, gcc, make, gas at least).
I prefure bochs and vmware to test on. Vmware the most because it has many kinds of hardware available to the virtual machine.
I prefure bochs and vmware to test on. Vmware the most because it has many kinds of hardware available to the virtual machine.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement