Page 1 of 1
need help compiling source
Posted: Mon Dec 09, 2002 7:33 pm
by beyondsociety
I need some help compiling my sources. I have four files that I need to link together and run. My code is set up like this:
Bootsector - > Second stage loader - > third stage - > c kernel.
I have tried compiling but it won't work. Can somebody give me a example on how to compile more than just two files. Any help would be appreciated.
By the way, I using the DJGPP port of gcc tools for Windows.
Re:need help compiling source
Posted: Mon Dec 09, 2002 9:19 pm
by jrfritz
Well:
gcc -c somefile.c -o somefile.o
nasm -f coff someasm.asm -o someasm.o
Look in my install.sh for LD and objectcopy commands. There are ports for object copy.
Re:need help compiling source
Posted: Mon Dec 09, 2002 10:04 pm
by beyondsociety
Tom, your install.h doesn't help me. I have a bootsector that loads my second stage loader. How would I compile them together? The second-stage loader loads into pmode and jumps to 0x1000. I then have another file load my c kernel.
I compiled my source but when I run it in bochs I get this error:
Code: Select all
00000237336i[BIOS ] FATAL: Not a bootable disk
00000237635p[BIOS ] >>PANIC<< BIOS panic at rombios.c, line 1550
This is how I am compiling my code:
Code: Select all
nasm -f aout -o mboot.o mboot.o
nasm -f aout -o mloader.o mloader.o
ld -Ttext=0x1000 --oformat binary -o boot.bin mboot.o mloader.o
gcc -ffreestanding -c kernel.c -o kernel.o
nasm -f aout load.asm -o load.o
ld -Ttext=0x1000 --oformat binary -o kernel32.bin kernel.o load.o
makeboot test.img boot.bin kernel32.bin
I have a feeling that I'm not compiling my code right. Can anybody help me.
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:52 am
by Berserk
Hi,
Why do you want to link them together??
And why the heck do you have a third stage loader?? You could've put it all in the Second Stage Loader!
Cya.
Re:need help compiling source
Posted: Tue Dec 10, 2002 11:41 am
by beyondsociety
Code: Select all
Why do you want to link them together??
I don't know what I was thinking. I actually only want to link the second-stage loader with the c kernel.
Code: Select all
And why the heck do you have a third stage loader?? You could've put it all in the Second Stage Loader!
I don't know what I was thinking. I will do that as it will save me some headache. Thanks for the help.
Re:need help compiling source
Posted: Tue Dec 10, 2002 11:45 am
by jrfritz
Here's what I did:
Bootloader, sets pmode, gdt, loads 2nd stage loader with C kernel.
2nd loader:
new bigger GDT with more power
externel functions
Kernel linked with 2nd loader:
Your stuff.
Re:need help compiling source
Posted: Tue Dec 10, 2002 11:46 am
by jrfritz
But a seperat 2nd stage loader and a 3rd linked with kernel gives you more flexibility, but causes more bugs and probs.
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:01 pm
by beyondsociety
I've already figured that out Tom ;D
If your not too busy, can you help me with objcopy?
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:06 pm
by jrfritz
Yea...how come the command line info in install.sh doesn't help? ( need to open it up with Wordpad...not notepad)
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:19 pm
by beyondsociety
Opening up your install.sh file in wordpad is no problem. What I don't understand is the different command-line options you are using.
I've tried to look at the gnu manuals and its like trying to pull gum out of your hair.
So your help would be appreciated.
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:30 pm
by beyondsociety
Sorry about that Tom. I figured out my problem. I'm at school right now, so I won't be able to test it till later.
If I still have problems, I send you a reply for help.
Re:need help compiling source
Posted: Tue Dec 10, 2002 12:36 pm
by jrfritz
I don't even know the options i'm typing in!
At least it just works for me...