Template:RK3399-DevEnv

From FriendlyELEC WiKi
Jump to: navigation, search

1 Setup Development Environment

We suggest you do it on a 64 bit Ubuntu 18.04 system and install the following packages:

sudo apt-get -y install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get -y install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
sudo apt-get -y install openjdk-8-jdk
sudo apt-get -y install exfat-fuse exfat-utils device-tree-compiler liblz4-tool
sudo apt-get -y install android-tools-fsutils
sudo apt-get -y install swig
sudo apt-get -y install python-dev python3-dev

2 Install Cross Compiler

2.1 Install aarch64-linux-gcc 6.4

This compiler can be used to compile a Linux kernel and u-boot. You can do it by running the following commands:

git clone https://github.com/friendlyarm/prebuilts.git -b master --depth 1
cd prebuilts/gcc-x64
cat toolchain-6.4-aarch64.tar.gz* | sudo tar xz -C /

Add the compiler's directory to the PATH variable by appending the following lines to the ~/.bashrc file:

export PATH=/opt/FriendlyARM/toolchain/6.4-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

This is a 64 bit compiler and cannot work on a 32 bit Linux system. You can test if your compiler is installed correctly by running the following commands:

aarch64-linux-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gcc
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/6.4-aarch64/libexec/gcc/aarch64-cortexa53-linux-gnu/6.4.0/lto-wrapper
Target: aarch64-cortexa53-linux-gnu
Configured with: /work/toolchain/build/aarch64-cortexa53-linux-gnu/build/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/6.4-aarch64
--with-sysroot=/opt/FriendlyARM/toolchain/6.4-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-languages=c,c++
--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-cpu=cortex-a53
...
Thread model: posix
gcc version 6.4.0 (ctng-1.23.0-150g-FA)