Booting kernel with grub

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
stanko51
Member
Member
Posts: 32
Joined: Fri Mar 27, 2009 6:58 pm

Booting kernel with grub

Post by stanko51 »

Hello,

I'm doing the Bare Bones tutorial but the kernel doesn't boot with grub. When i type "kernel 200+15" it returns error 13 : invalid or unsupported executable format.

I'm using cygwin in which i have built a gcc cross compiler (with the tutorial).

When I do objdump -h, i get "file format pei-i386". does this mean the executable is not ELF but PE ? shouldn't it be ELF because i compiled with the cross compiler ?

In the Questions part, it says "you should specify the AOUT kludge in the multiboot header". Could you give me more info on this ? what is it for and more importantly how to do this?

Also, is it possible to set up the cross compiler output format at ELF even with cygwin on windows ?

Thank you very much for your help !!
User avatar
JackScott
Member
Member
Posts: 1035
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Mastodon: https://aus.social/@jackscottau
Matrix: @JackScottAU:matrix.org
GitHub: https://github.com/JackScottAU
Contact:

Re: Booting kernel with grub

Post by JackScott »

It is indeed PE (or at least something that isn't ELF!)

Assuming you've built the cross-compiler correctly, make sure you are actually using it. Specify the full path in your Makefile or add /usr/cross/bin to your $PATH. Details on how to do that are in the cross-compiler tutorial.

You shouldn't need to use the a.out kludge if you have (and are using) a working i586-elf cross-compiler.
stanko51
Member
Member
Posts: 32
Joined: Fri Mar 27, 2009 6:58 pm

Re: Booting kernel with grub

Post by stanko51 »

Thank you for your reply !

I think I built the cross compiler correctly. I followed the exact tutorial step by step.

I have the i586-elf-gcc (and a i586-elf-gcc-3.4.4) in /usr/cross/bin. I'm not sure why there is those 2 executables.. Please see the attached picture, it's what i do on cygwin and apparently the kernel.bin isn't an elf file. What could i have done wrong during building the cross compiler?
screen.JPG
Edit : if i try with i586-elf-gcc-3.4.4 its the same.
Last edited by stanko51 on Mon Mar 30, 2009 7:40 am, edited 2 times in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Booting kernel with grub

Post by pcmattman »

You need to use your i586-elf-ld rather than Cygwin's ld. You'll also need to use i585-elf-objdump to view the ELF file when it gets created.

I'd also suggest doing

Code: Select all

export PATH=/usr/cross/bin:$PATH
So you can run just i586-elf-gcc instead of typing the path to it every time.
stanko51
Member
Member
Posts: 32
Joined: Fri Mar 27, 2009 6:58 pm

Re: Booting kernel with grub

Post by stanko51 »

ok, this totally makes sense.... sorry for the newbie's question.

Thank you!
Post Reply