Difference between revisions of "Template:RK3399-DevEnv/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(updated by API)
 
Line 1: Line 1:
 
===搭建编译环境===
 
===搭建编译环境===
搭建用于编译Android的环境,建议使用64位的Ubuntu 16.04,需要安装如下软件包:
+
建议使用64位的Ubuntu 18.04系统,需要安装如下软件包:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
+
sudo apt-get -y install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
+
sudo apt-get -y install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
sudo apt-get install openjdk-8-jdk
+
sudo apt-get -y install openjdk-8-jdk
sudo apt-get install exfat-fuse exfat-utils device-tree-compiler liblz4-tool
+
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
 
</syntaxhighlight>
 
</syntaxhighlight>
更多说明可查看 https://source.android.com/source/initializing.html; <br />
 
也可以使用Docker环境:[http://github.com/friendlyarm/friendlyelec-android-docker friendlyelec-android-docker]<br />
 
  
 
===安装交叉编译器===
 
===安装交叉编译器===

Latest revision as of 09:41, 2 December 2020

1 搭建编译环境

建议使用64位的Ubuntu 18.04系统,需要安装如下软件包:

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 安装交叉编译器

2.1 安装aarch64-linux-gcc 6.4

该编译器可用来编译Linux系统的内核和u-boot,用以下命令下载并安装:

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 /

然后将编译器的路径加入到PATH中,用vi编辑vi ~/.bashrc,在末尾加入以下内容:

export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin:$PATH
export GCC_COLORS=auto

执行一下~/.bashrc脚本让设置立即在当前shell窗口中生效,注意"."后面有个空格:

. ~/.bashrc

这个编译器是64位的,不能在32位的PC Linux系统上运行,安装完成后,用以下命令可以验证是否安装成功:

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)