Page 1 of 1
64? 32? Grub having special issues? HELP!
Posted: Thu Dec 21, 2006 8:11 pm
by piranha
I was working on my OS for a while, but then I updated my system to 64 bit.
Now when I load grub and select my OS, it says Unrecognized File Format. WHAT IS GOING ON HERE!?!
Re: 64? 32? Grub having special issues? HELP!
Posted: Fri Dec 22, 2006 12:18 am
by JJeronimo
piranha wrote:I was working on my OS for a while, but then I updated my system to 64 bit.
Now when I load grub and select my OS, it says Unrecognized File Format. WHAT IS GOING ON HERE!?!
I don't know how GRUB works on x86-64, but my guess is that it tries to find the ELF headers for 64-bits executables, since it detects the presence of a 64-bit CPU...
But I have no idea of the operating environment after booting a multiboot kernel on a x86-64... does it start directly in long mode?
Doesn't look like a good idea because of the backwards compatibility...
JJ
Posted: Fri Dec 22, 2006 1:13 am
by DracosX
GRUB (at least the current version of it) does not support elf64 multiboot images; in fact the current multiboot standard states that it is intended for 32-bit kernels.
With that being said, nothing prevents you from creating a 32-bit "loader" kernel that simply loads your 64-bit kernel into memory, sets up long mode, and jumps into your 64-bit code. For that matter, you could pass your 64-bit kernel as a module.
Posted: Fri Dec 22, 2006 11:00 am
by Candy
My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
Posted: Fri Dec 22, 2006 6:55 pm
by piranha
My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
thx!!
Posted: Fri Dec 22, 2006 7:57 pm
by JJeronimo
piranha wrote:
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
You have to parse the elf64-specific fields, of course!
JJ
Posted: Sat Dec 23, 2006 12:14 am
by piranha
i am sorry, but I have absolutely no idea what that means. Could you explain please?
Posted: Sat Dec 23, 2006 4:32 am
by Candy
piranha wrote:My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
thx!!
http://atlantisos.svn.sourceforge.net/v ... oot/setup/
The idea is, the boot loader (directory above this) loads all the files and such, then switches into the right mode (so the long mode switch is in that directory too), and then passes control to this code. This code loads an elf file of the type of which it itself is compiled.
Posted: Sat Dec 23, 2006 11:08 am
by gaf
As far as I know grub 2 will eventually support 64bit operating systems. You could try if the current built already implements this feature (
link).
regards,
gaf
Posted: Sat Dec 23, 2006 11:16 am
by piranha
Thanks, it works