Skip to contentSkip to conversation

x86_64 EFI support for grub2 ?

DISCUSSION Bean 5 participants 20 messages May 25, 2008 – May 28, 2008

lore
Share & tools
lore

Bean

author
#0 lore raw

Hi,

I just wonder if anybody is working on x86_64 EFI support ? If none, I'd like to add it soon, as it's essential for grub2 to work with Apple's 64-bit Intel Mac.

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Signature · 1 line
Bean
#1 lore raw
Quoted 5 lines · Bean

Hi,

I just wonder if anybody is working on x86_64 EFI support ? If none, I'd like to add it soon, as it's essential for grub2 to work with Apple's 64-bit Intel Mac.

not me, but I'll help you test it, as I have one of those machines (currently I'm using a nearly-a-year-old CVS version of grub2 in Apple's emulated BIOS mode, rather than using the EFI support which didn't work for me at the time). Is it essential -- or does building an x86 EFI binary work just as well?
(oh, since I'm running a 32-bit Linux on my 64-bit machine right now, I'm not sure if I'll actually be a useful tester?)

Quoted 3 lines

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Is its license sufficiently compatible? Is it maintained sufficiently (or else, can we take on some of the maintainership burden?)

-Isaac

author
#2 lore raw
Quoted 8 lines · Isaac Dupree
Quoted 6 lines · Bean

Hi,

I just wonder if anybody is working on x86_64 EFI support ? If none, I'd like to add it soon, as it's essential for grub2 to work with Apple's 64-bit Intel Mac.

Quoted 7 lines

not me, but I'll help you test it, as I have one of those machines (currently I'm using a nearly-a-year-old CVS version of grub2 in Apple's emulated BIOS mode, rather than using the EFI support which didn't work for me at the time).
Is it essential -- or does building an x86 EFI binary work just as well? (oh, since I'm running a 32-bit Linux on my 64-bit machine right now, I'm not sure if I'll actually be a useful tester?)

I have tried the old ia32 image created by grub-mkimage, it doesn't work, neither does the old refit (<0.10). New refit create fat image containing both ia32 and x86_64, it works, but don't know how compatible it is in non Apple firmware. I also write a pure x86_64 sample, it works as well.

Quoted 7 lines
Quoted 4 lines

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Is its license sufficiently compatible? Is it maintained sufficiently (or else, can we take on some of the maintainership burden?)

I'm no expert on license, but it's a shared library, we only need to use its interface, I guess this should be ok.

Signature · 1 line
Bean
#3 lore raw
Quoted 8 lines · Bean
Quoted 5 lines
Quoted 3 lines

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Is its license sufficiently compatible? Is it maintained sufficiently (or else, can we take on some of the maintainership burden?)

I'm no expert on license, but it's a shared library, we only need to use its interface, I guess this should be ok.

if it's GPL version 2 (but not 3) then it's probably incompatible, for example, if it's shared library.

#4 lore raw
Quoted 4 lines · Isaac Dupree
Quoted 3 lines · Bean
Quoted 3 lines
Quoted 3 lines

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is its license sufficiently compatible? Is it maintained sufficiently (or else, can we take on some of the maintainership burden?)

I'm no expert on license, but it's a shared library, we only need to use its interface, I guess this should be ok.

if it's GPL version 2 (but not 3) then it's probably incompatible, for example, if it's shared library.

gnu-efi is licensed under GPL 2 or later. There's no problem linking GRUB with it.

Thourhg, if it's just a binary file converter license compatibility would probably not be required anyway.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
author
#5 lore raw
In reply to Isaac Dupree
Quoted 2 lines · Isaac Dupree

(oh, since I'm running a 32-bit Linux on my 64-bit machine right now, I'm not sure if I'll actually be a useful tester?)

BTW, it's really easy to test efi image with the latest refit. Just install refit 0.11 in OS X, and it would be used as the default boot manager. Then, copy an efi image to / or /efi/xxxx/ of any fat/ext2/ext3/hfs+/reiserfs partition (remember to install the fs module, though), and it show up automatically in the boot menu.

You can verify it with refit 0.9 which use ia32 image. Download the binary package, extract refit.efi to the root directory, and it should be in the menu. When you choose it, it would say unsupported image.

Signature · 1 line
Bean
#6 lore raw
Quoted 11 lines · Bean
Quoted 2 lines · Isaac Dupree

(oh, since I'm running a 32-bit Linux on my 64-bit machine right now, I'm not sure if I'll actually be a useful tester?)

BTW, it's really easy to test efi image with the latest refit. Just install refit 0.11 in OS X, and it would be used as the default boot manager. Then, copy an efi image to / or /efi/xxxx/ of any fat/ext2/ext3/hfs+/reiserfs partition (remember to install the fs module, though), and it show up automatically in the boot menu.

Quoted 3 lines

You can verify it with refit 0.9 which use ia32 image. Download the binary package, extract refit.efi to the root directory, and it should be in the menu. When you choose it, it would say unsupported image.

(refit 0.9 worked for me in OSX, I don't remember whether I'm using 0.9 or 0.10 right now)

But I'm sure I was building an ia32 grub2, and refit quite happily loaded that image -- it was just was in grub2 "rescue mode" for that old efi grub2.

And I meant that if I had to compile anything grub2, I wasn't sure if a 32bit Linux could make a 64bit grub efi image.. but if you can make the image, then no problem at all!

-Isaac

author
#7 lore raw
Quoted 18 lines · Isaac Dupree
Quoted 13 lines · Bean
Quoted 3 lines · Isaac Dupree

(oh, since I'm running a 32-bit Linux on my 64-bit machine right now, I'm not sure if I'll actually be a useful tester?)

BTW, it's really easy to test efi image with the latest refit. Just install refit 0.11 in OS X, and it would be used as the default boot manager. Then, copy an efi image to / or /efi/xxxx/ of any fat/ext2/ext3/hfs+/reiserfs partition (remember to install the fs module, though), and it show up automatically in the boot menu.

Quoted 3 lines

You can verify it with refit 0.9 which use ia32 image. Download the binary package, extract refit.efi to the root directory, and it should be in the menu. When you choose it, it would say unsupported image.

Quoted 5 lines

(refit 0.9 worked for me in OSX, I don't remember whether I'm using 0.9 or 0.10 right now)

But I'm sure I was building an ia32 grub2, and refit quite happily loaded that image -- it was just was in grub2 "rescue mode" for that old efi grub2.

Oh, you're lucky, the ia32 image doesn't work for me. Perhaps apple change the firmware for the new modals.

Quoted 4 lines

And I meant that if I had to compile anything grub2, I wasn't sure if a 32bit Linux could make a 64bit grub efi image.. but if you can make the image, then no problem at all!

With the cross compilation tool, it's possible to create 64bit image in 32bit environment. In debian, all you need to do is install the grub-multilib package and use the -m64 compile option in gcc.

Signature · 1 line
Bean
#8 lore raw
Quoted 7 lines · Bean
Quoted 3 lines

And I meant that if I had to compile anything grub2, I wasn't sure if a 32bit Linux could make a 64bit grub efi image.. but if you can make the image, then no problem at all!

With the cross compilation tool, it's possible to create 64bit image in 32bit environment. In debian, all you need to do is install the grub-multilib package and use the -m64 compile option in gcc.

I'm using Ubuntu (the newest version, Hardy 8.04). Perhaps you meant gcc-multilib?

-Isaac

author
#9 lore raw
Quoted 6 lines · Isaac Dupree
Quoted 5 lines · Bean
Quoted 4 lines

And I meant that if I had to compile anything grub2, I wasn't sure if a 32bit Linux could make a 64bit grub efi image.. but if you can make the image, then no problem at all!

Quoted 6 lines
Quoted 3 lines

With the cross compilation tool, it's possible to create 64bit image in 32bit environment. In debian, all you need to do is install the grub-multilib package and use the -m64 compile option in gcc.

I'm using Ubuntu (the newest version, Hardy 8.04). Perhaps you meant gcc-multilib?

Oh yep, some typo.

BTW, you can check out the firmware info in "About rEFIt" icon in the refit boot menu. Here is my info:

EFI Revision 1.10
Platform: x86_64 (64 bit)
Firmware: Apple 1.10

I guess your firmware is 32-bit, even though the cpu is 64-bit.

Signature · 1 line
Bean
#10 lore raw
Quoted 8 lines · Bean

BTW, you can check out the firmware info in "About rEFIt" icon in the refit boot menu. Here is my info:

EFI Revision 1.10
Platform: x86_64 (64 bit)
Firmware: Apple 1.10

I guess your firmware is 32-bit, even though the cpu is 64-bit.

Dunno. All my rEFIt says about itself of substance in that "About rEFIt" is that it's version 0.9. Is yours one of those newer ("Santa Rosa") MacBooks that require at least refit 0.10? (I think it's because those firmwares require 64-bit EFI image)

[rEFIt] "Version 0.10 (June 14, 2007):
* Supports the new “Santa Rosa” generation of MacBook Pro models.
* All binaries built as “fat” 32-bit and 64-bit. (May not work on
non-Apple EFI firmwares.)" http://refit.sourceforge.net/history.html

But we (GRUB) aren't refit -- we just need to know that we can't use that kind of multi-arch image to support all x86 and x86-64 EFI platforms.

-Isaac

author
#11 lore raw
Quoted 9 lines · Isaac Dupree
Quoted 8 lines · Bean

BTW, you can check out the firmware info in "About rEFIt" icon in the refit boot menu. Here is my info:

EFI Revision 1.10
Platform: x86_64 (64 bit)
Firmware: Apple 1.10

Quoted 6 lines
Quoted 1 line

I guess your firmware is 32-bit, even though the cpu is 64-bit.

Dunno. All my rEFIt says about itself of substance in that "About rEFIt" is that it's version 0.9. Is yours one of those newer ("Santa Rosa") MacBooks that require at least refit 0.10? (I think it's because those firmwares require 64-bit EFI image)

I use the latest version 0.11.

Quoted 5 lines

[rEFIt] "Version 0.10 (June 14, 2007):
* Supports the new "Santa Rosa" generation of MacBook Pro models.
* All binaries built as "fat" 32-bit and 64-bit. (May not work on
non-Apple EFI firmwares.)" http://refit.sourceforge.net/history.html

That must be it. I can't use refit < 0.10.

Quoted 3 lines

But we (GRUB) aren't refit -- we just need to know that we can't use that kind of multi-arch image to support all x86 and x86-64 EFI platforms.

Yes, we can't create multi-arch image. We need to maintain them seperately, i386-efi and x86_64-efi.

Signature · 1 line
Bean
#12 lore raw
Quoted 6 lines · Bean
Quoted 4 lines

[rEFIt] "Version 0.10 (June 14, 2007):
* Supports the new "Santa Rosa" generation of MacBook Pro models.
* All binaries built as "fat" 32-bit and 64-bit. (May not work on
non-Apple EFI firmwares.)" http://refit.sourceforge.net/history.html

That must be it. I can't use refit < 0.10.

hmm. in which case, I wonder, it may only be possible for me to test 32-bits EFI images -- but we'll see. That could still be a useful thing to be able to test.

Quoted 5 lines
Quoted 2 lines

But we (GRUB) aren't refit -- we just need to know that we can't use that kind of multi-arch image to support all x86 and x86-64 EFI platforms.

Yes, we can't create multi-arch image. We need to maintain them seperately, i386-efi and x86_64-efi.

are we unable to (because refit uses the MacOS X toolchain (?) and we don't), or we just have no interest in doing so (because installers can have the smarts of figuring out which arch the firmware expects for the image?) ?

-Isaac

author
#13 lore raw
Quoted 4 lines · Isaac Dupree

are we unable to (because refit uses the MacOS X toolchain (?) and we don't), or we just have no interest in doing so (because installers can have the smarts of figuring out which arch the firmware expects for the image?) ?

It's possible to create multiple arch image, but it requires some extra work. We need to compile i386-efi and x86_64-efi separately, then use a tool to merge them. This can't be done in a single step.

Signature · 1 line
Bean
#14 lore raw
Quoted 4 lines · Bean

It's possible to create multiple arch image, but it requires some extra work. We need to compile i386-efi and x86_64-efi separately, then use a tool to merge them. This can't be done in a single step.

Why not just drop the -m32 and always build "native" images? So if you build the i386-efi target on i386, you get a 32-bit image and if you build it on x86_64 you get a 64-bit one?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
#15 lore raw
Quoted 8 lines · Robert Millan
Quoted 3 lines · Bean

It's possible to create multiple arch image, but it requires some extra work. We need to compile i386-efi and x86_64-efi separately, then use a tool to merge them. This can't be done in a single step.

Why not just drop the -m32 and always build "native" images? So if you build the i386-efi target on i386, you get a 32-bit image and if you build it on x86_64 you get a 64-bit one?

No. Consider build farm.

#16 lore raw
In reply to Robert Millan
Quoted 8 lines · Robert Millan
Quoted 3 lines · Bean

It's possible to create multiple arch image, but it requires some extra work. We need to compile i386-efi and x86_64-efi separately, then use a tool to merge them. This can't be done in a single step.

Why not just drop the -m32 and always build "native" images? So if you build the i386-efi target on i386, you get a 32-bit image and if you build it on x86_64 you get a 64-bit one?

take the MacBook. There are different versions, let's call them (A), the original MacBook, 32-bit CPU; (B), mine, 64-bit CPU; and (C), Bean's, 64-bit CPU.

A and B require 32-bit EFI image. (actually, B might accept both 32 and 64 bits images, I'm not sure) C requires 64-bit EFI image.

I can run a 32-bit distro and linux-kernel on any of them -- A, B or C.
I can run a 64-bit distro on B or C.

Basically, neither CPU nor system arch tells you what kind of EFI image is "native". There must be some way to find out what kind of image *is* native -- but I have no idea what it is.

-Isaac

#17 lore raw
In reply to Bean

Hi,

Quoted 7 lines · Bean

I just wonder if anybody is working on x86_64 EFI support ? If none, I'd like to add it soon, as it's essential for grub2 to work with Apple's 64-bit Intel Mac.

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

Okuji made this choise. I do not recall why, you look it up. But I assume he had a good reason for this. Would it be hard to adopt his work for x86_64?

--
Marco

#18 lore raw
In reply to Bean
Quoted 9 lines · Bean

Hi,

I just wonder if anybody is working on x86_64 EFI support ? If none, I'd like to add it soon, as it's essential for grub2 to work with Apple's 64-bit Intel Mac.

BTW, I notice that grub-mkimage for efi convert elf to efi internally, how about use the gnu-efi tool chain, this could make it more portable between ia32 and x86_64.

How about ia64? Does the situation improve there? Tristan Gingold (CCed) was in the process of merging his ia64 port of GRUB, and toolchain support for ia64-PE was one of the stumbling blocks.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
author
#19 lore raw
Quoted 5 lines · Robert Millan

gnu-efi is licensed under GPL 2 or later. There's no problem linking GRUB with it.

Thourhg, if it's just a binary file converter license compatibility would probably not be required anyway.

It's nice to know, althought I don't need it anymore. gnu-efi is quite simple, I can use the part I need in grub directly.

Quoted 3 lines

Why not just drop the -m32 and always build "native" images? So if you build the i386-efi target on i386, you get a 32-bit image and if you build it on x86_64 you get a 64-bit one?

There is situation where we need to build 32-bit image in 64-bit machine, or vice verse. So it's better to make it separated.

Quoted 3 lines

How about ia64? Does the situation improve there? Tristan Gingold (CCed) was in the process of merging his ia64 port of GRUB, and toolchain support for ia64-PE was one of the stumbling blocks.

I manage to hack grub-mkimage to convert from elf64 to PE32+, I think it's similar in ia64. The tricky part is relocation, other is just quite straight forward.

Signature · 1 line
Bean