Friday, January 14, 2011

Q : how to make a boot loader and how to run your compiled c program from bootable cd?

I am tring to find the answer of this question from about two years .This qestion hited my mind when I started to studie operation system as a subject
and now Im very close to my answer .

__-- the logic behind runing a c program without any O.S. is that when we compile a c program it generates a object file which is nothing othere than a machine instructions so the compiler convertes the high level language code to machine code which can run on a computer without any software platform (operationg system)

__-the object file is a bare machine code which our computer can understand directly though still if the machine code uses some system calls which are operating system dependent then that program will not run on a bare machine or will generate some errores .so we have to make shore that our program dont use any system call
for example in c language " system("dir"); " will use the system call " dir " and the program will not work without dos .

__-Now lets imagine that we have made a program which dont have any system calls and we have compiled it still we have to boot it from some bootable medium to run on a bare machin
and some software which allows us to write our program on the boot sectors of a medium(cd dvd floppy) . but wait google have told me that i have to use bootloader individully to run my program bootloader will load my program and will give all execution control to my program.

so you will need
-bootable cd(because floppys are not available in modern computers and some computers dont allow booting a pendrive we will use cd in this tutorial)

-A bootloader which will load our compiled program to ram and give it a execution control
-a software which allow us to write a bootloader in a boot sector of a cd
we have to do this with two steps
(1) make a bootable iso file (using "iso_master")
(2) check it whether it is working or not (using "VirtualBox")
(3) burn it (using "nero")

making a bootable iso file using iso master is trickkkkkkiiiii remaining is smoth
work . . .Im still tring to make a right iso file using iso master