MTK Android 编译环境搭建总结

MTK Android 编译环境搭建总结

  • 环境部署
    基本环境需求:
    硬盘: 大于200G
    内存: 大于16G
    OS: ubuntu14.04, ubuntu16.04, ubuntu18.04
    否则空间或内存不足,导致编译错误或编译时间太长。
    测试平台: MTK P23
    1、添加源/etc/apt/sources.list
    14.04:
    deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ trusty-sercurity main restricted universe multiverse
    16.04:
    deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ xenial-sercurity main restricted universe multiverse
    18.04:
    deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu/ bionic-sercurity main restricted universe multiverse
    之后更新源:sudo apt-get update
    2、安装package
    sudo apt-get install bison g+±multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip build-essential build-essential flex mingw32 tofrodos libswitch-perl openjdk-8-jdk
    3、安装jdk以及配置java
    sudo add-apt-repository ppa:openjdk-r/ppa
    sudo apt-get update
    sudo apt-get install openjdk-8-jdk
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    4、install xrdp
    sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
    sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
    sudo apt-get update
    sudo apt-get install ubuntu-mate-core ubuntu-mate-desktop
    5、开始编译工作,设置环境变量
    source ./build/envsetup.sh
    6、选择编译工程
    lunch
    如选择43,编译t758工程的user版本, full_t758_public_pcba_63_o1-user
    7、编译
    全部编译:make -j8
    编译内核: make -j8 kerenl
    编译LK: make -j8 lk
    清除: make clean
    8、编译输出
    编译成功会提示:
    build success
    输出位置: out/target/product
    OUT 目录接近100G左右。
    9、内存不足提示错误解决方法
    Try increasing heap size with java option ‘-Xmx’
    ninja: build stopped: subcommand failed.
    make: *** [ninja_wrapper] Error 1

一般在命令行执行以下三条语句再编译就行了。

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx16g"
./prebuilts/sdk/tools/jack-admin kill-server
./prebuilts/sdk/tools/jack-admin start-server

你可能感兴趣的:(android)