Skip to contentSkip to conversation

Solving the grub-pe2elf problem

DISCUSSION Robert Millan 5 participants 11 messages Aug 7, 2009 – Aug 10, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

I thought of a possible solution to the grub-pe2elf problem. It seems that it is burdensome to produce ELF binaries on Windows, but building PE binaries or even PE/win32 executables on GNU/Linux is not (thanks to Mingw32 toolchain which is available on most distributions).

If building GRUB with "./configure --host=i586-mingw32msvc" works, we could include win32 binaries in the upcoming 1.97 release. Other GNU projects do this as well. Then we could drop support for toolchains that lack ELF.

It probably doesn't currently build this way, because win32 won't have all the functions we need, but this can be fixed by importing them from Gnulib, the GNU compatibility library.

Christian and Bean, are you interested in implementing this?

Other maintainers, is it burdensome to any of you to include these binaries in official builds? I suppose it's not, since mingw32 packages are widely available, but it doesn't hurt to ask :-)

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#1 lore raw
Quoted 12 lines · Robert Millan

Hi,

I thought of a possible solution to the grub-pe2elf problem.  It seems that it is burdensome to produce ELF binaries on Windows, but building PE binaries or even PE/win32 executables on GNU/Linux is not (thanks to Mingw32 toolchain which is available on most distributions).

If building GRUB with "./configure --host=i586-mingw32msvc" works, we could include win32 binaries in the upcoming 1.97 release.  Other GNU projects do this as well.  Then we could drop support for toolchains that lack ELF.

I don't think that dropping useful features just for the sake of code to look nice is a good thing. End users wouldn't care if you supply binaries with or without compilable sources. But you don't let them to exercise freedom. You can argue that you don't restrict their freedom it's true but many people may need to taste freedom on a small thing before changing to (w)holly free system. And this approach attracts developpers. When I was speaking with developpers around Darwin they specifically wanted to compile grub with toolchain they already have. It's why I bothered at all to make grub compilable with Apple toolchain (I'm personally fine with compiling it from Linux or FreeBSD). I'm aware of few coders on different skill levels who are now "tasting" grub and who wouldn't have if I haven't done it

Quoted 23 lines

It probably doesn't currently build this way, because win32 won't have all the functions we need, but this can be fixed by importing them from Gnulib, the GNU compatibility library.

Christian and Bean, are you interested in implementing this?

Other maintainers, is it burdensome to any of you to include these binaries in official builds?  I suppose it's not, since mingw32 packages are widely available, but it doesn't hurt to ask :-)

--
Robert Millan

 The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#2 lore raw
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
Quoted 8 lines · Robert Millan

Hi,

I thought of a possible solution to the grub-pe2elf problem.  It seems that it is burdensome to produce ELF binaries on Windows, but building PE binaries or even PE/win32 executables on GNU/Linux is not (thanks to Mingw32 toolchain which is available on most distributions).

If you see pe2elf as being too much of a burden we may switch to
objconv: http://www.agner.org/optimize/. It's already used in conjunction with Apple Mach-O toolchain. It's not a GNU project but is licensed under GPL.

Quoted 6 lines

--
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#3 lore raw
Quoted 5 lines · Vladimir 'phcoder' Serbinenko

If you see pe2elf as being too much of a burden we may switch to
objconv: http://www.agner.org/optimize/. It's already used in conjunction with Apple Mach-O toolchain. It's not a GNU project but is licensed under GPL.

Thanks for the hint, I will try objconv it soon.

Signature · 2 lines
Regards,
Christian Franke
#4 lore raw

Hi,

You could also check out my new object format at
http://github.com/bean123/grub, lib branch. It supports conversion of pe/elf/mach-o object file to a grub specific format, so that you can use native build tool in Linux/OSX/Windows, no need for linker and converter. It also reduce compile time by half and generate module file much smaller that the current format.

Quoted 21 lines · Christian Franke
Quoted 6 lines · Vladimir 'phcoder' Serbinenko

