OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 3:06 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Link the Kernel
PostPosted: Wed Feb 20, 2002 2:09 am 
I use cygwin and compile so :

nasmw -o start.o -f elf start.asm
gcc -o kernel.o -c kernel.c
ld -T kernel.ls --oformat=elf32-i386 start.o kernel.o -o kernel

and I get the fault :

PE operations on non PE file

what is incorrect?

sorry for my bad english


Top
  
 
 Post subject: Re: Link the Kernel
PostPosted: Wed Feb 20, 2002 7:41 am 
I also had this problem and i couldn't find any solution under cygwin.
It seems that you must build ld by yourself.

I skipped this problem using DJGPP.

LD accepts scripts under DJGPP.
But take care, you must compile using gcc provided with DJGPP.

If you compile with Cygwin and link with DJGPP, adresses in the kernel won't be good.

ROSWELL

Sorry for my english  I'm french.


Top
  
 
 Post subject: Re: Link the Kernel
PostPosted: Wed Feb 20, 2002 8:39 am 
Can you tell me how to it DJGPP? I don't have the slightest clue how to tell that gcc to compile in elf, all it gives me is a a.out and the exe ...


Top
  
 
 Post subject: Re: Link the Kernel
PostPosted: Wed Feb 20, 2002 10:20 am 
Do what? Link a kernel? Take a look at the "my suggestions" tutorial under the Docs and Tutorials section at my website. And as soon as I get the Memory Managment 1 up and the Getting Started tutorial up, I'll write a tutorial on using DJGPP and LD for OS Dev(it'll cover linking a kernel).

K.J.


Top
  
 
 Post subject: Re: Link the Kernel
PostPosted: Wed Feb 20, 2002 4:11 pm 
>...
>PE operations on non PE file
>...

Another bug in CygWin/MinGW32.

Try making a PE file, then use objcopy to convert to ELF.

ld -T kernel.ls --oformat=pei-i386 start.o kernel.o -o kernel.pe
objcopy -O elf32-i386 kernel.pe kernel.elf

If you use the GRUB bootloader with the "aout kludge", the kernel can be _any_ file format: ELF, PE, binary, whatever.
So you can use the "native" file format of the compiler.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], Majestic-12 [Bot] and 150 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