Page 1 of 2

Starting with Linux, is it ok?

Posted: Sat Mar 17, 2007 12:57 am
by OSDevver
I want to start writing my OS, well do i start from Linux or anyother OS for staters like me. Also could anybody kindly tell where do i get a full Linux system coz when i visited www.kernel.org, and downloaded a 1.9kb file(well the link said something like"click here for the kernel" or so), also a kind request i want a graphical version.

P.S:just tell me which file in a OS source code should i refer to?I am blank

Posted: Sat Mar 17, 2007 2:22 am
by XCHG
I had a lot of problems starting to develop this OS that I am writing. Unfortunately, at first, it will be extremely hard to start realizing what is really going on. I should probably tell you that reading and looking at simple examples as a beginner is probably one of the best ways to learn the development of Operating Systems. I recommend the Koders website. You can go there and take a look at different OS codes. For a while, you should just be reading stuff and you wouldn't be able to code anything of any significance.

As per the Linux's source code, I believe there are plenty of websites that at least have the kernel code of the first version of the Linux OS. I would attach it to this post if I could find it.

Posted: Sat Mar 17, 2007 8:24 am
by muisei
You have downloaded patch.The kernel is here http://www.kernel.org/pub/linux/kernel/

Posted: Sat Mar 17, 2007 12:09 pm
by Brynet-Inc
muisei wrote:You have downloaded patch.The kernel is here http://www.kernel.org/pub/linux/kernel/
LoL that was funny 8)

I had a good laugh... :lol:

Linux is BIG

Posted: Sat Mar 17, 2007 12:40 pm
by anon19287473
Modern Linux is huge system, hardly a starting point. If you are using C, it may be helpful to mooch code from, provided your friendly w/ the gpl. You could try linux 0.1, its archived at kernel.org, but even that is pretty large and complicated for a biginners, like myself (I tried). You could try something like v2_os, if you are using ASM, GeekOS if you are using C.

Peace.

Re: Starting with Linux, is it ok?

Posted: Sun Mar 18, 2007 10:59 am
by Crazed123
OSDevver wrote:I want to start writing my OS, well do i start from Linux or anyother OS for staters like me. Also could anybody kindly tell where do i get a full Linux system coz when i visited www.kernel.org, and downloaded a 1.9kb file(well the link said something like"click here for the kernel" or so), also a kind request i want a graphical version.

P.S:just tell me which file in a OS source code should i refer to?I am blank
If:
1) You cannot make your actual request understood.
2) You can't navigate kernel.org and get yourself a kernel tarball, and
3) You think an OS is written by "stating" from "a full Linux system"/"a graphical version".

You should not be developing an operating system. Go mess around with programming for Windows, Linux, the BSDs, whatever for a few years. Learn a programming language, and learn it well. If English isn't your birth tongue, mistakes are expected, but this posting simply can't be understood. Improve your language skills (they help with programming, as well)!

Then come back here and ask a smart question.

Re: Starting with Linux, is it ok?

Posted: Sun Mar 18, 2007 11:02 am
by ehird
Linux Kernel: Graphical Version! It's like matrix code, except it's syntax-highlighted C.

Posted: Sun Mar 18, 2007 11:28 am
by salil_bhagurkar
Linux Kernel: Graphical Version! It's like matrix code, except it's syntax-highlighted C.
Do you mean to say that the code is hard to understand?

Posted: Sun Mar 18, 2007 11:45 am
by ehird
salil_bhagurkar wrote:
Linux Kernel: Graphical Version! It's like matrix code, except it's syntax-highlighted C.
Do you mean to say that the code is hard to understand?
No, but that would be Linus' official "graphical linux kernel", I just know it :P

Re: Starting with Linux, is it ok?

Posted: Fri Mar 23, 2007 12:38 am
by kernel64
OSDevver wrote:I want to start writing my OS, well do i start from Linux or anyother OS for staters like me. Also could anybody kindly tell where do i get a full Linux system coz when i visited www.kernel.org, and downloaded a 1.9kb file(well the link said something like"click here for the kernel" or so), also a kind request i want a graphical version.

P.S:just tell me which file in a OS source code should i refer to?I am blank
A full Linux system is a distribution, which contains all the extra software that you need to use Linux, because at kernel.org you will only get the kernel (well, there is a mirror of some distributions, but there are lots elsewhere) which by itself is not useful, unless you have been staring at hand-optimised and somewhat obfuscated system-level code for a good decade or so. :wink:

