下载、配置环境、build和运行参考的都是Android Source提供的文档,包括:Initializing a Build EnvironmentDownloading the SourceBuilding the System

我是在OSX 10.10.3上编译的AOSP,记录一下中途碰到的各种问题。

下载

AOSP需要翻墙,而且经常会断,还好是断点续传,坚持个两三天怎么也能下下来。

case sensitive system

我在Mac上对file system只会用Disk Utility进行操作。

make error 1

fatal error: linux/netfilter/xt_DSCP.h: No such file or directory

在目录external/iptables/extensions/../include/linux/netfilter中创建文件xt_DSCP.h。

/*
* based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
* This software is distributed under GNU GPL v2, 1991
*
* See RFC2474 for a description of the DSCP field within the IP Header.
*
* xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
*/
#ifndef _XT_DSCP_TARGET_H
#define _XT_DSCP_TARGET_H
#include <linux/netfilter/xt_dscp.h>
#include <linux/types.h> /* target info */
struct xt_DSCP_info {
__u8 dscp;
}; struct xt_tos_target_info {
__u8 tos_value;
__u8 tos_mask;
}; #endif /* _XT_DSCP_TARGET_H */

make error 2

大概错误提示是jni_generator.py找不到substring方法,Google一番发现应该是JDK的版本有问题,使用Jenv将Mac的JDK版本设置为1.7可以解决。

make error 3

No space left on device

使用Disk Utility增加dmg的大小。

emulator 1

方便使用,需要在.bash_profile中增加:

  export PATH=/Volumes/[dmg title]/android/out/host/darwin_x86/bin

需要注意的是OSX 10.10.3版本中bin目录下没有生成emulator,可以将PATH该为/Volumes/[dmg title]/android/prebuilts/android-emulator/darwin-x86x64,也可以将emulator从该目录拷到/Volumes/[dmg title]/android/out/host/darwinx86/bin下。

emulator 2

  export ANDROID_PRODUCT_OUT=/Volumes/[dmg title]/android/out/target/product/generic

为什么export这个,请参考罗升阳的《Android系统源代码情景分析》。

emulator 3

加完这两个export后会报如下错误:

  emulator: ERROR: You did not specify a virtual device name, and the system directory could not be found.

  If you are an Android SDK user, please use '@<name>' or '-avd <name>' to start a given virtual device (see -help-avd for details).

  Otherwise, follow the instructions in -help-disk-images to start the emulator

增加:

  export ANDROID_BUILD_TOP=/Volumes/[Volumes]/android

emulator 4

最后解决如下错误:

emulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)

emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)

运行emulator时增加参数:

emulator -partition-size 1024

Finally

最终在Mac上编译成功AOSP,并成功运行emulator,可以做进一步源码研究。

Reference

Mac上编译并运行Android5.0源码的更多相关文章

  1. 编译android5.0源码的

    java环境 Android 5.1 用到的jdk不再是Oracle 的 jdk ,而是开源的 openjdk,在ubuntu安装好后,使用如下命令安装jdk: $sudo apt-get insta ...

  2. 编译Docker<v1.9.0>源码和初级安装

    本文主要介绍了如何在POWER CPU处理器上编译和安装Docker服务.很多时候,我们都需要自己编译Docker源码,有的时候是由于自己的处理器没有对应的安装包,有的时候是由于当前的新版本还有发布, ...

  3. 64位centos 下编译 hadoop 2.6.0 源码

    64位os下为啥要编译hadoop就不解释了,百度一下就能知道原因,下面是步骤: 前提:编译源码所在的机器,必须能上网,否则建议不要尝试了 一. 下载必要的组件 a) 下载hadoop源码 (当前最新 ...

  4. MacOS平台上编译 hadoop 3.1.2 源码

    1. 先从官方下载源码:源码下载地址:https://hadoop.apache.org/releases.html,下载 3.1.2 版本 2. 解压缩源码:tar xvf hadoop-3.1.2 ...

  5. 下载android5.0源码

    方法还是与之前我介绍的下载源码的方法一样,但是repo需要更新一下,否则可能会出现以下错误: type commit tag v1.12.16 tagger Conley Owens <cco3 ...

  6. mac OS X Yosemite 上编译hadoop 2.6.0/2.7.0及TEZ 0.5.2/0.7.0 注意事项

    1.jdk 1.7问题 hadoop 2.7.0必须要求jdk 1.7.0,而oracle官网已经声明,jdk 1.7 以后不准备再提供更新了,所以趁现在还能下载,赶紧去down一个mac版吧 htt ...

  7. Ubuntu 下载 & 编译 Android5.1 源码

    ustc & tsinghua android srchttps://lug.ustc.edu.cn/wiki/mirrors/help/aosphttps://mirrors.tuna.ts ...

  8. 在linux操作系统上进行简单的C语言源码的gcc编译实验

    尝试在linux上用gcc 而非封装完好的codeblocks,vs等ide 来编译c和cpp源程序 首先查看我的gcc版本,我的是VM centos 自带的,没有的话得自行安装,安装上gcc就可以在 ...

  9. ambari 2.5.0源码编译安装

    参考:https://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari/index.html Ambari 是什么 Ambar ...

随机推荐

  1. zoj 1874 水题,输出格式大坑

    Primary Arithmetic Time Limit: 2 Seconds      Memory Limit: 65536 KB Children are taught to add mult ...

  2. 谦先生的程序员日志之我的hadoop大数据生涯一

    从一个初级程序员到高级程序员的经历 你好!我是谦先生,我是茫茫程序猿中的一猿,平凡又执着. 刚入行的时候说实话,啥都不懂,就懂点皮毛的java,各种被虐狗的感觉.又写js又写css又写后台...慢慢被 ...

  3. FormView控件下DropDownList是否可以绑定

    在网站下,FormView控件下是可以通过绑定DropDownList的SelectedValue属性来绑定字段来显示 举例: 1 <asp:DropDownList ID="cboU ...

  4. win10 + python3.6 + VSCode + tensorflow-gpu + keras + cuda8 + cuDN6N环境配置

    写在前面的话: 再弄这个之前,我对python也好,tensorflow也好几乎是0认知的,所以配置这个环境的时候,走了不少弯路,整整耗费了一个星期的时间才搭配完整这个环境,简直了...然而最气的是, ...

  5. ListView如何优化

    1.ListView 如何提高其效率? 当 convertView 为空时,用 setTag()方法为每个 View 绑定一个存放控件的ViewHolder 对象. 当 convertView 不为空 ...

  6. LINUX 配置默认程序

    update-alternatives 命令用于配置默认程序,版本切换 1.display 命令,查看命令链接信息 update-alternatives --display name 2.insta ...

  7. Windows下MongoDB常用命令

    以下命令中的启动与暂停服务命令需要使用管理员身份运行cmd.exe,其他命令需要先cd到Mongodb安装目录的bin目录. 1.启动服务:net start [Mongodb服务名].示例: net ...

  8. LeetCode Questions List (LeetCode 问题列表)- Java Solutions

    因为在开始写这个博客之前,已经刷了100题了,所以现在还是有很多题目没有加进来,为了方便查找哪些没加进来,先列一个表可以比较清楚的查看,也方便给大家查找.如果有哪些题目的链接有错误,请大家留言和谅解, ...

  9. LeetCode 455. Assign Cookies (分发曲奇饼干)

    Assume you are an awesome parent and want to give your children some cookies. But, you should give e ...

  10. LeetCode 216. Combination Sum III (组合的和之三)

    Find all possible combinations of k numbers that add up to a number n, given that only numbers from ...