Making a kernel compiled by FPC Win32 bootable

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
erich
Posts: 2
Joined: Fri Aug 14, 2009 11:36 am

Making a kernel compiled by FPC Win32 bootable

Post by erich »

Hello,
I'm trying to get Wiki's pascal barebone to work. I'm using windows, I've done everything on wiki, then I downloaded grub&mkisofs and set up folders then made an ISO too. But when I try to run it I'm getting `invalid or unsupported executable format` error by grub. I've tried adding -b elf32-i386 option to linker but it gave `PE operations on NON-PE file` exception. But in fpc's parameters it's already specified to compile kernel.pas and others in ELF format... Any ideas?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Making a kernel compiled by FPC Win32 bootable

Post by egos »

Try to add multiboot header into your executable module.
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: Making a kernel compiled by FPC Win32 bootable

Post by f2 »

erich wrote:Hello,
I'm trying to get Wiki's pascal barebone to work. I'm using windows, I've done everything on wiki, then I downloaded grub&mkisofs and set up folders then made an ISO too. But when I try to run it I'm getting `invalid or unsupported executable format` error by grub. I've tried adding -b elf32-i386 option to linker but it gave `PE operations on NON-PE file` exception. But in fpc's parameters it's already specified to compile kernel.pas and others in ELF format... Any ideas?
FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.
Try to compile your own GCC for generating elf32 executables.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
erich
Posts: 2
Joined: Fri Aug 14, 2009 11:36 am

Re: Making a kernel compiled by FPC Win32 bootable

Post by erich »

Thanks for replies. Now, is there any easy to use bootloader that can handle my PE file?
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Re: Making a kernel compiled by FPC Win32 bootable

Post by Craze Frog »

Tommy wrote:
erich wrote:Hello,
I'm trying to get Wiki's pascal barebone to work. I'm using windows, I've done everything on wiki, then I downloaded grub&mkisofs and set up folders then made an ISO too. But when I try to run it I'm getting `invalid or unsupported executable format` error by grub. I've tried adding -b elf32-i386 option to linker but it gave `PE operations on NON-PE file` exception. But in fpc's parameters it's already specified to compile kernel.pas and others in ELF format... Any ideas?
FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.
Try to compile your own GCC for generating elf32 executables.
That is totally nonsense. FPC does not use GCC.

You need a new linker. The linker is not part of GCC, but rather binutils. See the wiki on how to build a cross toolchain (http://wiki.osdev.org/GCC_Cross-Compiler). Build and install binutils only (not GCC). This will give you a working GNU ld.
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: Making a kernel compiled by FPC Win32 bootable

Post by f2 »

Craze Frog wrote:
Tommy wrote:
erich wrote:Hello,
I'm trying to get Wiki's pascal barebone to work. I'm using windows, I've done everything on wiki, then I downloaded grub&mkisofs and set up folders then made an ISO too. But when I try to run it I'm getting `invalid or unsupported executable format` error by grub. I've tried adding -b elf32-i386 option to linker but it gave `PE operations on NON-PE file` exception. But in fpc's parameters it's already specified to compile kernel.pas and others in ELF format... Any ideas?
FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.
Try to compile your own GCC for generating elf32 executables.
That is totally nonsense. FPC does not use GCC.

You need a new linker. The linker is not part of GCC, but rather binutils. See the wiki on how to build a cross toolchain (http://wiki.osdev.org/GCC_Cross-Compiler). Build and install binutils only (not GCC). This will give you a working GNU ld.
Oops! :? Once again, I was pressed, and I've written anything!
I wanted to say "LD" instead of GCC. Sorry again!
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Making a kernel compiled by FPC Win32 bootable

Post by Kevin »

erich wrote:Thanks for replies. Now, is there any easy to use bootloader that can handle my PE file?
You should be able to use GRUB if you put the a.out kludge into your multiboot header. This means you need to add a few more fields like the entry point as GRUB cannot extract them from a binary format it doesn't know.
Developer of tyndur - community OS of Lowlevel (German)
Post Reply