Booting problem

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
itportal
Posts: 18
Joined: Tue May 18, 2010 1:34 am

Booting problem

Post by itportal »

Hello guys,

I have a simple kernel that boots and switches to protected mode. I test it on a real Pentium 4 system, where I boot from the 2nd hard drive. The thing is .. when I set the BIOS to first boot from this hard drive, the kernel seems to load but behaves strange - it has to print some welcome text, but actually prints some blinking squares. This comes for a second, after which the system resets.

When I choose the hard drive as a temporary boot device, the kernel loads fine, without any problems.
From three PCs I tested on, only this one makes this strange problem.

Can it be that the BIOS somehow returns wrong data and thus my 1st stage bootloader does not completely load my 2nd stage bootloader?

The kernel loads fine in Bochs too.
itportal
Posts: 18
Joined: Tue May 18, 2010 1:34 am

Re: Booting problem

Post by itportal »

I forced the bss section to be initialized with zeros and now it seems to work okay on all machines.
Obviously, variables initialized with 0, do not come in the .data section, but in .bss.

Conclusion: If your flat binary does not explicitly contain the .bss section, then do no assume that the memory will be initialized with zeros.
Post Reply