Ubuntu12.04下的Android 源码编译
2013-08-05 08:03
337 查看
( 环境配置请参考博文 Ubuntu12.04下的 Android 源码下载
)
Google官方资料参考 http://source.android.com/source/building-running.html
1. 环境设置,
下载好源码后,进入源码目录,即之前执行 repo sync的路径下,用下面两个命令之一,第二个命令简短一点,两个命令效果没区别
2. 选择编译的目标,用lunch指令,参数用来指定目标配置
参数形式是 BUILD-BUILDTYPE,其中 BUILD 是表明要合并的特殊特征的code name,下面是部分参数:
BUILDTYPE 可选下面参数:
新手直接输入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。重新设置后可以正常启动。
4. 编译完成后,在 out/target/product/generics(或maguro或其他)目录下生成多个镜像文件及目录,可以运行模拟器加载这几个镜像文件
$ emulator -avd <有效AVD名称> -ramdisk [ramdisk.img路径] -system [system.img的路径]
不清楚AVD名称的话用下面命令查看
$ android list avd
)
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 name | Device | Notes |
---|---|---|
full | emulator | fully configured with all languages, apps, input methods |
full_maguro | maguro | fullbuild running on Galaxy Nexus GSM/HSPA+ ("maguro") |
full_panda | panda | fullbuild running on PandaBoard ("panda") |
Buildtype | Use |
---|---|
user | 限制访问;适合作为产品 |
userdebug | 类似 "user" 但可以有 root 访问权限和可调试;适用于调试设备 |
eng | 带有附加调试工具的开发配置 |
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。重新设置后可以正常启动。
4. 编译完成后,在 out/target/product/generics(或maguro或其他)目录下生成多个镜像文件及目录,可以运行模拟器加载这几个镜像文件
$ emulator -avd <有效AVD名称> -ramdisk [ramdisk.img路径] -system [system.img的路径]
不清楚AVD名称的话用下面命令查看
$ android list avd
相关文章推荐
- ubuntu12.04 上android源码编译,提示zip error
- Ubuntu12.04下编译android源码4.0.3
- Freescale I.mx 6 Android 4.2.2源码编译环境搭建(基于ubuntu12.04 LTS)
- Ubuntu12.04 64位下载编译 Android 4.2源码
- ubuntu12.04安装android源码编译环境
- Ubuntu12.04下在Android4.0.4源码下载及其编译过程
- Freescale I.mx 6 Android 4.2.2源码编译环境搭建(基于ubuntu12.04 LTS)
- Ubuntu12.04下在Android4.0.4源码下载及其编译过程
- Ubuntu12.04环境下的android源码编译
- ubuntu12.04 android 4.2.1 源码编译SDK 报错
- Freescale I.mx 6 Android 4.2.2源码编译环境搭建(基于ubuntu12.04 LTS)
- ubuntu12.04 32 编译Android2.3源码(源码已有)
- Ubuntu12.04下搭建android源码编译环境全
- ubuntu12.04 64bit 编译android源码时遇到的问题
- Ubuntu12.04下在Android4.0.4源码下载及其编译过程
- ubuntu12.04编译android源码
- Freescale I.mx 6 Android 4.2.2源码编译环境搭建(基于ubuntu12.04 LTS)
- ubuntu12.04 64bit 编译android源码时遇到的问题"make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates"
- Ubuntu12.04下Android4.0.4源码的下载及其编译过程
- 更新、编译、打包android源码(ubuntu12.04)