Code Monkey home page Code Monkey logo

docker-android-build's Introduction

使用docker编译aosp源码

google官方推荐的安卓编译源码为14.04,由于目前的工作环境为macosx环境或者高版本的ubuntu环境,直接在本机编译会有很多问题,不过借助docker这个强大的工具可解决这个烦恼

安装docker

google搜索安装方法即可

docker更换国内镜像源

为了加速docker镜像的拉取,可以设置国内镜像源,例如设置成网易的镜像源方法如下:

  • 创建 /etc/docker 目录
sudo mkdir -p /etc/docker
  • /etc/docker 目录下创建 daemon.json 文件,写入以下内容
{
    "registry-mirrors": ["http://hub-mirror.c.163.com"]
}
  • 重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker

创建编译镜像

由于aosp源码推荐在ubuntu 14.04版本上编译,所以我们基于14.04来创建镜像。这里准备使用5.1.1版本的源码,所以需要安装jdk7。

构建镜像的细节详见 Dockerfile

使用如下命令创建镜像

docker build -t aosp-build:1.0.0 .

查看创建成功的镜像 images

使用镜像编译源码

  1. 下载aosp源码 推荐去清华镜像站下载打包好的源码即可,也可以使用repo下载指定版本,具体详见网站文档
  2. 假设aosp源码下载路径为 /home/user/aosp,使用aosp-build镜像创建容器,并挂载aosp源码路径
docker run -itd --name aosp-build -v /home/user/aosp:/home/aosp aosp-build:1.0.0
docker exec -it aosp-build /bin/bash
  1. 进入 /home/rom 目录,直接编译源码即可
. build/envsetup.sh
lunch
make -j8

docker-android-build's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-android-build's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.