64? 32? Grub having special issues? HELP!

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
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

64? 32? Grub having special issues? HELP!

Post 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!?! :evil:
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Re: 64? 32? Grub having special issues? HELP!

Post 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!?! :evil:
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
DracosX
Posts: 1
Joined: Fri Dec 22, 2006 1:10 am

Post 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.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post 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.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post 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 :lol:

thx!!
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Post 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 :lol:
You have to parse the elf64-specific fields, of course!

JJ
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

i am sorry, but I have absolutely no idea what that means. Could you explain please?
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post 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 :lol:

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.
User avatar
gaf
Member
Member
Posts: 349
Joined: Thu Oct 21, 2004 11:00 pm
Location: Munich, Germany

Post 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
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

Thanks, it works :D
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Post Reply