Page 1 of 1
Link the Kernel
Posted: Wed Feb 20, 2002 2:09 am
by Christian Neubert
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
Re: Link the Kernel
Posted: Wed Feb 20, 2002 7:41 am
by roswell
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.
Re: Link the Kernel
Posted: Wed Feb 20, 2002 8:39 am
by The Legend
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 ...
Re: Link the Kernel
Posted: Wed Feb 20, 2002 10:20 am
by K.J.
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.
Re: Link the Kernel
Posted: Wed Feb 20, 2002 4:11 pm
by Chris Giese
>...
>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.