Not Booting Correctly.. If at all..

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
AvengerX

Not Booting Correctly.. If at all..

Post by AvengerX »

Alright, I am using a boot loader and a kernel, of course, but before the kernel loads (or maybe it's the kernel) the system resets, the boot sector i am using anabled a20, does the stuff to enter protected mode, i have a 32 bit kernel, but i think my boot loader is the problem because i tried a pre-compiled kernel (fritzos) and it still rebooted, how can i find out where the problem is (oh, and when i compile FritzOS (prekernel 0.5) it doesnt work (it compiled but doesnt boot) but when i use the precompiled version it works just fine)
Mr_Spam

Re:Not Booting Correctly.. If at all..

Post by Mr_Spam »

I never got FritzOS to work for the same reason. What I do to find a problem since i dont have any IO yet, is place infinate loops in strategic locations to find out which instruction is not working. if it dosn't reset, the instructions before the loop aren't causeing the reset.
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

ok, i have switched to bootf02 bootstrap and one of the example kernels it came with and it still does not work, (i DID compile it myself, again.. i dont see what's up with it...) thanks for the tip..
Mr_Spam

Re:Not Booting Correctly.. If at all..

Post by Mr_Spam »

at which instruction is it resetting? That would narrow down the possabilities of what could be wrong.
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

alright, i haven't tried it, but i noticed: if i us the precompiled versions of BOotf02 (bootstrap and kernel) it works perfectly, if i replace any of the bootstrap or kernel with my compiled versions it doesnt work. it might be because i am not using jloc like it told me to, but what can i do? i am using linux, i cannot use jloc (maybe thats why in the clean version i see alot of 007c's and in mine i see 0000's (hexeditor)... ???
mr. xsism

Re:Not Booting Correctly.. If at all..

Post by mr. xsism »

Well, in that case it has to be your build utilities. What do you use? jloc? ehat compiler? Try using gcc and ld. Then code your own btldr. That way you should know what is hjappening since it it ur code :) U can't learn by stealing other peeps code :)
---
remember what tom said, debug the code:
startby just making sure the btldr works ie-stick a 'hlt' right after in jumps in. Then move on from there until it crashes. It is all a process of elimination :)


Regards,
Mr. xsism
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

I use gcc and ld (along with nasm).. and i didnt steal the code.

gcc 2.95.4 20011002 (Debian prerelease)
ld 2.12.90.0.1 20020307 Debian/GNU Linux
nasm 0.98.08 (soon upgrading to 0.98.34-1)
Therx

Re:Not Booting Correctly.. If at all..

Post by Therx »

I know a bit abuot Bootf02

You need to compile the bootloader to an object file and then link it to start at 0x7C00.

You then must compile the kernel and link it to 0x100000.

Therx

PS Beware if you experience problems with accessing memory later and are still using the Bootf02 boot sector it will be because Bootf02 enables paging. If you want to redo this your self you just need to remove a couple of the lines of code (I made this error :-[)
Mr_Spam

Re:Not Booting Correctly.. If at all..

Post by Mr_Spam »

ha! my boot sector isn't working now and i havn't touched it! I'v only been working on my kernel! grrrrr. its the jump to set CS right after the switch to Pmode thats reseting it. so fustrating!
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

Ok, it's just the bootsector that has a problem, and i cannot get NASM to make an object file (i get it to make a .o OR a .obj and ld doesnt understand it...) well.. it understands the .o but it creates a file MUCH larger than 512 bytes.. i am MOSTLY sure that i am using --oformat binary, if not then that may be my problem with the large file...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Not Booting Correctly.. If at all..

Post by Pype.Clicker »

iirc, the argument for nasm is -fbinary.
Your .o is too big because it has symbol table, relocations, etc.
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

Ok, it works fine now.. i did

nasm -f aout -o obj/boot.o boot.asm
ld --oformat binary -Ttext 0x7c00 -o boot.bin obj/boot.o

and it worked (except some bytes were switched, i corrected them with a hexeditor and it works great..) thanks for the help guys
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Not Booting Correctly.. If at all..

Post by Pype.Clicker »

err ... i'm afraid you'll find it hard to boot with this ... LD is a 32 bits linker and boot code is 16bits... expect to encounter weird situations ...
AvengerX

Re:Not Booting Correctly.. If at all..

Post by AvengerX »

Well, it's worked fine as of yet, boots the kernel just fine, everything, does it matter that i have the use16 or [bits 16] in there, does that do anything at all?
Mr_Spam

Re:Not Booting Correctly.. If at all..

Post by Mr_Spam »

if it works, go for it! but as you edit it, and improve your OS and boot sector, you very well may run into problems.
Post Reply