* [Buildroot] Compiling grub on x86_64
@ 2012-06-25 7:51 Arnout Vandecappelle
2012-06-25 8:04 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2012-06-25 7:51 UTC (permalink / raw)
To: buildroot
Hoi all,
I have an x86 project using and internal toolchain and grub as the boot loader. We recently switched to x86_64 (for
syscall performance reasons). Unfortunately, grub fails to even configure: the compiler can't generate executables.
It's missing -lgcc_s. I guess this is because the toolchain is built without multilib support and grub uses the -m32
switch.
I'm unusually stumped at this point. Building a toolchain with multilib support seems the easy way out, but that's a
bit heavy just to be able to compile grub. A 64-bit build of grub will probably not work because BIOSes don't
understand 64-bit. So the best thing I can come up with is to have a separate buildroot config just to build grub.
Does anyone have better ideas?
With this in mind, it's probably best to remove the BR2_x86_64 option from the grub config, or at least limit it to
external toolchains that may work (i.e. Sourcery). BTW, Thomas & Peter, am I correct in assuming that grub is not
included in the autobuilds?
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-25 7:51 [Buildroot] Compiling grub on x86_64 Arnout Vandecappelle
@ 2012-06-25 8:04 ` Thomas Petazzoni
2012-06-28 8:09 ` Arnout Vandecappelle
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2012-06-25 8:04 UTC (permalink / raw)
To: buildroot
Hello,
Le Mon, 25 Jun 2012 09:51:52 +0200,
Arnout Vandecappelle <arnout@mind.be> a ?crit :
> I have an x86 project using and internal toolchain and grub as the boot loader. We recently switched to x86_64 (for
> syscall performance reasons). Unfortunately, grub fails to even configure: the compiler can't generate executables.
> It's missing -lgcc_s. I guess this is because the toolchain is built without multilib support and grub uses the -m32
> switch.
>
> I'm unusually stumped at this point. Building a toolchain with multilib support seems the easy way out, but that's a
> bit heavy just to be able to compile grub. A 64-bit build of grub will probably not work because BIOSes don't
> understand 64-bit. So the best thing I can come up with is to have a separate buildroot config just to build grub.
> Does anyone have better ideas?
No, it's a difficult problem. And the issue came up several times on
the list already. How much effort would it be to also generate a
multilib 32bits/64bits toolchain when x86_64 is used?
> With this in mind, it's probably best to remove the BR2_x86_64 option from the grub config, or at least limit it to
> external toolchains that may work (i.e. Sourcery).
At least for now, yes, making sure that Grub can't be selected with
internal toolchains on x86_64 seems like a good idea.
> BTW, Thomas & Peter, am I correct in assuming that grub is not
> included in the autobuilds?
Correct. At least here, my random builds use randpackageconfig, so only
the package choices are randomized. The kernel and bootloaders builds
are therefore never exercised at the moment. The purpose of the random
autobuilds is to find missing dependencies, issues on specific
architectures, etc.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-25 8:04 ` Thomas Petazzoni
@ 2012-06-28 8:09 ` Arnout Vandecappelle
2012-06-28 9:46 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2012-06-28 8:09 UTC (permalink / raw)
To: buildroot
On 06/25/12 10:04, Thomas Petazzoni wrote:
> Hello,
>
> Le Mon, 25 Jun 2012 09:51:52 +0200,
> Arnout Vandecappelle<arnout@mind.be> a ?crit :
>
> > I have an x86 project using and internal toolchain and grub as the boot loader. We recently switched to x86_64 (for
> > syscall performance reasons). Unfortunately, grub fails to even configure: the compiler can't generate executables.
> > It's missing -lgcc_s. I guess this is because the toolchain is built without multilib support and grub uses the -m32
> > switch.
> >
> > I'm unusually stumped at this point. Building a toolchain with multilib support seems the easy way out, but that's a
> > bit heavy just to be able to compile grub. A 64-bit build of grub will probably not work because BIOSes don't
> > understand 64-bit. So the best thing I can come up with is to have a separate buildroot config just to build grub.
> > Does anyone have better ideas?
>
> No, it's a difficult problem. And the issue came up several times on
> the list already. How much effort would it be to also generate a
> multilib 32bits/64bits toolchain when x86_64 is used?
It's certainly not trivial... Here's a list of issues I can come up with:
* It requires a different implementation for internal, crosstool-NG and
external toolchains.
* For external toolchains, there should be a check if it is multilib or not.
* For external toolchains, the wrapper has to change a lot because
the -m32 may imply a different -march and -mtune.
* crosstool-NG itself has no support for multilib AFAICS. Support would
have to be added.
* For internal toolchains, uClibc has to be built twice.
* Final gcc stage should be configured with the multilib paths.
* Are the multilib libraries installed to the target? For grub this isn't
really needed, but if something else compiles with -m32...
* Are other libraries compiled with multilib variants?
>
> > With this in mind, it's probably best to remove the BR2_x86_64 option from the grub config, or at least limit it to
> > external toolchains that may work (i.e. Sourcery).
>
> At least for now, yes, making sure that Grub can't be selected with
> internal toolchains on x86_64 seems like a good idea.
Turns out that it currently also doesn't work with multilib external toolchains.
The wrapper sets --sysroot to a path which doesn't contain the 32-bit libs.
For the time being, I guess grub should be disabled for all 64-bit configurations.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-28 8:09 ` Arnout Vandecappelle
@ 2012-06-28 9:46 ` Thomas Petazzoni
2012-06-28 9:56 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2012-06-28 9:46 UTC (permalink / raw)
To: buildroot
Le Thu, 28 Jun 2012 10:09:57 +0200,
Arnout Vandecappelle <arnout@mind.be> a ?crit :
> > No, it's a difficult problem. And the issue came up several times on
> > the list already. How much effort would it be to also generate a
> > multilib 32bits/64bits toolchain when x86_64 is used?
>
> It's certainly not trivial... Here's a list of issues I can come up with:
>
> * It requires a different implementation for internal, crosstool-NG and
> external toolchains.
> * For external toolchains, there should be a check if it is multilib or not.
> * For external toolchains, the wrapper has to change a lot because
> the -m32 may imply a different -march and -mtune.
> * crosstool-NG itself has no support for multilib AFAICS. Support would
> have to be added.
> * For internal toolchains, uClibc has to be built twice.
> * Final gcc stage should be configured with the multilib paths.
> * Are the multilib libraries installed to the target? For grub this isn't
> really needed, but if something else compiles with -m32...
> * Are other libraries compiled with multilib variants?
Quite a few issues :-)
> Turns out that it currently also doesn't work with multilib external toolchains.
> The wrapper sets --sysroot to a path which doesn't contain the 32-bit libs.
>
> For the time being, I guess grub should be disabled for all 64-bit configurations.
Agreed. It's however a shame that it's not possible to build a complete
bootloader+kernel+rootfs for x86_64 with a single Buildroot
configuration :-(
How other build systems handle this?
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-28 9:46 ` Thomas Petazzoni
@ 2012-06-28 9:56 ` Thomas Petazzoni
2012-06-28 12:44 ` Arnout Vandecappelle
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2012-06-28 9:56 UTC (permalink / raw)
To: buildroot
Le Thu, 28 Jun 2012 11:46:31 +0200,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> Agreed. It's however a shame that it's not possible to build a complete
> bootloader+kernel+rootfs for x86_64 with a single Buildroot
> configuration :-(
>
> How other build systems handle this?
Other questions:
* What about using the host compiler to build Grub? I know it sounds a
bit funky, but in practice, most Buildroot users will work on
x86/x86_64 machines. If they are on x86, then it just works, if they
work on x86_64, then most likely they have a multilib 32/64
toolchain installed on their host. This would at least enable, for
most users, the possibility of building Grub as part of a x86_64
target system configuration.
* What does Grub really require from gcc_s? Is it impossible to rework
Grub to make independent from the compiler companion libraries?
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-28 9:56 ` Thomas Petazzoni
@ 2012-06-28 12:44 ` Arnout Vandecappelle
2012-06-28 13:06 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2012-06-28 12:44 UTC (permalink / raw)
To: buildroot
On 06/28/12 11:56, Thomas Petazzoni wrote:
> * What does Grub really require from gcc_s? Is it impossible to rework
> Grub to make independent from the compiler companion libraries?
I was thinking along those lines as well. I'll take a look at it but it may
take some time.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Compiling grub on x86_64
2012-06-28 12:44 ` Arnout Vandecappelle
@ 2012-06-28 13:06 ` Thomas Petazzoni
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2012-06-28 13:06 UTC (permalink / raw)
To: buildroot
Le Thu, 28 Jun 2012 14:44:06 +0200,
Arnout Vandecappelle <arnout@mind.be> a ?crit :
> I was thinking along those lines as well. I'll take a look at it but it may
> take some time.
I had a 5 minutes look, and it seems not to be very easy: while the
compilation of Grub should probably work without these companion
libraries, all the checks in the ./configure script assumes that a
working gcc -m32 compiler is available.
Also, is it worth spending so much time on Grub 0.97, now that Grub 2.0
has been (finally) released?
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-06-28 13:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-25 7:51 [Buildroot] Compiling grub on x86_64 Arnout Vandecappelle
2012-06-25 8:04 ` Thomas Petazzoni
2012-06-28 8:09 ` Arnout Vandecappelle
2012-06-28 9:46 ` Thomas Petazzoni
2012-06-28 9:56 ` Thomas Petazzoni
2012-06-28 12:44 ` Arnout Vandecappelle
2012-06-28 13:06 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox