Simple concept Question ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Joe

Simple concept Question ?

Post by Joe »

ok, I am very new to OS development and am already planning to learn C and ASM
and eventually write my own OS, but for now I am only going for the basic concepts of os dev... so, heres my question - If I write a boot loader capable of loading a simple kernel could I create a small .bin executables and copy them to my OS-boot-disk and have them executed after the kernel has already been executed?... Sorry for the broad question but when it come down to it "I just Dont Know what to ask"  
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

RE: Simple concept Question ?

Post by bubach »

How do you meen?
If you have a bootsector-code that loads a kernel and then whants the kernel to load program.bin? In that case it´s best to have some sort of filesystem ready and that your kernel can handle starting a program, in other words give it memory and so on..

/ Christoffer
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
ASHLEY4

RE: Simple concept Question ?

Post by ASHLEY4 »

Hi,
Yes it can if you put the nessursery code in your kernel, for instance if you load a com file into memory and jump to the start address , this would run the com file and at the end of the programm you would need to return control back to the kernel.
  ASHLEY4
ezanahka

RE: Simple concept Question ?

Post by ezanahka »

So the bootloader loads the kernel. Does the bootloader load also those .bin files into memory or does the kernel do that? It is possible both ways.

It is perfectly possible to put the kernel running and then have it start up and run those .bin programs.

You can have a filesystem on the boot disk but that is not necessary. You can compile the bootloader's both stages, the kernel and the .bin programs so that each of them has a size which is some multiple of the block size (usually 512 bytes... at least on 1.44MB floppies) on the disk. Then create a single big binary file by concatenating the compiled binaries in the proper sequence (bootloader stage 1, bootloader stage 2, the kernel, .bin program 1, .bin program 2, etc.) and write it raw in the beginning of the disk (preferrably a floppy or a floppy image).

Running a program is nothing more than making a jump or a call to the program to be run unless your OS needs to do some set up before that.

I hope that this explains at least something.
Post Reply