下载、配置环境、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. python 多线程和多进程的区别 mutiprocessing theading

    多线程可以共享全局变量,多进程不能.多线程中,所有子线程的进程号相同:多进程中,不同的子进程进程号不同. #!/usr/bin/python # -*- coding:utf-8 -*- import ...

  2. java 学习笔记 读取配置文件的三种方式

    package com.itheima.servlet.cfg; import java.io.FileInputStream; import java.io.FileNotFoundExceptio ...

  3. jquery系列教程3-DOM操作全解

    全栈工程师开发手册 (作者:栾鹏) 快捷链接: jquery系列教程1-选择器全解 jquery系列教程2-style样式操作全解 jquery系列教程3-DOM操作全解 jquery系列教程4-事件 ...

  4. 移动端自动化自动化(Android&iOS)——Appium

    Appium-Python 移动端自动化环境搭建 Appium介绍 Appium是一个开源.跨平台的测试框架,可以用来测试原生及混合的移动端应用.Appium支持iOS.Android及Firefox ...

  5. 【学习】原生js学习笔记1:添加class和使input为不可用

    <input type="checkbox" id="new_check" onChange="noUse()" checked> ...

  6. HTML之事件处理程序

    HTML事件 <body> <input type="button" value="按钮1" id="but1" oncl ...

  7. 基于8211lib库对s57电子海图的解析和存储

    电子海图是为适用航海需要而绘制的包含海域地理信息和航海信息的一种数字化的专题地图,符合国际标准的电子海图数据统称为S-57电子海图.本文主要在S-57电子海图数据的理论模型和数据结构的基础上,实现对S ...

  8. (转)java的动态代理机制详解

    原文出自:http://www.cnblogs.com/xiaoluo501395377/p/3383130.html 在学习Spring的时候,我们知道Spring主要有两大思想,一个是IoC,另一 ...

  9. Spark: Job in detail

    1.sc.runJob -> dagScheduler.runJob -> submitJob 2.DAGSchedueler::submitJob 会创建 JobSubmitted 的 ...

  10. 双向链表--Java实现

    /*双向链表特点: *1.每个节点含有两个引用,previos和next,支持向前或向后的遍历(除头节点) *2.缺点插入或删除的时候涉及到引用修改的比较多 *注意:下面的双向链表其实也实现了双端链表 ...