Anyway, I asked this same question myself of Alan Cox, an early Linux hacker who eventually ended up at RedHat, perhaps some ten years ago if I recall correctly. He told me Linux 0.1 was useless as a starting point to learn how to write a kernel. In retrospect I agree with that. I second the recommendations to start much, much smaller.

To begin writing an O/S (or even just a kernel), you will need to know a lot about the machine you will write your O/S for, and where to find hardware programming specifications, like the ATA/ATAPI spec for PATA disks, programming the keyboard, clock and things like that. Plus you must have the Intel CPU manuals on hand, assuming you want to target the x86 architecture. You must have a firm command of the C language because most O/S code worth learning from is written in C. You must also have a passing knowledge of x86 assembly language. You should understand pointers, and understand in a general sense PC (or whatever platform) architecture. For example the chipsets you will typically find in them and how they work together.

You should have a grasp of how to debug code, and know the difference between object code and linked executable code. You should know the different number representations like hexadecimal, binary, octal and decimal and know how to convert between them. You should be prepared to disassemble code and read a lot of hexadecimal and know what the difference between executable and data sections are in the various executable file formats.

You should read and understand a few books on O/S theory and concepts for the "big picture" before attempting to write code, like scheduling, memory management, file systems, multiprogramming, interprocess communication and a lot more.

If you've never written system level programs before, using just the kernel's API (the system calls like the bare read(), write(), open(), close(), etc.) then you should write lots of programs that exercise those functions and program just above the kernel level.

You should understand that you're on your own when writing a kernel, so there's no C library or any other library available unless you make one yourself and put it in your kernel. So the luxuries of printf() and so on are not available unless you write them yourself or "port" a C library to your kernel or O/S. Of course, you should be familiar about the difference between a kernel and an O/S.

Unfortunately, there's also a lot more, like bootstrapping or using an existing bootloader, what can happen if you have more than one processor on your system and how to deal with true parallel execution of processes or tasks, and you should know about interrupts, traps and exceptions.

I know this sounds daunting, but it will be extraordinarily difficult, if not impossible, to write an O/S without knowing (at least) these things and perhaps also having been at least a hobbyist programmer for five or more years.

I'm saying this because it's difficult to help if the poster doesn't give any background information on what they already know. If you're a beginning programmer and don't have any knowledge of computer architecture and interfacing with the hardware, you're staring down many years of hard work, sweat and blood. Don't let this discourage you: if you really want to write an O/S, you can get there, and all the years of learning and head banging will be worth it. But you need to be prepared for a long journey and don't let yourself be discouraged by failure after failure.

Having said that, once you have a knowledge of the environment you'll be programming in (you're on your own, without libraries and such, on "the bare metal") then you should start with tutorials like this one:

Bran's Kernel Development Tutorial

... and lots of others.

In summary: be familiar with already working systems, especially UNIX-like systems because they have smaller and somewhat more elegant APIs than Windows, don't try to design a new O/S without cloning part of one first (in my opinion), have the manuals for your architecture handy at all times, be very familiar with C, be somewhat familiar with assembly language, know the tools you will work with (compiler, assembler, linker, debugger, other utilities), know your environment (the bare metal), know the theory behind O/S's and a bit of history about them, know where to download specifications for standardised hardware, be familiar with pointers and little details like that, understand concurrent processing on one CPU and true parallel processing and how to deal with it (I still have problems here myself and I've been at O/S developing on and off for 10 years), know about executable file formats, booting, getting to the stage where you can run user programs, know about interrupts, traps and exceptions, memory management, file systems, and human-computer interaction (keyboard, the interface, such as a shell) and perhaps more.

I hope this doesn't put you off! :) But be prepared for hard work, and probably many years of it.

Posted: Mon Mar 26, 2007 11:51 am
by karampin
...
Having said that, once you have a knowledge of the environment you'll be programming in (you're on your own, without libraries and such, on "the bare metal") then you should start with tutorials like this one:

Bran's Kernel Development Tutorial

... and lots of others.
...
Hmm dead link. Please check it. I am currious to see this. :)

Posted: Mon Mar 26, 2007 12:17 pm
by ~
Wow! :o

Is the OSDever.net site dead? So fast??? I can't believe it!

If it never gets up again, it will be a truly painful loss!!!

Posted: Mon Mar 26, 2007 1:01 pm
by ehird
Just because a site's down, doesn't mean it's gone.

Posted: Mon Mar 26, 2007 1:06 pm
by ~
I had never seen it down since I knew it, that makes it more than a coincidence; maybe somebody knows how much time it has been like that...

Posted: Mon Mar 26, 2007 1:37 pm
by ehird
Suprise: Hosting companies suck

Suprise: Sites randomly go down

Suprise: Mostly, they come up again