RK3399编译

参考官网开始编译

官网
下载地址

编译前准备: 环境搭建
安装openjdk8

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

安装其他依赖库

sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev \
  libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl \
  libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \
  xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
  lib32readline-gplv2-dev gcc-multilib libswitch-perl

sudo apt-get install gcc-arm-linux-gnueabihf \
  libssl1.0.0 libssl-dev \
  p7zip-full

安装碰到的问题:
libwxgtk2.8-dev无法安装的解决方法
16.04提供libwxgtk3.0-dev
sudo apt-get install libwxgtk3.0-dev

lib32readline-gplv2-dev无法安装的解决方法
vim /etc/apt/sources.list
结尾添加源地址:deb http://cz.archive.ubuntu.com/ubuntu trusty main
执行sudo apt-get update
然后sudo apt-get install lib32readline-gplv2-dev

使用 Firefly 官方脚本编译

  • 单独编译kernel:
    ./FFTools/make.sh -k -j8
  • 单独编译uboot:
    ./FFTools/make.sh -u -j8
  • 单独编译android上层:
    ./FFTools/make.sh -a -j8
  • 同时编译ubooot、kernel、android:
    ./FFTools/make.sh -j8

手动编译
编译前执行如下命令配置环境变量:可以加到.bashrc里再source一下.
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

  • 编译kernel:
    cd ~/proj/firefly-rk3399/kernel/
    make ARCH=arm64 firefly_defconfig
    make -j8 ARCH=arm64 rk3399-firefly.img

  • 编译uboot:
    cd ~/proj/firefly-rk3399/u-boot/
    make rk3399_box_defconfig
    make ARCHV=aarch64 -j8

  • 编译android:
    cd ~/proj/firefly-rk3399/
    source build/envsetup.sh
    lunch rk3399_firefly_box-userdebug
    make -j8

编译tinycap
mmm external/tinyalsa/
编译好后一般在out/target/product/xxx/system/bin/tinycap

编译过程中碰到的问题

0, 编译kernel碰到的问题:

make kernel err
1, --------------------------------------------------------------------------------------------------------------------------------
Makefile:708: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
  File "./scripts/gcc-wrapper.py", line 63
    print "error, forbidden warning:", m.group(2)
                                    ^
SyntaxError: invalid syntax
scripts/kconfig/conf  --silentoldconfig Kconfig
Makefile:708: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
  File "./scripts/gcc-wrapper.py", line 63
    print "error, forbidden warning:", m.group(2)
                                    ^
SyntaxError: invalid syntax
  CC      scripts/mod/empty.o
  File "./scripts/gcc-wrapper.py", line 63
    print "error, forbidden warning:", m.group(2)
                                    ^
SyntaxError: invalid syntax
scripts/Makefile.build:266: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 1
scripts/Makefile.build:411: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
Makefile:573: recipe for target 'scripts' failed
make: *** [scripts] Error 2

解决 =========================================
应该是arm-linux-gcc没有安装或者安装版本低于4.9引起.
重新安装
sudo apt-get install gcc-arm-linux-gnueabihf
同时记得进到kernel目录 , make clean一下.

1, - jdk要用openjdk 8 编译7.1的代码

2, jack-server问题: 参考
在编译7.1.1源码的时候,需要检查一下Jack-Server是否已经安装以及启动。
根据机器的RAM设置Jack-Server的VM大小,我机器是16G内存,所以设置8G左右VM。 修改prebuilts/sdk/tools/jack-admin 文件,找到变量JACK_SERVER_VM_ARGUMENTS位置在后面添加,添加参数 -Xmx8000M

JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"

进入prebuilts/sdk/tools 运行以下命令:
$ ./jack-admin start-server
如果提示没有安装的话,则运行以下命令,然后再次运行上面启动jack-server的命令。
$ ./jack-admin install-server jack-launcher.jar jack-server-4.8.ALPHA.jar

3, 参考

ninja: Entering directory `.'
[  0% 1/48196] Lex: ninja: Entering directory `.'
[  0% 1/48196] Lex: aidl <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
 <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

去除所有本地化的设置,让命令能正确执行,bash 执行:
 export LC_ALL=C

4, 编译tinycap过程出现
mmm external/tinyalsa
Couldn’t locate the directory external/tinyalsa
原因是因为当前shell环境是zsh , 切换到bash即可 , 直接运行bash
然后source build/envsetup.sh 再lunch就可以执行mmm命令.

你可能感兴趣的:(Android)