Page 1 of 1

Booting kernel with grub

Posted: Mon Mar 30, 2009 4:17 am
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 !!

Re: Booting kernel with grub

Posted: Mon Mar 30, 2009 5:30 am
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.

Re: Booting kernel with grub

Posted: Mon Mar 30, 2009 7:37 am
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.

Re: Booting kernel with grub

Posted: Mon Mar 30, 2009 7:39 am
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.

Re: Booting kernel with grub

Posted: Mon Mar 30, 2009 7:49 am
by stanko51
ok, this totally makes sense.... sorry for the newbie's question.

Thank you!