If you see pe2elf as being too much of a burden we may switch to
objconv: http://www.agner.org/optimize/. It's already used in conjunction with Apple Mach-O toolchain. It's not a GNU project but is licensed under GPL.

Thanks for the hint, I will try objconv it soon.

--
Regards,
Christian Franke

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

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

You could also check out my new object format at
http://github.com/bean123/grub, lib branch. It supports conversion of pe/elf/mach-o object file to a grub specific format, so that you can use native build tool in Linux/OSX/Windows, no need for linker and converter. It also reduce compile time by half and generate module file much smaller that the current format.

Tested successfully on Cygwin - Nice work!

Signature · 2 lines
Regards,
Christian Franke
#6 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 11 lines · Vladimir 'phcoder' Serbinenko
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
Quoted 8 lines · Robert Millan

Hi,

I thought of a possible solution to the grub-pe2elf problem.  It seems that it is burdensome to produce ELF binaries on Windows, but building PE binaries or even PE/win32 executables on GNU/Linux is not (thanks to Mingw32 toolchain which is available on most distributions).

Quoted 4 lines

If you see pe2elf as being too much of a burden we may switch to
objconv: http://www.agner.org/optimize/. It's already used in conjunction with Apple Mach-O toolchain. It's not a GNU project but is licensed under GPL.

I don't understand this. Why is a requirement to install GNU binutils unreasonable, whereas a requirement to install objconv is not?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#7 lore raw
Quoted 2 lines · Robert Millan

I don't understand this. Why is a requirement to install GNU binutils unreasonable, whereas a requirement to install objconv is not?

Installing binutils can break the existing toolchain. Installing objconv should not.

It's a good idea, as it would unify Apple and Cygwin support to some degree.

Signature · 2 lines
Regards,
Pavel Roskin
#8 lore raw
Quoted 10 lines · Pavel Roskin
Quoted 2 lines · Robert Millan

I don't understand this. Why is a requirement to install GNU binutils unreasonable, whereas a requirement to install objconv is not?

Installing binutils can break the existing toolchain. Installing objconv should not.

It's a good idea, as it would unify Apple and Cygwin support to some degree.

I would prefer if we didn't feed the NIH syndrome in those two platforms (the rest of the world has settled on ELF, and it is still difficult for users of those two OSes to produce that format).

That said, switching to objconv is an improvement. I have nothing against it.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#9 lore raw
In reply to Robert Millan
Quoted 10 lines · Robert Millan

I thought of a possible solution to the grub-pe2elf problem. It seems that it is burdensome to produce ELF binaries on Windows, but building PE binaries or even PE/win32 executables on GNU/Linux is not (thanks to Mingw32 toolchain which is available on most distributions).

If building GRUB with "./configure --host=i586-mingw32msvc" works, we could include win32 binaries in the upcoming 1.97 release. Other GNU projects do this as well. Then we could drop support for toolchains that lack ELF.

Which binaries would you like to include?
- kernel.img and modules, and/or
- the grub-*.exe files (Note: mingw32 .exe != cygwin .exe).?

The problem with the PE->ELF conversion affects build of the *.mod files, not the build of the *.exe. The linker script is necessary for kernel.img.

Quoted 3 lines

Christian and Bean, are you interested in implementing this?

No.

Then building a Cygwin package would rely on the existence of (tested or untested?) binaries in the a release tarball. Building packages from SVN snapshots would no longer be possible.

I really don't want to spent my open-source-time with such kind of feature removal :-)

Signature · 2 lines
Regards,
Christian Franke
#10 lore raw
In reply to Robert Millan
Quoted 3 lines · Robert Millan

Other maintainers, is it burdensome to any of you to include these binaries in official builds? I suppose it's not, since mingw32 packages are widely available, but it doesn't hurt to ask :-)

I would prefer not to do a binary build at this stage. Especially Windows users are at risk of messing things up if the entry barrier is lowered too much.

Signature · 2 lines
Regards,
Pavel Roskin