• Android 源码编译


    Google官方资料参考 http://source.android.com/source/building-running.html

    1. 环境设置,

    下载好源码后,进入源码目录,即之前执行 repo sync的路径下,用下面两个命令之一,第二个命令简短一点,两个命令效果没区别

    $ source build/envsetup.sh
    $ . build/envsetup.sh


    2.  选择编译的目标,用lunch指令,参数用来指定目标配置

    $ lunch full-eng

    参数形式是 BUILD-BUILDTYPE,其中 BUILD 是表明要合并的特殊特征的code name,下面是部分参数:

    Build nameDeviceNotes
    full emulator fully configured with all languages, apps, input methods
    full_maguro maguro full build running on Galaxy Nexus GSM/HSPA+ ("maguro")
    full_panda panda full build running on PandaBoard ("panda")

     BUILDTYPE 可选下面参数:

    BuildtypeUse
    user 限制访问;适合作为产品
    userdebug 类似 "user" 但可以有 root 访问权限和可调试;适用于调试设备
    eng 带有附加调试工具的开发配置

    新手直接输入lunch,不带参数,会输出可选参数供你选择,类似下面这样

         1. aosp_arm-eng
         2. aosp_x86-eng
         3. aosp_mips-eng
         4. vbox_x86-eng
         5. full_maguro-userdebug
         6. full_toroplus-userdebug
         7. full_manta-userdebug
         8. full_toro-userdebug
         9. full_mako-userdebug
         10. full_panda-userdebug
         11. mini_mips-userdebug
         12. mini_armv7a_neon-userdebug
         13. mini_x86-userdebug
         14. full_arndale-userdebug
         15. aosp_flo-userdebug
         16. full_tilapia-userdebug
         17. full_grouper-userdebug
         18. aosp_deb-userdebug

    3. 开始编译,make -j4

     参数 j 后数字可以用你系统支持线程数的1-2倍的值,比如你用双至强 E5520 (2个 CPU, 每个CPU 4核8线程),那最快的编译方式应该用参数 -j16或-j32。

    执行后,报错 :/bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: 无法执行二进制文件

    查了很久,确定是没有使用 64位Ubuntu造成,bt下载一个镜像,做个安装启动U盘搞定,地址很多,这儿推荐一个拥有很多bt资源的网址

    安装后启动时发生了一点儿GRUB 错误,注意查看主板BIOS启动项,我那个华硕主板BIOS默认是WINDOWS系统方式,这造成了GRUB Error22。重新设置后可以正常启动。







  • 相关阅读:
    19. Remove Nth Node From End of List
    18. 4Sum
    16. 3Sum Closest
    15. 3Sum
    17. Letter Combinations of a Phone Number
    A Network-based End-to-End Trainable Task-oriented Dialogue System
    14. Longest Common Prefix
    36. Valid Sudoku
    29. Divide Two Integers
    32. Longest Valid Parentheses
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3239059.html
Copyright © 2020-2023  润新知