OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:01 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: need help compiling source
PostPosted: Mon Dec 09, 2002 7:33 pm 
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Mon Dec 09, 2002 9:19 pm 
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Mon Dec 09, 2002 10:04 pm 
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:
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:
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:52 am 
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 11:41 am 
Code:
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:
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 11:45 am 
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 11:46 am 
But a seperat 2nd stage loader and a 3rd linked with kernel gives you more flexibility, but causes more bugs and probs.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:01 pm 
I've already figured that out Tom ;D

If your not too busy, can you help me with objcopy?


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:06 pm 
Yea...how come the command line info in install.sh doesn't help? ( need to open it up with Wordpad...not notepad)


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:19 pm 
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.


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:30 pm 
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. ;)


Top
  
 
 Post subject: Re:need help compiling source
PostPosted: Tue Dec 10, 2002 12:36 pm 
I don't even know the options i'm typing in!

At least it just works for me...


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 38 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group