Page 1 of 1
Can GRUB2 boot a flat-binary kernel?
Posted: Sun Mar 09, 2014 1:26 pm
by tuxid
Hello!
So, as you can see above, I'm wondering if GRUB2 can load/boot a flat-binary kernel.
At this time, I'm compiling my kernel as ELF, but I would like to compile it as flat-binary in the future.
So, can GRUB2 boot a flat-binary kernel?
If yes, how? (I already googled a lot, but couln'd find anything helpful)
So long,
tuxid.
Re: Can GRUB2 boot a flat-binary kernel?
Posted: Sun Mar 09, 2014 2:16 pm
by Combuster
tuxid wrote:But I would like to compile it as flat-binary in the future.
Care to explain why? You're probably making things more difficult for yourself than needed.
If yes, how?
It's called the a.out kludge.
Re: Can GRUB2 boot a flat-binary kernel?
Posted: Sun Mar 09, 2014 2:19 pm
by Rusky
Yes. Your flat-binary just needs the
multiboot header, 4-byte aligned in the first 8192 bytes of the file.
Although, flat-binary is kind of a pain since you don't get the benefits of an actual executable format (tools for examining the binary, bss section not stored as literal zeros in the file, easy access to debug symbols, virtual address space placement of sections).
Re: Can GRUB2 boot a flat-binary kernel?
Posted: Sun Mar 09, 2014 2:51 pm
by tuxid
Combuster wrote:Care to explain why? You're probably making things more difficult for yourself than needed.
Rusky wrote:Yes. Your flat-binary just needs the
multiboot header, 4-byte aligned in the first 8192 bytes of the file.
Although, flat-binary is kind of a pain since you don't get the benefits of an actual executable format (tools for examining the binary, bss section not stored as literal zeros in the file, easy access to debug symbols, virtual address space placement of sections).
Explaintion ist pretty simple, I'm just always searching for a challenge (one reason why I began to develop a OS) and/or other techniques to solve a problem, haha
But you guys got some good points, so I will stay with ELF in the future, as I got my kernel up & running with it.
(Maybe I'm going to switch to a flat-binary-kernel at a later point.)
@Rusky: Of course I got a multiboot header, also with the header adress-fields set. Got surely something wrong there.