Tuesday, December 31, 2013

Warm up!!! (Day 2)


So its day two of the tutorial. I hope that you have completed the installation I had mentioned in the previous tutorials. Today's tutorial would more of reading stuff that matters.

Things you should know about before moving ahead (You just have to understand the basic definitions):

BIOS
BIOS stands for Basic Input/Output System. The BIOS is the firmware in the ROM (read only memory)  of a PC. When the computer is turned on, the BIOS is the first program that runs. All other programs must be loaded into RAM first. The task of a BIOS is to test and initialize the hardware and then it loads the bootloader or the operating system. The BIOS does the following:
  • POST (Power On Self Test).
  • It provides you with a START UP menu where you can set certain  parameters and lets you adjust the real time clock. Most modern BIOS versions let you set the boot order. The boot order is the order in which the bios checks for the devices which may contain the bootloader.For example If the first device in the boot order is USB and if you have a bootable pen-drive in your USB slot of your computer then it boots using the USB. If there was no USB then it will check the next device which can be hard disk.
  • The boot sector loader loads the first 512-byte sector from the boot disk into RAM and jumps to it (i.e. executes the program that was just loaded by it in the RAM). 
  • The BIOS interrupts. These are simple device drivers that programs can use to access the screen, the keyboard and disks. Boot loaders rely on them, most operating systems do not (the Linux kernel does not use BIOS interrupts once it has been started). MSDOS does use BIOS interrupts.
As far as boot loading facilities are concerned, the PC BIOS is very primitive compared to that of other computer systems. The only thing it knows about disks is how to load the first 512-byte sector.
  • The first sector of a diskette can be loaded at address 0000:7C00. The last two bytes of the sector are checked for the values 0x55 and 0xAA. If these are OK, the BIOS jumps to the address 0000:7C00.
  • Booting from a hard disk is very similar to booting from a diskette. The first sector of a hard disk (often called the Master Boot Record) is loaded at 0000:7C00 and next the BIOS jumps to it. The MBR program must move itself to an address that is different from 0000:7C00 as it is supposed to load a different boot sector from a partition to address 0000:7C00 and jump to that.
  • Modern BIOS versions can treat a certain file on a CD-ROM as a diskette image. They pretend to boot from a diskette by loading the first 512 bytes of the file to 0000:7C00 and jumping to it. Every attempt to access the same diskette using the BIOS routines, will be redirected to the image file on CD-ROM. Some other ways to boot a CD-ROM may also be supported (with an emulated hard disk or with no disk emulation at all).
Bootloader
The bootloader  loads the operating system in the ram and gives control to the OS(jumps to OS execution).

Also read about the following:

Sunday, December 29, 2013

Basics (Day 1)

Its time I should write a tutorial on OS development as I faced a lot of problems in trying to find out how to start OSDEVING. The subject is quite interesting, It will improve your Knowledge of C and OSDEVING  exponentially (provided you play around with the code).

###################################   Note     ##################################
#The tutorial is going to be in C. So knowledge of C is necessary. Its not very difficult to learn C. Just refer to C concepts wherever and whenever you don't understand certain part of the code.

#You need to have basic knowledge of ubuntu i.e. how things work! how to use terminal! etc. 
Including this (If you get time):- 
-Quora (this i like the most)

#I am using virtualbox to test my OS and development is being done on UBUNTU 12.04 LTS.
#To install ubuntu on your system follow this.
#To install virtualbox after installing ubuntu, run this command in terminal 
sudo apt-get install virtualbox
#A good code editor for c development is codeblocks.
sudo apt-get install codeblocks

#Obviously this tutorial is going to be very long tutorial as OS cannot be developed overnight. Hence the tutorials is going to be in parts.
#With time you will have to install other softwares. All the necessary instructions will be provided here.
To understand osdeving just don't copy-paste the code but play with it.  
#############################################################################

Thanks to OSDEV. Its a very good place to learn operating system development. 
The initial steps are to be followed from OSDEV Bare Bones Tutorial (very nicely explained). Still I'll help with the initial tutorial too but in the next part of this tutorial.
Before moving ahead please complete all the installation that are specified in the "Note" section above (installing ubuntu and virtualbox are necessary, at least for the sake of this tutorial).