众所周知,Android是开源的。这样就可以下载Android的全部代码,进行编译生成二进制镜象文件。

开发平台

Ubuntu.

工具安装

$ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf

libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl

libncurses5-dev zlib1g-dev

源码下载

$ cd ~

$ mkdir bin

$ curl http://android.git.kernel.org/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

repo是一个工具,用来配合Git下载源码的。

$ export PATH=$HOME/bin:$PATH

$ mkdir mydroid

$ cd mydroid

$ repo init –u git://android.git.kernel.org/platform/manifest.git –b [BRANCH_NAME]

$ repo sync

编译生成

$ cd mydroid

$ make

官方指导可访问:http://source.android.com/source/download.html

另一篇可参考的文章:http://mmmyddd.freeshell.net/wiki/android/build.html

运行模拟器

要运行模拟器,至少需要4个images:

- system.img   : the *initial* system image.
- ramdisk.img  : the ramdisk image used to boot the system.
- userdata.img : the *initial* user data image (see below).
- kernel-qemu  : the emulator-specific Linux kernel image.

编译完成后,生成的system.img,ramdisk.img,userdata.img在目录<src_directory>/out/target/product/generic/下。

kernel-qemu在目录<src_directory>/prebuilt/android-arm/kernel/下。

模拟器启动时,自动在路径<src_directory>/prebuilt/android-arm/kernel/下查找kernel-qemu,但还要用户显示指明另外3个images的路径。模拟器通过查看环境变量ANDROID_PRODUCT_OUT来确定另外3个images的路径。因此,启动前先设置export ANDROID_PRODUCT_OUT=<src_directory>/out/target/product/generic。

设置好环境变量后,切换到<src_directory>/out/host/linux-x86/bin/目录,运行./emulator 就可以加载生成的images运行Android系统了。

如果在运行emulator时出现诸如“emulator: ERROR: There is no user data image in your build directory. Please make a full build”的错误,请先检查文件的权限。

emulator相关的文档:

ray@ray-ubuntu:~/android_2_2/out/host/linux-x86/bin$ ./emulator -help-build-images

The emulator detects that you are working from the Android build system
  by looking at the ANDROID_PRODUCT_OUT variable in your environment.

If it is defined, it should point to the product-specific directory that
  contains the generated system images.
  In this case, the emulator will look by default for the following image
  files there:

- system.img   : the *initial* system image.
    - ramdisk.img  : the ramdisk image used to boot the system.
    - userdata.img : the *initial* user data image (see below).
    - kernel-qemu  : the emulator-specific Linux kernel image.

If the kernel image is not found in the out directory, then it is searched
  in <build-root>/prebuilt/android-arm/kernel/.

Skins will be looked in <build-root>/sdk/emulator/skins/

You can use the -sysdir, -system, -kernel, -ramdisk, -datadir, -data options
  to specify different search directories or specific image files. You can
  also use the -cache and -sdcard options to indicate specific cache partition
  and SD Card image files.

For more details, see the corresponding -help-<option> section.

Note that the following behaviour is specific to 'build mode':

- the *initial* system image is copied to a temporary file which is
    automatically removed when the emulator exits. There is thus no way to
    make persistent changes to this image through the emulator, even if
    you use the '-image <file>' option.

- unless you use the '-cache <file>' option, the cache partition image
    is backed by a temporary file that is initially empty and destroyed on
    program exit.

SPECIAL NOTE: If you are using the emulator with the Android SDK, the
  information above doesn't apply. See -help-sdk-images for more details.

转载于:https://www.cnblogs.com/RayLee/archive/2010/11/23/1885482.html

