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
Link the Kernel
Re: Link the Kernel
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.
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
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
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.
K.J.
Re: Link the Kernel
>...
>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.
>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.