首页 > 代码库 > 基于Ubuntu 14.04 LTS编译Android4.4.2源代码

基于Ubuntu 14.04 LTS编译Android4.4.2源代码

转载自:雨水:http://blog.csdn.net/gobitan/article/details/24367439

基于Ubuntu 14.04 LTS编译Android4.4.2源代码
        Dennis Hu 2014-4-21
环境准备:
基本环境:ubuntu-14.04-desktop-64bit LTS(裸机或者Windows下虚拟机安装均可,12.04也可以,但10.04目前不支持了)
其他要求:空闲磁盘空间100G以上,代码部分接近10G,其他为git和编译中间和目标文件准备
 
==========================================
第一部分:环境初始化
==========================================
1. 安装Oracle JDK
注意:如果编译Android4.4不能用OpenJDK,必须用Oracle JDK1.6,1.7目前是不支持的。
具体如何安装Oracle JDK,请参见我的另一篇单独的文章,[Ubuntu Linux下安装Oracle JDK] http://blog.csdn.net/gobitan/article/details/24322561.
2. 安装必备工具软件
注意:这里与官方的有个包不同,官方的包会报错.
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $sudo apt-get install git 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 
  2. $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so 
$sudo apt-get install git 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
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
3. 配置USB访问权限
将如下内容加入到/etc/udev/rules.d/51-android.rules文件中
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. # adb protocol on passion (Nexus One)
  2. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
  3. # fastboot protocol on passion (Nexus One)
  4. SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
  5. # adb protocol on crespo/crespo4g (Nexus S)
  6. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
  7. # fastboot protocol on crespo/crespo4g (Nexus S)
  8. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
  9. # adb protocol on stingray/wingray (Xoom)
  10. SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
  11. # fastboot protocol on stingray/wingray (Xoom)
  12. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
  13. # adb protocol on maguro/toro (Galaxy Nexus)
  14. SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
  15. # fastboot protocol on maguro/toro (Galaxy Nexus)
  16. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
  17. # adb protocol on panda (PandaBoard)
  18. SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
  19. # adb protocol on panda (PandaBoard ES)
  20. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0600", OWNER="<username>"
  21. # fastboot protocol on panda (PandaBoard)
  22. SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
  23. # usbboot protocol on panda (PandaBoard)
  24. SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
  25. # usbboot protocol on panda (PandaBoard ES)
  26. SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
  27. # adb protocol on grouper/tilapia (Nexus 7)
  28. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
  29. # fastboot protocol on grouper/tilapia (Nexus 7)
  30. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
  31. # adb protocol on manta (Nexus 10)
  32. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
  33. # fastboot protocol on manta (Nexus 10)
  34. SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
# adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
# fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
# adb protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
# fastboot protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
然后执行如下命令,将上述文件中的username替换为你的用户名。
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $sudo sed -i ‘s/username/dennis/g‘ /etc/udev/rules.d/51-android.rules 
$sudo sed -i ‘s/username/dennis/g‘ /etc/udev/rules.d/51-android.rules
4. 配置ccache
安装ccache并将export USE_CCACHE=1加入到~/.bashrc中。
[plain] view plaincopyprint?
  1. $sudo apt-get install ccache 
  2. $source ~/.bashrc 
$sudo apt-get install ccache
$source ~/.bashrc
 
==========================================
第二部分:源代码下载
==========================================
1. 安装repo
(1) 创建目录
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $ mkdir ~/bin 
  2. $ PATH=~/bin:$PATH 
$ mkdir ~/bin
$ PATH=~/bin:$PATH
(2) 下载repo工具
注:由于防火墙的原因,官方提供的链接无法使用,需替换为如下:
官方的为curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
可用的:
[plain] view plaincopyprint?
  1. curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo 
curl http://git-repo.googlecode.com/files/repo-1.12 > ~/bin/repo
(3) 增加可执行权限
[plain] view plaincopyprint?
  1. $ chmod a+x ~/bin/repo 
$ chmod a+x ~/bin/repo
2. 初始化Repo客户端
(1)创建目录
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $mkdir aosp 
  2. $cd aosp 
$mkdir aosp
$cd aosp
(2) 初始化repo
注:后面可能出现网络错误,请先将如下内容加入到/etc/hosts中然后做后面的步骤。
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. 74.125.71.82 www.googlesource.com 
  2. 74.125.31.82 android.googlesource.com 
  3. 203.208.46.172 cache.pack.google.com 
  4. 59.24.3.173 cache.pack.google.com 
74.125.71.82 www.googlesource.com
74.125.31.82 android.googlesource.com
203.208.46.172 cache.pack.google.com
59.24.3.173 cache.pack.google.com
至于为什么要出现网络错误,你懂的!
[plain] view plaincopyprint?
  1. $repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r2 
$repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r2
注意:如果是在虚拟机中执行,需要采用email验证的方式,详细参见参考资料[2].
设置git的用户名和邮件地址,将您的真实email地址和name替换了:
[plain] view plaincopyprint?
  1. git config --global user.email "you@example.com" 
  2. git config --global user.name "Your Name" 
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
修改aosp/.resp/manifest.xml,将fetch=".."改为:
fetch="https://android.googlesource.com/"
 
3. 下载源代码
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $repo sync 
$repo sync
注意:系统可能会提示你升级repo,最好不要升级,除非你有十足信息解决升级后的一系列问题。
 
好了,慢慢等吧,短则数小时,长则几天几夜!我花了5个小时
 
==========================================
第三部分:源代码编译
==========================================
1. 设置ccache
注:aosp为源代码根目录
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $ cd aosp 
  2. $ prebuilts/misc/linux-x86/ccache/ccache -M 50G 
$ cd aosp
$ prebuilts/misc/linux-x86/ccache/ccache -M 50G
2. 设置输出目录
略:由于我未分区,因此采用默认的out目录
3. 初始化编译环境
[plain] view plaincopyprint?
  1. dennis@dubuntu1404:~/devenv/aosp$ . build/envsetup.sh  
  2. including device/samsung/manta/vendorsetup.sh 
  3. including device/generic/mips/vendorsetup.sh 
  4. including device/generic/armv7-a-neon/vendorsetup.sh 
  5. including device/generic/x86/vendorsetup.sh 
  6. including device/lge/mako/vendorsetup.sh 
  7. including device/lge/hammerhead/vendorsetup.sh 
  8. including device/asus/tilapia/vendorsetup.sh 
  9. including device/asus/deb/vendorsetup.sh 
  10. including device/asus/grouper/vendorsetup.sh 
  11. including device/asus/flo/vendorsetup.sh 
  12. including sdk/bash_completion/adb.bash 
  13. dennis@dubuntu1404:~/devenv/aosp$  
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
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. dennis@dubuntu1404:~/devenv/aosp$ lunch 
  2. You‘re building on Linux 
  3. Lunch menu... pick a combo: 
  4.      1. aosp_arm-eng 
  5.      2. aosp_x86-eng 
  6.      3. aosp_mips-eng 
  7.      4. vbox_x86-eng 
  8.      5. aosp_manta-userdebug 
  9.      6. mini_mips-userdebug 
  10.      7. mini_armv7a_neon-userdebug 
  11.      8. mini_x86-userdebug 
  12.      9. aosp_mako-userdebug 
  13.      10. aosp_hammerhead-userdebug 
  14.      11. aosp_tilapia-userdebug 
  15.      12. aosp_deb-userdebug 
  16.      13. aosp_grouper-userdebug 
  17.      14. aosp_flo-userdebug 
  18. Which would you like? [aosp_arm-eng] 9 
  19. ============================================ 
  20. PLATFORM_VERSION_CODENAME=REL 
  21. PLATFORM_VERSION=4.4.2 
  22. TARGET_PRODUCT=aosp_mako 
  23. TARGET_BUILD_VARIANT=userdebug 
  24. TARGET_BUILD_TYPE=release 
  25. TARGET_BUILD_APPS= 
  26. TARGET_ARCH=arm 
  27. TARGET_ARCH_VARIANT=armv7-a-neon 
  28. TARGET_CPU_VARIANT=krait 
  29. HOST_ARCH=x86 
  30. HOST_OS=linux 
  31. HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty 
  32. HOST_BUILD_TYPE=release 
  33. BUILD_ID=KVT49L 
  34. OUT_DIR=out 
  35. ============================================ 
  36. dennis@dubuntu1404:~/devenv/aosp$ make -j4 
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个数和核数有关,详细参见参考资料[3].
整个编译过程,大约花了三个小时。编译成功后会在out目录下生成img文件。
 
5. 将img加载到物理机
(1) 将手机用USB数据线连接到机器
(2) 安装fastboot工具
[plain] view plaincopyprint?
  1. $ sudo apt-get install android-tools-fastboot 
$ sudo apt-get install android-tools-fastboot
(3) 设置ANDROID_PRODUCT_OUT环境变量
将如下部分加入~/.bashrc文件中:
[plain] view plaincopyprint?
  1. export ANDROID_PRODUCT_OUT=/home/dennis/devenv/aosp/out/target/product/mako 
export ANDROID_PRODUCT_OUT=/home/dennis/devenv/aosp/out/target/product/mako
然后保存执行". .bashrc"使其生效。
(4) 以fastboot模式重启手机
[plain] view plaincopyprint?
  1. $ adb reboot bootloader 
$ adb reboot bootloader
此时手机会重启,呈现一个与往不同的fastboot界面
 
