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?
Making a kernel compiled by FPC Win32 bootable
Re: Making a kernel compiled by FPC Win32 bootable
Try to add multiboot header into your executable module.
If you have seen bad English in my words, tell me what's wrong, please.
- phredreeck
- Member
- Posts: 312
- Joined: Mon Jun 15, 2009 10:01 am
- Location: France
Re: Making a kernel compiled by FPC Win32 bootable
FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.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?
Try to compile your own GCC for generating elf32 executables.
Re: Making a kernel compiled by FPC Win32 bootable
Thanks for replies. Now, is there any easy to use bootloader that can handle my PE file?
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: Making a kernel compiled by FPC Win32 bootable
That is totally nonsense. FPC does not use GCC.Tommy wrote:FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.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?
Try to compile your own GCC for generating elf32 executables.
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.
- phredreeck
- Member
- Posts: 312
- Joined: Mon Jun 15, 2009 10:01 am
- Location: France
Re: Making a kernel compiled by FPC Win32 bootable
Oops!Craze Frog wrote:That is totally nonsense. FPC does not use GCC.Tommy wrote:FPC uses GCC as a backend, and the MinGW version of GCC is unable to create elf32 executables.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?
Try to compile your own GCC for generating elf32 executables.
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.

I wanted to say "LD" instead of GCC. Sorry again!
Re: Making a kernel compiled by FPC Win32 bootable
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.erich wrote:Thanks for replies. Now, is there any easy to use bootloader that can handle my PE file?