Skip to content

Commit aee1e35

Browse files
committed
Switch BE build docs to use PPC64
1 parent ff8ae92 commit aee1e35

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

Docs/Building-BE.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ distributions still support BE platforms.
99
Even though Arm64 can run in a BE mode, it's now very rare in practice. It's no
1010
longer supported out of the box in the latest Arm upstream compiler releases,
1111
and getting hold of a sysroot is increasingly difficult. To test BE builds, I
12-
therefore cross-compile Linux builds for MIPS64 and use `qemu-user` to run
12+
therefore cross-compile Linux builds for PPC64 and use `qemu-user` to run
1313
them. This doesn't use a real sysroot, and so everything must be compiled with
1414
`-static` linkage.
1515

@@ -19,15 +19,16 @@ Install the following host software:
1919

2020
```bash
2121
# Compiler
22-
sudo apt-get install g++-mips64-linux-gnuabi64
22+
sudo apt-get install g++-powerpc64-linux-gnu
2323

2424
# Multi-arch libraries
25-
sudo apt-get install g++-multilib-mips64-linux-gnuabi64
25+
sudo apt-get install g++-multilib-powerpc64-linux-gnu
2626

2727
# QEMU
28-
sudo apt-get install qemu-user-static
28+
sudo apt-get install qemu-user-static qemu-user-binfmt binfmt-support
2929
sudo mkdir /etc/qemu-binfmt
30-
sudo ln -s /usr/mips64-linux-gnuabi64 /etc/qemu-binfmt/mips64
30+
sudo ln -s /usr/powerpc64-linux-gnu /etc/qemu-binfmt/ppc64
31+
sudo update-binfmts --import qemu-ppc64
3132
```
3233

3334
## CMake toolchain file
@@ -41,19 +42,21 @@ file in the root of the project, with the following content:
4142
set(CMAKE_SYSTEM_NAME Linux)
4243
4344
# Cross-compilers for C and C++
44-
set(CMAKE_C_COMPILER mips64-linux-gnuabi64-gcc)
45-
set(CMAKE_CXX_COMPILER mips64-linux-gnuabi64-g++)
45+
set(CMAKE_C_COMPILER powerpc64-linux-gnu-gcc)
46+
set(CMAKE_CXX_COMPILER powerpc64-linux-gnu-g++)
4647
4748
# Compiler environment
48-
set(CMAKE_FIND_ROOT_PATH /usr/mips64-linux-gnuabi64)
49+
set(CMAKE_FIND_ROOT_PATH /usr/powerpc64-linux-gnu)
4950
50-
# Default compiler and linker flags to use
5151
set(CMAKE_C_FLAGS_INIT -static)
5252
set(CMAKE_CXX_FLAGS_INIT -static)
5353
set(CMAKE_EXE_LINKER_FLAGS_INIT -static)
5454
set(CMAKE_SHARED_LINKER_FLAGS_INIT -static)
5555
set(CMAKE_MODULE_LINKER_FLAGS_INIT -static)
5656
57+
# Build options
58+
set(ASTCENC_BIG_ENDIAN ON)
59+
5760
# Never match host tools
5861
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
5962
@@ -78,8 +81,17 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_NONE=O
7881
The cross-compiled `astcenc` binary runs as normal, and can access host files,
7982
but must run through QEMU to do the instruction set translation.
8083

84+
If the binfmt setup performed earlier was successful you can just run the
85+
binary as if it were a native binary:
86+
87+
```
88+
./bin/astcenc-none ...
89+
```
90+
91+
... but otherwise you can run it manually using QEMU as a wrapper:
92+
8193
```
82-
qemu-mips64 ./bin/astcenc-none ...
94+
qemu-ppc64 ./bin/astcenc-none ...
8395
```
8496

8597
- - -

0 commit comments

Comments
 (0)