Friday, July 08, 2005

Requirements of OS Deving

Requirements for writing an operating system:
Ok. Let me get into the topic straight away. Today, we shall see, what are the software requirements for developing an OS.
First, decide which platform are you gonna use for your os deving. You can either choose Windows or Linux. Wide variety of tools are available in both platforms.
* Text editor - (I would recommend ConTEXT for windows users, good syntax highlighting and easy to use)
* Assembler NASM (Netwide ASeMbler), etc.If you are very well used to any other assemblers, you can use it. MASM, TASM and FASM are some other assemblers to mention. You will be required to write some part of your OS in assembly language, such as primary bootloader, which when written in other langages will take more than 512 bytes to fit in.
* C Compiler - GCC, etc.You can choose to write OS as a whole in x86 assembly language or by mixing some high level languages such as C and C++ with ASM. How to mix asm and C? That, I will explain you latter.
* Linker - ld, jloc, etc.If you are a good designer, you will be creating multiple files for your OS and compile it individually. At last, you will need a single file by linking all the compiled files. There's where a linker is used. A linker takes multiple input object files and finally gives you a single linked file. Linkers like ld, gives you the full freedom to specify code, data, etc. segments in the linked file through a special file called linker.ld.
* Cygwin or DJGPP [If you are deving in Windows]If you choose to use Linux command and other stuffs like gcc, ld in Windows, you will surely need Cygwin or DJGPP installed.
* partcopyFor windows users only. Linux users, don't worry. We have dd :-). Your primary loader needs to be written to the first 512 bytes of the floppy or harddisk image.
* Virtual floppy drive - VFD for windows users.Again linux users, dont' bother. I will explain you later how to mount your floppy or hard disk image using linux loop devices. When you coding hard, you will be required to write boot loader or your kernel file to your physical floppy drive to test it. This method has two disadvantages. First thing is, the number of floppies you are gonna spend. The second is, the time. Since disk drive accesses take more time, you have to wait some till it gets writed into the drive.
* And at last, an x86 machine simulator, if you choose x86 processor -BOCHS, etc.
Operating systems cannot be run like other application programs. You have to reboot your system everytime to see the results. Don't worry. Your fellow devers has made it easy. Simply, get the image of the floppy drive or hard disk (in which your files are residing) and give it to the bochs. Bochs will do the rest. It will show you the results that you will see in the real hardware. But, we cannot expect 100% accuracy. My suggestion would be to test your OS in the real system, at some regular check points, i.e., when you see a new functionality working in the BOCHS.

Note: Please, see the links for the above mentioned tools in the LINKS section of the LEXOS - main blog page.

Though, I have just now started my way in OS deving, I have given you the basic softwares that you will require. Finally, apart from software requirements, you will need lots of time for debugging itself and persistance, when you see your code doesn't work for a long time :-) Hope this will be helpful for beginners. Comments welcome.

- NOTNULL

No comments: