1,下载安装vmware
2,下载ubuntu1604镜像文件
3,安装ubuntu1604
——会出现分辨率问题,导致安装界面显示不全,这时按下alt键,拖动鼠标可以移动界面。
4 ,更换软件源为阿里云
为了更快的安装软件,使用Ubuntu官方指定的国内软件源阿里云
4.1备份sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.ubuntun
4.2删除sources.list, 新建sources.list, 并粘贴阿里源配置
rm /etc/apt/sources.list
vim /etc/apt/sources.list
-------------------------------------------------
如果是图形界面,可以直接用gedit /etc/apt/sources.list编辑
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
5, 安装依赖
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install lib32z-dev ccache
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
6,安装open-jdk-7
由于Ubuntu 16.04没有OpenJDK7的源,因此在16.04上安装OpenJDK7需要执行下面的命令:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
配置OpenJDK.打开/etc/profile文件:
sudo gedit /etc/profile
末尾追加下面代码:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
修改了/etc/profile文件需要重启才能生效,但使用下面命令可以在不重启的情况下在当前bash环境生效:
source /etc/profile
检查OpenJDK配置是否正确:
java -version
7,安装repo, 配置git, 拉取Android源码
git config --global user.name "用户名"
git config --global user.email "用户邮箱"
注意git config命令的–global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以
对某个仓库指定不同的用户名和Email地址。
配置好之后,查看配置命令:
git config -l
8,编译Android源码,处理报错问题。
——8.1,ubuntu1604编译android6.0要修改clang配置。
(art/build/Android.common_build.mk )
——8.2,内存不足问题。
参考https://www.cnblogs.com/wanyuanchun/p/5126099.html
给ubuntu1604新增swap大小后,编译通过。
——8.3,交叉编译报错(make -j4)
scripts/Makefile.build:455: recipe for target 'drivers/comip' failed
--------------------------------
ubuntu1604 自带make版本过高(make4.1)
参考https://www.jianshu.com/p/e42746bd0bac
安装低版本make3.8.1
参考https://blog.csdn.net/sjzzdf123/article/details/79863548
----------------------------------
不用交叉编译(不用参数-j), 直接用make不会报错,但编译速度慢。
9, 安装ssh
10,安装samba, 配置共享文件。
================================================================
ubuntu1604编译android6.0art\build\Android.common_build.mk中的配置。
# Clang build support.
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
### ##修改开始## ###
HOST_OS_TYPE = Ubuntu-16.04
ifneq ($(findstring $(HOST_OS_TYPE),$(HOST_OS_EXTRA)),)
ART_HOST_CLANG := false
$(shell echo > $(OUT_DIR)/MakeMonitor.log)
$(shell echo 1.HOST OS is Ubuntu-16.04 ART_HOST_CLANG set to
$(ART_HOST_CLANG) >> $(OUT_DIR)/MakeMonitor.log)
else
HOST_OS_TYPE = Ubuntu-14.04
ifneq ($(findstring $(HOST_OS_TYPE),$(HOST_OS_EXTRA)),)
ART_HOST_CLANG := true
$(shell echo > $(OUT_DIR)/MakeMonitor.log)
$(shell echo 2.HOST OS is Ubuntu-14.04 ART_HOST_CLANG set to
$(ART_HOST_CLANG) >> $(OUT_DIR)/MakeMonitor.log)
endif
endif
### ##修改开结束## ###
#ART_HOST_CLANG := true
endif
------------------------------------------------------------------------------------------------------------
--------
没有增加ubuntu1604判断的配置如下:
# Clang build support.
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
================================================================
###清华源, 参考 https://www.cnblogs.com/mmdln/p/9071699.html.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse