[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to build grub on powerpc64le ?
From: |
Andrei Borzenkov |
Subject: |
Re: how to build grub on powerpc64le ? |
Date: |
Tue, 27 Feb 2024 16:54:56 +0300 |
On Tue, Feb 27, 2024 at 4:15 PM yuucyf <yuucyf@163.com> wrote:
>
> hi, all:
>
>
> Does GRUB support powerpc64le, and has the community successfully built it on
> powerpc64le systems?
> I am facing issues building on powerpc64le, mainly encountering two problems:
>
>
> 1. It shows an error 'cc1: error: ‘-m32’ not supported in this
> configuration.' This is because my GCC on the build platform was not
> configured with --enable-multilib, as I am in a 64-bit environment, and there
> is no need to build 32-bit applications.
> Is it mandatory to use 32-bit build on PowerPC, regardless of whether it's
> 32-bit or 64-bit?
I will not be surprised if PowerPC starts in 32 bit mode, similar to
x86. Try finding the PowerPC programming manual, check the state after
power on. Even if it is not the case, you need a very compelling
reason to maintain the whole different platform. As long as 32 bit
runs everywhere, why bother with 64 bit at all?
> 2. I modified the code in the configure.ac file as follows:
> if test x$platform != xemu ; then
> case "$target_cpu" in
> i386) target_m32=1 ;;
> x86_64 | sparc64 | powerpc) target_m64=1 ;;
That won't work. You do need to define a new platform with all
relevant definitions. GRUB assumes 32 bits for PowerPC and your trick
does not change it.
> esac
> fi
> I found that the configure was successful. However, during the compilation
> process, I noticed that there is a parameter -mbig-endian. Since my system is
> powerpc64le, which is little-endian, I cannot use -mbig-endian. So, I made
> further modifications in configure.ac:
>
PowerPC starts big endian. You can switch to little endian, but grub
runs immediately after power on, so why should it bother?
> if test x$target_cpu = xmips; then # (line 659)
>
>
> I changed it to:
>
>
> if test x$target_cpu = xmips; then # (line 659)
>
>
> Additionally, I modified:
> elif test x$target_cpu = xmipsel; then # (line 694)
> to:
> elif test x$target_cpu = xpowerpc; then # (line 694)
>
>
> I forced the use of little-endian on powerpc64le systems. However, after
> these changes, the configure failed, and I couldn't find the reason for the
> failure in the config.log file.
It is good that the configuration failed because otherwise the result
would have been rather unusable. GRUB includes internal definitions
for each platform feature; you cannot make incompatible changes to the
platform and expect it to work.
Again - you would need to define the whole new platform *AND*
implement jump code to switch to LE after reset. Is there any reason
to waste time on it?