Android source开发环境搭建相关推荐

  1. Eclipse IDE 使用技巧和Android App 开发环境搭建和配置

    写在前面: 本片文章只是记录了自己学习时的一些笔记,纯粹是为了自己后面方便查找,片言碎语,不适合大家浏览,请大家不要参考这篇文章. 正文: Eclipse IDE 使用技巧               ...

  2. Android Studio开发环境搭建准备

    Android Studio 是一个Android开发环境,基于IntelliJ IDEA. 类似 Eclipse ADT,Android Studio 提供了集成的 Android 开发工具用于开发 ...

  3. android studio开发环境搭建,国内服务器代理下载android sdk

    android studio开发环境搭建 1,百度android studio,下载安装: 2,启动Fetching Android SDK component information http:// ...

  4. Android Studio开发环境搭建(图文教程)

    Android Studio开发环境搭建 一.下载Android Studio 二.安装Android Studio 三.下载Android SDK 四.创建第一个Android工程 五.下载和创建模 ...

  5. 基于Eclipse平台的Android OpenCV开发环境搭建

    基于Eclipse平台的Android OpenCV开发环境搭建 作者:雨水, 日期:2016-1-31,CSDN博客:http://blog.csdn.net/gobitan 摘要:本文主要记录了如 ...

  6. Android NDK 开发环境搭建(二)----来源http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.htm

    随笔- 116  文章- 0  评论- 106  android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创) android 最新 N ...

  7. Android Flutter开发环境搭建

    1.搭建 Flutter 开发环境 本栏亦在快速上手Android Flutter,Flutter框架就不介绍了,框架这个东西怎么说呢,对于大部分人来说只是了解即可,如需了解的话,可以度娘资料很多. ...

  8. Android(一)——Eclipse+ADT 和 Android Studio 开发环境搭建及介绍

    文章目录 1. 前言介绍 1.1 JDK安装与配置 1.2 IDE开发APP流程 1.3 相关术语的解析 1.4 ADB相关指令 1.5 APP程序打包与安装流程 2. 开发环境搭建 2.1 Ecli ...

  9. android java 开发环境搭建

    1.环境搭建 1.1.JDK安装 1.2.Eclipse安装 1.3.Android SDK下载和安装(下载好SDK后打开android sdk manager,下载和安装android对应手机and ...

最新文章

  1. Iptables架构
  2. 建立一个按年龄排序的有序链表,每个结点包括学号、姓名、性别、年龄。建立一个新的结点,通过年龄将此结点插入到链表中去,使之仍然有序
  3. Cassandra与RDBMS的设计差别
  4. 2021年春季学期-信号与系统-第四次作业参考答案-第三小题
  5. NLTK与NLP原理及基础
  6. bzoj1212: [HNOI2004]L语言
  7. ubuntu 编译内核并更换
  8. nyoj 1261 音痴又音痴的LT(离散化+树状数组求K小数)
  9. 一招彻底帮你搞定HashMap源码,项目实战
  10. 微信退款通知,退款回调数据解密.SHA256签名AEAD_AES_256_GCM解密
  11. 使用Moq框架的各种模拟设置
  12. configure/make的shared object参数
  13. 异常数据剔除---格拉布斯准则(java实现)
  14. 外贸推荐:询盘回复的全面流程
  15. 关于人工智能的天马行空
  16. mysql jdbc dao_MYSQL 之 JDBC(九):增删改查(七)DAO的补充和重构
  17. 恶意访问网站的策略处理,IP访问限制
  18. k8s学习笔记5-部署和应用ingress-nginx-controller(v1.3.0)
  19. 动态监控网卡流量异常
  20. 电竞级还带主动降噪,莱仕达X2无线蓝牙耳机实测,品控值得安利

热门文章

  1. MonkeyRunner——如何在实体机上启动一个程序
  2. 一个很好的分页存储过程
  3. s5p4418 android 驱动 hal 应用之led 串口 rs485 can总线应用(app 有源码)
  4. s5p4418 Android 4.4.2 驱动层 HAL层 服务层 应用层 开发流程记录(三 APP应用)
  5. 【鬼网络】之DNS域名解析服务
  6. python语言特点依赖平台吗_python语言的特点
  7. 手把手教你将pyqt程序打包成exe(1)
  8. 小琛和他的学校(dfs)
  9. MQTT 轻量版实例发布,满足更多移动互联场景
  10. 媒体声音 | 憋了这么久,阿里云数据库再放大招