APITestPage/zh
From FriendlyELEC WiKi
Contents
1 Setup Development Environment
1.1 Using Docker to Cross-Compile
Please refre to docker-cross-compiler-novnc
1.2 Build a cross-compiling environment
1.2.1 Install required packages
Install and run requirements ubuntu 20.04, install required packages using the following commands:
sudo apt-get -y update sudo apt-get install -y sudo curl sudo bash -c \ "$(curl -fsSL https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh)"
The following cross-compilers will be installed:
Version | Architecture | Compiler path | Purpose |
---|---|---|---|
4.9.3 | armhf | /opt/FriendlyARM/toolchain/4.9.3 | Used for compiling 32-bit ARM applications |
6.4 | aarch64 | /opt/FriendlyARM/toolchain/6.4-aarch64 | Used for cross-compiling kernel 4.4 |
11.3 | aarch64 | /opt/FriendlyARM/toolchain/11.3-aarch64 | Used for cross-compiling kernel 4.19 and above (including 5.10, 5.15) and U-Boot |
1.2.2 Setting Cross Compiler
Based on the table in the previous section, select the appropriate version of the compiler and add the compiler's path to PATH. For example, if you want to use the 11.3 cross-compiler, edit ~/.bashrc using vi and add the following content to the end:
export PATH=/opt/FriendlyARM/toolchain/11.3-aarch64/bin:$PATH export GCC_COLORS=auto
Run the ~/.bashrc script to make it effective in the current commandline. Note: there is a space after ".":
. ~/.bashrc
To verify if the installation was successful:
$ aarch64-linux-gcc -v Using built-in specs. COLLECT_GCC=aarch64-linux-gcc COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/11.3-aarch64/libexec/gcc/aarch64-cortexa53-linux-gnu/11.3.0/lto-wrapper Target: aarch64-cortexa53-linux-gnu Configured with: /home/cross/arm64/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=aarch64-cortexa53-linux-gnu --prefix=/opt/FriendlyARM/toolchain/11.3-aarch64 --exec_prefix=/opt/FriendlyARM/toolchain/11.3-aarch64 --with-sysroot=/opt/FriendlyARM/toolchain/11.3-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-languages=c,c++ --enable-fix-cortex-a53-843419 --with-arch=armv8-a+crypto+crc --with-cpu=cortex-a53 --with-pkgversion=ctng-1.25.0-119g-FA --with-bugurl=http://www.friendlyelec.com/ --enable-objc-gc --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/home/cross/arm64/buildtools --with-mpfr=/home/cross/arm64/buildtools --with-mpc=/home/cross/arm64/buildtools --with-isl=/home/cross/arm64/buildtools --enable-lto --enable-threads=posix --disable-libstdcxx-pch --enable-clocale=gnu --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-indirect-function --enable-gnu-unique-object --enable-default-pie --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-gold --with-libintl-prefix=/home/cross/arm64/buildtools --disable-multilib --with-local-prefix=/opt/FriendlyARM/toolchain/11.3-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-long-long --enable-checking=release --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.3.0 (ctng-1.25.0-119g-FA)