(5) 将编译的img刷到目标机
[plain] view plaincopyprint?
  1. dennis@dubuntu1404:~/devenv/aosp/out$ fastboot flashall -w 
  2. -------------------------------------------- 
  3. Bootloader Version...: PRIMEMD04 
  4. Baseband Version.....: I9250XXLJ1 
  5. Serial Number........: 0146A0D00600900B 
  6. -------------------------------------------- 
  7. checking product... 
  8. FAILED 
  9. Device product is ‘tuna‘. 
  10. Update requires ‘mako‘. 
  11. finished. total time: 0.035s 
dennis@dubuntu1404:~/devenv/aosp/out$ fastboot flashall -w
--------------------------------------------
Bootloader Version...: PRIMEMD04
Baseband Version.....: I9250XXLJ1
Serial Number........: 0146A0D00600900B
--------------------------------------------
checking product...
FAILED
Device product is ‘tuna‘.
Update requires ‘mako‘.
finished. total time: 0.035s
(注:由于我的物理机三星I9250在lunch里没有对应的型号,因此会加载失败,这里这是记录过程)
===================================
如果需要编译其他版本,可执行如下步骤,这里选择虚拟机用的通用版本aosp_arm-eng。
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. $ cd aosp 
  2. dennis@dubuntu1404:~/devenv/aosp$ . build/envsetup.sh 
  3. including device/samsung/manta/vendorsetup.sh 
  4. including device/generic/mips/vendorsetup.sh 
  5. including device/generic/armv7-a-neon/vendorsetup.sh 
  6. including device/generic/x86/vendorsetup.sh 
  7. including device/lge/mako/vendorsetup.sh 
  8. including device/lge/hammerhead/vendorsetup.sh 
  9. including device/asus/tilapia/vendorsetup.sh 
  10. including device/asus/deb/vendorsetup.sh 
  11. including device/asus/grouper/vendorsetup.sh 
  12. including device/asus/flo/vendorsetup.sh 
  13. including sdk/bash_completion/adb.bash 
  14. dennis@dubuntu1404:~/devenv/aosp$ lunch aosp_arm-eng 
  15. ============================================ 
  16. PLATFORM_VERSION_CODENAME=REL 
  17. PLATFORM_VERSION=4.4.2 
  18. TARGET_PRODUCT=aosp_arm 
  19. TARGET_BUILD_VARIANT=eng 
  20. TARGET_BUILD_TYPE=release 
  21. TARGET_BUILD_APPS= 
  22. TARGET_ARCH=arm 
  23. TARGET_ARCH_VARIANT=armv7-a 
  24. TARGET_CPU_VARIANT=generic 
  25. HOST_ARCH=x86 
  26. HOST_OS=linux 
  27. HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty 
  28. HOST_BUILD_TYPE=release 
  29. BUILD_ID=KVT49L 
  30. OUT_DIR=out 
  31. ============================================ 
  32. dennis@dubuntu1404:~/devenv/aosp$ make -j4 
  33. ============================================ 
  34. PLATFORM_VERSION_CODENAME=REL 
  35. PLATFORM_VERSION=4.4.2 
  36. TARGET_PRODUCT=aosp_arm 
  37. TARGET_BUILD_VARIANT=eng 
  38. TARGET_BUILD_TYPE=release 
  39. TARGET_BUILD_APPS= 
  40. TARGET_ARCH=arm 
  41. TARGET_ARCH_VARIANT=armv7-a 
  42. TARGET_CPU_VARIANT=generic 
  43. HOST_ARCH=x86 
  44. HOST_OS=linux 
  45. HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty 
  46. HOST_BUILD_TYPE=release 
  47. BUILD_ID=KVT49L 
  48. OUT_DIR=out 
  49. ============================================ 
  50. including ./abi/cpp/Android.mk ... 
  51. including ./art/Android.mk ... 
  52. ....中间过程省略 
  53. Install system fs image: out/target/product/generic/system.img 
  54. out/target/product/generic/system.img+ maxsize=588791808 blocksize=2112 total=576716800 reserve=5947392 
$ cd aosp
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$ lunch aosp_arm-eng
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
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
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
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
============================================
including ./abi/cpp/Android.mk ...
including ./art/Android.mk ...
....中间过程省略
Install system fs image: out/target/product/generic/system.img
out/target/product/generic/system.img+ maxsize=588791808 blocksize=2112 total=576716800 reserve=5947392
编译完成,执行如下命令可以将您刚build好的ROM在模拟器里运行起来,第一次启动的时间可能比较长:
$ emulator &
注意:如果提示找不到emulator命令,可将如下环境变量重新初始化一遍(也就是每次重新进入系统运行的时候,都需要初始化一遍),lunch后面的参数要与你编译的ROM选项一致。
[plain] view plaincopyprint?
  1. $. build/envsetup.sh 
  2. $lunch aosp_arm-eng