Booting own kernel. How?

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
Storm.Xapek.de
Posts: 3
Joined: Tue Mar 07, 2006 12:00 am

Booting own kernel. How?

Post by Storm.Xapek.de »

First something about me:
- I'm from Germany
- My English sucks but I'm a nice gey :-)
- I'm using gentoo-linux
- I' programming C and C++
- Programming an OS is new for me

Now my question:

I tried to make my own OS (with a tutorial from your database), nothing big, for the first time I think something witch displayed "Hello World" and reboot.

Here's my code
kernel.asm

Code: Select all

[BITS 32]
mov byte [es:0xb8f9c],'H'
mov byte [es:0xb8f9e],'i'
retf
Then I compile and link the code
nasm -f aout -o kernel.o kernel.asm
ld -Ttext 0x100000 --oformat binary -o kernel.bin kernel.o
Is this right?
Is there an different between using aout and coff(coff doesn't work on my system, i don't know why)?

And how can I boot this kernel.bin?
I tried qemu, but didn't understand how it work.
Doing it with grub was my second idee but this is for me too much work.
Is there any better way?

Thanks for your help
Storm.Xapek.de
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: Booting own kernel. How?

Post by blackcatcoder »

Hi,

I'm from Austria ;-)

Now some words in german ;-) :

Ok, du ben?tigst noch zus?tzlich einen boot loader!
versuchs mal so !
wie ich sehe arbeitest du mit nasm also:



[ORG 07C00H]

start_up:
;f?ge hier deinen Programmteil ein

loop: jmp loop


times 510-($-$$) db 0
dw 0xAA55




nun ein paar Erkl?rungen!

1. Wenn der Pc bootet und diesen Teil hier ausf?hrt befindest du dich im sogenannten REAL-MODE hier must du mit 16-Bit gro?en Registern arbeiten!
Dazu kommt noch das der Speicher in Segmenten aufgeteilt ist!
Also w?rde ich vorschlagen du holst dir mal ein bischen Info ?ber REAL MODE und BIOS Interrupts!
2. Ein bootstrap ist immer 512 byte gro? ! Das bewirkt diese Zeile: times 510-($-$$) db 0
3. Damit der Pc erkennt das es sich um einen bootstrap handelt sieht er am Ende der Datei nach und sucht das: dw 0xAA55

Wenn du das obige Beispiel compilierst und zwar so:
nasm -f bin -o boot boot.asm

und nun ab damit auf ne diskette:
dd if=boot of=/dev/fd0

nun sollte der Pc oder in diesem Fall der Emu es ohne Probleme laden! Nat?rlich wirst du nichts sehen, daf?r empfehle ich dir das du dir den BIOS Interrupt f?r die String ausgabe heraussuchst!!

Falls du noch irgendwelche Fragen hast mail einfach an: [email protected]

Sorry, to all those who aren't able to understand this. But it was the easiest way to describe it to him!
Last edited by blackcatcoder on Tue Mar 07, 2006 12:00 am, edited 2 times in total.
Storm.Xapek.de
Posts: 3
Joined: Tue Mar 07, 2006 12:00 am

Re: Booting own kernel. How?

Post by Storm.Xapek.de »

Ich werde mich ?ber die genannten Dinge informieren,
fals ich dann noch hilfe ben?tige (und ich denke das werde ich :-))
post ich wieder oder schreib dir eine E-Mail.

Danke f?r deine Hilfe!
Thanks for your help!
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: Booting own kernel. How?

Post by blackcatcoder »

No prob!
neppramod
Posts: 1
Joined: Thu Mar 16, 2006 12:00 am

Re: Booting own kernel. How?

Post by neppramod »

i have booted the kernel and displays hello world,
i don't know what to do next
nepos
Posts: 3
Joined: Thu Mar 16, 2006 12:00 am

Re: Booting own kernel. How?

Post by nepos »

that great now you need to study Inel Mannual and try handle keyboard request.
nepos
Posts: 3
Joined: Thu Mar 16, 2006 12:00 am

Re: Booting own kernel. How?

Post by nepos »

that great now you need to study Intel Mannual and try handle keyboard request.
Post Reply