Page 1 of 2

Where should I get started?

Posted: Fri May 04, 2012 7:52 pm
by iris
I'm not starting an operating system yet, but how can I practice programming that is similar to coding an operating system so I can be used to the assembly, the (in my opinion overused) preprocessor, and file systems. No code I have seen is like an operating system at all, and I just want to prepare myself to code.

Re: Where should I get started?

Posted: Fri May 04, 2012 7:55 pm
by NickJohnson
It sort of depends on what you already know. How much experience do you have with C/C++/whatever language you intend to write your OS in? The assembly pieces can be made pretty minimal, unless you want to write the whole thing in assembly.

Re: Where should I get started?

Posted: Fri May 04, 2012 7:57 pm
by iris
I am pretty decent with C++, I know about structs, classes, pointers, loops, reference, such stuff like that, and I am now learning STL.

Re: Where should I get started?

Posted: Fri May 04, 2012 8:40 pm
by NickJohnson
Well, the STL won't help you very much in a kernel environment, since you'd have to implement it yourself; otherwise, it sounds like you have a reasonable amount of C++ knowledge. I started my first OS when I had about a year of C experience, and was able to get at least some stuff working. The trickiest parts of kernel development are sort of idiosyncratic to kernel development, and depend as much on your ability to read complex hardware documentation as on your coding skill. You may not quite be ready yet, but the fact that you acknowledged that you might not be shows you are more sane than a lot of people who try.

I would personally recommend attempting this tutorial. It's pretty good, although it has many known bugs (mostly later on) and some pretty major design flaws. IMO, one of the more useful effects of following it is just getting a working development environment and a screen printing function. It uses C; if you want to use C++, you'll need some additional runtime support, which is explained on the wiki under C++ Barebones.

Re: Where should I get started?

Posted: Fri May 04, 2012 11:02 pm
by Rudster816
iris wrote:I am pretty decent with C++, I know about structs, classes, pointers, loops, reference, such stuff like that, and I am now learning STL.
Just from the way you described your knowledge, it sounds like you're still learning the basics. You can learn everything about C\C++ fairly quickly, but to get to a point where you're actually decent at using them is another thing entirely. When I look at the code I wrote when I was learning C++, pretty much everything about it makes me go "what the hell was I thinking?!". Even 3 years after beginning to learn C++ I can still find myself struggling to find ways to do things efficiently.

I'm not saying you should have X amount of experience before you think about writing an OS, but having a firm grasp on C is basically assumed by any material on the Wiki, as well as most other places. The more inexperienced you're, the buggier the code you write will be, which is a big issue when writing a kernel as debugging is much more difficult. You'll also have to be much more self sufficient, because finding help on kernel code is much more difficult than normal stuff.


There really is no harm in trying though. You might end up with nothing to show off, but you will learn A LOT if you apply yourself. If you're interested, I'd suggest reading through JameM's tutorial and see if you can keep up. If you understand it, than I'd setup an environment (Cygwin\Bochs\Qemu\GCC\etc) and see if you can get everything working. When I started OS development I had zero experience with the GNU toolchain, which made things extremely difficult for me. In retrospect, I'm glad I stuck through it though, because familiarity in the GNU toolchain has helped me a lot in other areas.

Whatever you do, good luck (you'll need it ;)).

Re: Where should I get started?

Posted: Sat May 05, 2012 6:29 am
by bubach
DOS programming is probably the best training for OS-dev. It's 16 bit which is perfect for the real mode Assembly bits needed in the boot loader, but you could also use C with a DOS extender to get more knowledge.

Re: Where should I get started?

Posted: Sun May 06, 2012 7:52 am
by iris
Yeah, I was planning on a DOS. I understand a lot so far, that bootloader executes kernel, kernel executes the features, or GUI if you have one.

Re: Where should I get started?

Posted: Sun May 06, 2012 8:20 am
by LindusSystem
You could try Brans Kernel Development Tutorial for its simplicity.If you are very very very very new to kernel development, brokernthorn osdevelopment tutorials will help you.If you want to a Unix or a Linux based kernel, JamesM will take a trip to x86 Unix Cloan.Also there are tutorials here too.

Re: Where should I get started?

Posted: Sun May 06, 2012 8:56 am
by iris
Before I start the tutorials, I just have one question. Should I run my DOS via partition? Or through a VB. Oh, and how do I install NASM through Ubuntu? Thanks.

~iris

Re: Where should I get started?

Posted: Sun May 06, 2012 9:25 am
by justin
iris wrote:Oh, and how do I install NASM through Ubuntu?
Type "sudo apt-get install nasm" at the command line.

Re: Where should I get started?

Posted: Sun May 06, 2012 12:23 pm
by bubach
berkus wrote:
iris wrote:Oh, and how do I install NASM through Ubuntu? Thanks.
sudo apt-get install yasm
That's one way of letting people know what you think about NASM. ;) I would personally recommend fasm, but yasm is "ok". 8)

Re: Where should I get started?

Posted: Sun May 06, 2012 12:44 pm
by bubach
hmm, i think there is some very small differences you might have to make, like use16/use32 and org 0x300 instead of [BITS 16]/[BITS 32] and [ORG 0x300] for example. but all in all, it took like 2 minutes to fix so nothing serious at all.
you might still argue that it's not good enough, but fasm has many other advantages, it's very easy to port, self assembling, small, very quick to add support for all the newest op-codes (some even before the cpu is released), very advanced macro support. btw, i would bet that there's macros out there to make it 100% nasm compatible.

Re: Where should I get started?

Posted: Sun May 06, 2012 6:19 pm
by iris
Thanks, I really thought I was going to use virtual box as a testing evironment, but bochs seems better.

Re: Where should I get started?

Posted: Wed May 23, 2012 6:12 pm
by iris
Are pointers used in OS design? I've been wondering, I'm assuming yes, of course, but just wanted to confirm. Also, what are some good IDE's?

Re: Where should I get started?

Posted: Wed May 23, 2012 7:14 pm
by AndrewAPrice
iris wrote:Are pointers used in OS design? I've been wondering, I'm assuming yes, of course, but just wanted to confirm.
The definition of a pointer:
Wikipedia wrote:In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address
At some point in your OS you'll have to access various locations in memory - so pointers are required.
iris wrote:Also, what are some good IDE's?
Eclipse, NetBeans, Emacs, Vim, Visual Studio, CodeBlocks, UltraEdit, KDevelop, the list goes on..