some booting questions

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
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

some booting questions

Post by Neo »

Will the boot-loader code be of any use later on after it loads the secondary/kernel. If not then why do most people say that the bootloader code should be relocated in memory to prevent overwriting?
Any insights on this will be appreciated.Also why does evrybody use a JUMP instruction followed by a NOP at the start of the bootloader? is the NOP required?
Only Human
Chase

RE:some booting questions

Post by Chase »

It depends on how you write it. There is no reason it has to stay in memory.

The jmp followed by a nop is required by some bioses. Basiscally when a bios looks for a valid boot device some just check to see if a sector can be read, some look for dw 0xAA55 at the end of the sector and some look for the jmp/nop combo.

-Chase
rexlunae

RE:some booting questions

Post by rexlunae »

The reason it is often relocated is to prevent the kernel or next stage of a bootloader from overwritting it while it is still running.  The BIOS load address is 0x7c00, and a lot of kernels like to be at address 0, so if the kernel is larger than 0x7c00 bytes, it would overwrite the bootloader.

A better solution for many people is probably to load the kernel above 1mb (or anywhere above the bootloader).
pepito

RE:some booting questions

Post by pepito »

Yes, a had this problem when I tried to load my kernel at 0x1000. First, all worked very well, then my kernel grew and one day my OS failed. I spent many hours to discover the problem, and was this!

pepito
Post Reply