[SOLVED]C Kernel can't be loaded using GRUB (Error 13)

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.
mike20123
Posts: 15
Joined: Sat Aug 13, 2011 3:18 pm

Re: C Kernel can't be loaded using GRUB (Error 13)

Post by mike20123 »

hi "XenOS"
i just want to know one thing
i want to know where does the problem come from ?
is it the code ,linker script or compiler?
that all i want to know
Haroogan
Member
Member
Posts: 28
Joined: Thu Aug 04, 2011 1:10 pm

Re: C Kernel can't be loaded using GRUB (Error 13)

Post by Haroogan »

To allocate your kernel properly in RAM and start executing it, GRUB needs your kernel to be in specific format, like ELF or PE and etc. Which one you choose it up to you.

If you want to stick with PE format (which is produced by linker) then you do NOT have to create Cross Compiler. Why? Because MinGW is the GCC port to Windows. So Windows is MinGW's target platform. That is why MinGW's linker will ALWAYS produce PE format as an output. (That's why OUTPUT_FORMAT(elf32-i386) will NEVER work on MinGW) So the only thing you have to do is to configure GRUB, so that it will be informed that your kernel is in PE format. You have been told in the previous posts how to set up flags for GRUB to do this.

If you would like to stick with ELF format then you will have to build your own Cross Compiler. The idea of Cross Compiler is that when you build it (i. e. compile it from the source codes) - you specify the TARGET platform. Remember that MinGW's target platform is Windows? Yeah, that's why MinGW produces PE format. But when you will build your Cross Compiler - you will tell that you want your Cross Compiler to produce ELF format.

Basically that's all. You have 2 options.
mike20123
Posts: 15
Joined: Sat Aug 13, 2011 3:18 pm

Re: C Kernel can't be loaded using GRUB (Error 13)

Post by mike20123 »

Thank you Guys it Works !!!!!! =D> :lol: :mrgreen: :roll:
------------------------------------
for other devolopers who had the same problem:-
the corrected files are in the attachment for other OS devolopers
the Kernel is in PE format.
Corrected Files.rar
(52.88 KiB) Downloaded 93 times
----------------------------------
Thank You XenOS
Thank You Haroogan
Thank You egos
Thank You combuster
Post Reply