On Thu, Apr 03, 2014 at 11:54:46PM +0400, Andrey Borzenkov wrote: > В Thu, 3 Apr 2014 12:26:57 -0700 > Ram Pai <linux...@us.ibm.com> пишет: > > > > > > > > > > > > Well. that is the issue. Various distros have varied support for > > > > > > cross-compilation (multi-arch support). If the distro does not > > > > > > have 32bit BE libraries natively installed (out-of-the-box), they > > > > > > wont be able to generate a 32bit BE grub loader. > > > > > > > > > > We speak only about target code that runs at boot time. This code does > > > > > not use any library. > > > > > > > > I am not a compiler/toolchain expert. But dont we need all the necessary > > > > tools and libraries in /lib/<arch>-<dist>-linux/ directory for cross > > > > compilation; even to generate static executables? > > > > > > > > > It only needs compiler support. GRUB does not > > > > > support anything besides gcc and recently some clang support was > > > > > added. > > > > > Do you have real life example of distribution which does not support > > > > > -mbig gcc option to produce big-endian *code*? > > > > > > > > This is ideally what I want too. But it is not possible > > > > **out-of-the-box** on any distro for power arch. I am told > > > > that debian has a new multi-arch support added which makes this > > > > work out-of-the-box, but it is still in early stages to work > > > > seemlessly **out-of-the-box**. I may be wrong. > > > > > > > > > > If distribution is capable of building Linux kernel, it should be > > > capable of compiling 32 bit big-endian code. Linux startup code on > > > PowerPC is built as 32 bit big-endian: > > > > > > BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ > > > -fno-strict-aliasing -Os -msoft-float -pipe \ > > > -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ > > > -isystem $(shell $(CROSS32CC) -print-file-name=include) \ > > > -mbig-endian > > > > > > But that is different though. Yes it is possible to cross compile for > > any target on any arch. But the key is that the environment needs to be > > setup to do so. > > > > We are talking about generating crosscompiled grub boot loader by an > > uninitiated/not-so-expert adminstrator. If the distribution makes it > > easy for that administrator to be able to cross-compile, than life is > > easy. But that is not generally the case though. > > E-h-h ... could you be more specific? You need exactly the same tool > set to compile 32 bit big-endian grub as to compile Linux kernel. So > it follows that generally it is impossible to compile Linux kernel on > distributions for ppc64le. Is it what you mean?
It is not possible to generate a ppc64be kernel on a ppc64le distro. Toolchain does not support it. Vice-versa is possible. > > > The administrator has > > to scramble around to find the right cross-compilation setup installed > > on her system to achieve the end result. > > > > I try to understand what exactly is required beyond what is needed to > compile Linux kernel? I do not consider need to install a couple of > RPMs as high burden. > > Here is what grub2 on SUSE needs: > > %ifarch x86_64 ppc64 > BuildRequires: gcc-32bit > BuildRequires: glibc-32bit > BuildRequires: glibc-devel-32bit > %else > BuildRequires: gcc > BuildRequires: glibc-devel > %ifarch s390x > BuildRequires: glibc-static > %endif > %endif > > See https://build.opensuse.org/package/show/Base:System/grub2 for > details. It simply forces -m32 -big-endian for powerpc. It also includes > brute-force patche to work around libgcc issue that probably may be > done differently, but otherwise it is amazingly small change. They generate a 32bit BE grub binary on a LE system? No. I dont think so. Because the cross-compile tool chain is not enabled do so. -- Ram Pai _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel