Am i thinking along the right lines?

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
MatHenley
Posts: 2
Joined: Sat Mar 17, 2007 8:20 pm
Location: England

Am i thinking along the right lines?

Post by MatHenley »

Hello osdevers, Im new to OS Development and have been reading alot of articles about loading and running kernels from bootloaders etc... My goal is just to get a very simple kernel which does nothing except get stuck in a continues loop, loaded from my bootloader. Heres what i have made out from what i have been reading:


boot.asm assembled into boot.bin and placed in the first secor of a floppy disk
loads kernel.bin to a specific memory address.
jumps to the memory where the kernel has been loaded to.


loadKerenl.o assembled from loadKernel.asm
calls an externel function which is declared in kernel.c


kernel.o compiled from kernel.c
has the main function declared, which is called from loadKernel.

kernel.bin linked from loadKernel.o and kernel.o

Am i on the right line or am i completely off track?
Thank you for your time reading this post.
Technically, 0 is a statement, it returns, well, 0 :)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

sounds logical :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
MatHenley
Posts: 2
Joined: Sat Mar 17, 2007 8:20 pm
Location: England

Post by MatHenley »

Ok so i started, and managed to get my bootloader working but now im trying to mix asm with c. so i created both my asm file which calls the main function in the c file. I compiled the c file using gcc and assembled the asm file with nasm. Now when i try to link both files into kernel.bin i get this error message:

loadKernel.o: file not recognized: File format not recognized

Im guessing nasm has assembled my file in the wrong format, but im not to sure on how i could fix this. Anybody got any ideas?

thanks again :P
Technically, 0 is a statement, it returns, well, 0 :)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

nasm -f elf -o output.o file.asm
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply