ubuntu14.04编译Android4.4

准备环境:ubuntu-14.04-desktop-64bit LTS(虚拟机)

磁盘空间80G,多大你自己设定,但是不能太小哦!

 源码自己在网上搜索单独下载,由于Google被墙了后,官方的下载方式已经不能下载了,至少在我们大中国,说这些都是伤,自己捣鼓怎么下载吧!腿长的可以翻墙去下载。有一些网友也会提供下载。


环境搭建

1.      Oracle JDK安装,本章在上一次安装过,请看上一篇。

 

2.      安装需要的工具,亲测官网上面的会报很多的错误,具体什么错误不在这综述,提供我安装的工具方法。

#sudo apt-get install   gnupg flex bison gperf build-essential zip  curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dri:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev jit

如果报错,请一个一个去安装,这样出现问题具体分析。我在安装这个的时候出现了问题,

as@as-virtual-machine:~$ sudo apt-get installlibgl1-mesa-dri:i386

Reading package lists... Done

Building dependency tree       

Reading state information... Done

Some packages could not be installed. This may mean thatyou have

requested an impossible situation or if you are using theunstable

distribution that some required packages have not yetbeen created

or been moved out of Incoming.

The following information may help to resolve thesituation:

 

The following packages have unmet dependencies:

 unity-control-center : Depends:libcheese-gtk23 (>= 3.4.0) but it is not going to be installed

                       Depends: libcheese7 (>= 3.0.1) but it is not going to be installed

E: Error, pkgProblemResolver::Resolve generated breaks,this may be caused by held packages.

解决办法:出现这个问题是,你之前已经安装了libcheese-gtk23libcheese7所以现在更新源会报错,把之前的卸载了

sudo apt-getautoremove  libcheese-gtk23 libcheese7

最后在:sudoapt-get install libgl1-mesa-dri:i386

 

当时在安装jit的时候,把jit最先安装,出现不可用源,跟新了也不行,放在最后就能安装了。

 

三.配置ccache

安装ccache并将export USE_CCACHE=1加入到~/.bashrc中。

$sudo  apt-get  install  ccache

$source ~/.bashrc

 

源代码编译

1. 设置ccache

注:aosp为源代码根目录

$ cd aosp  

$ prebuilts/misc/linux-x86/ccache/ccache -M 50G  

2. 设置输出目录

略:由于我未分区,因此采用默认的out目录

3. 初始化编译环境

dennis@dubuntu1404:~/devenv/aosp$ . build/envsetup.sh   

including device/samsung/manta/vendorsetup.sh  

including device/generic/mips/vendorsetup.sh  

including device/generic/armv7-a-neon/vendorsetup.sh  

including device/generic/x86/vendorsetup.sh  

including device/lge/mako/vendorsetup.sh  

including device/lge/hammerhead/vendorsetup.sh  

including device/asus/tilapia/vendorsetup.sh  

including device/asus/deb/vendorsetup.sh  

including device/asus/grouper/vendorsetup.sh  

including device/asus/flo/vendorsetup.sh  

including sdk/bash_completion/adb.bash  

dennis@dubuntu1404:~/devenv/aosp$ 

4.选择编译目标包

注:目标包的选择跟你的硬件有关。我这里选择9,mako

dennis@dubuntu1404:~/devenv/aosp$ lunch  

You're building on Linux  

Lunch menu... pick a combo:  

     1. aosp_arm-eng  

     2. aosp_x86-eng  

     3. aosp_mips-eng  

     4. vbox_x86-eng  

     5. aosp_manta-userdebug  

     6. mini_mips-userdebug  

     7. mini_armv7a_neon-userdebug  

     8. mini_x86-userdebug  

     9. aosp_mako-userdebug  

     10. aosp_hammerhead-userdebug  

     11. aosp_tilapia-userdebug  

     12. aosp_deb-userdebug  

     13. aosp_grouper-userdebug  

     14. aosp_flo-userdebug  

Which would you like? [aosp_arm-eng] 9  

============================================  

PLATFORM_VERSION_CODENAME=REL  

PLATFORM_VERSION=4.4.2  

TARGET_PRODUCT=aosp_mako  

TARGET_BUILD_VARIANT=userdebug  

TARGET_BUILD_TYPE=release  

TARGET_BUILD_APPS=  

TARGET_ARCH=arm  

TARGET_ARCH_VARIANT=armv7-a-neon  

TARGET_CPU_VARIANT=krait  

HOST_ARCH=x86  

HOST_OS=linux  

HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty  

HOST_BUILD_TYPE=release  

BUILD_ID=KVT49L  

OUT_DIR=out  

============================================  

dennis@dubuntu1404:~/devenv/aosp$ make -j4 

注:j4中的数字跟你的CPU个数和核数有关

整个编译过程,看你电脑决定时间长短了。编译成功后会在out目录下生成img文件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值