Ubuntu Touch环境搭建
最近搞了一下Nexus 5的MultiRom Manger,体验了一把Ubuntu Touch和Android L,总体感觉还不错,不过Android L的NFC驱动还有问题,Ubuntu Touch优化还不足,画面有点卡,而且无法关背光。于是萌生了参与Ubuntu Touch驱动开发的念头,也算是把工作当成一种兴趣吧。
Ubuntu Touch for Nexus 5是非官方的,官方的只有Nexus 4,7,10。我们从MultiRom Manager可以直接下载到for Nexus 5的最新版本。
鉴于中文博客中并没有相关教程,只能参照 Ubuntu Touch 环境搭建的官方文档:
https://wiki.ubuntu.com/Touch/Building
以下记录我搭建Ubuntu Touch的过程(跟着上面的wiki走)。
Building Ubuntu Touch Android pieces from source
Whether you want to build Ubuntu Touch for the currently supported Nexus devices or want to port it to a new target, you need to set up your working environment to build Android from source. This setup is more or less the same whether you are building AOSP or a project based on it such as CyanogenMod, SEAndroid or Ubuntu Touch.
If you are new to building Android sources you may want to check out this document and others in the Getting Started section on the Google documentation site, as it covers the basics and terminology of AOSP building. While Ubuntu Touch uses some helper scripts as detailed below, if will nonetheless be helpful to understand what is going on under the hood especially if you want to work on this part of the project.
http://source.android.com/source/initializing.html
For Ubuntu Touch, you can find all the needed Android git repositories at https://code-review.phablet.ubuntu.com/#/admin/projects/. This is basically a mirror of AOSP 4.4.2_r1, but containing only the needed low level services used by Android (e.g. no Dalvik at all).
For any Android related project on our git server, you'll find a branch named phablet-4.4.2_r1. This branch contains a static known git HEAD and the required changes needed for Ubuntu, including our custom Android manifest.
从源码编译Ubuntu Touch的Android部分
无论你想编译现在已经支持的Nexus设备,还是想为一个新设备移植Ubuntu Touch,你都需要的搭建编译环境来编译Android源码。该教程大致和你编译AOSP(Android Open Source Project)或者基于AOSP的项目是一样的,如CyanogenMod,SeAndroid或者Ubuntu Touch。
如果你是第一次编译Android源码,你可能需要下面这个文档,和Google文档网站Getting Started章节上的其他相关文档,文档讲解了AOSP编译的基础和一些术语。在下面的环节中Ubuntu Touch会使用一些辅助脚本。如果你打算在项目上做相关开发,通过浏览这些文档你会更明白接下来的每一步是在做什么。
http://source.android.com/source/initializing.html
你可以在https://code-review.phablet.ubuntu.com/#/admin/projects/找到所有搭建Ubuntu Touch需要的Android git repositories(repo是一个多git项目管理工具,这个东西在天朝不稳定的网络中显得非常难用)。这是一个基于AOSP 4.4.2_r1的镜像,但只包含了低层Android运行所需要的服务(例如没有Dalvik)。
在我们的git服务器上任意一个Android相关的项目,你都会找到一个叫phablet-4.4.2_r1的分支,这个分支包含了一个git HEAD和包括custom Android manifest(Ubuntu Touch的repo的Manifest,包含了所有Ubuntu Touch的基础git项目)等对于Ubuntu需要修改的代码。(这段不太明白想说什么)
该段只是介绍,没有需要执行的部分。
Set up your development environment
At this moment we're using the Android code base provided by Android AOSP.
Everything we take from Android is just C/C++, so you'll notice that your Android build environment will be way smaller than when comparing to the traditional Android builds.
For development you can run any 64-bit Desktop version of Ubuntu between 12.04 LTS and 13.04.
It's not strictly necessary, but it's helpful to install ccache. (http://source.android.com/source/initializing.html#ccache in the general Android Setup guide should help with this.)
Additional packages which are used to build the host tools:
$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtoolOn Utopic (and maybe other) the 4.8 version of g++ is needed:
$ sudo apt-get install g++-4.8-multilibBefore 14.04 Trusty you'll also need to set up the tools PPA.
Then you need to install phablet-tools:
$ sudo apt-get install phablet-toolsThis will also install the repo tool, used to sync the Android repositories. Learn more about the repo tool. If you already have a repo tool in your $PATH from previous android development, be sure to remove it or make sure it's after the system repo command in the path. To check that the right repo command is used, you can issue $ which repo. This should return /usr/bin/repo.
You can check out the source code using the repo and git tools already familiar to Android ROM developers, as described here
https://wiki.ubuntu.com/Touch/AndroidDevel
Alternately, all the Android code can be downloaded using the phablet-dev-bootstrap tool provided by the phablet-tools package installed in the previous step. This tool is a Python wrapper around repo and used to also check out bzr repositories before all code was managed by repo and git. For the purposes of getting the source code for development it is no longer needed.
To get the code setup run:
phablet-dev-bootstrap [target_directory]If for some reason the sync ends midway, you can continue the sync with the -c switch, so the command would be:
phablet-dev-bootstrap -c [target_directory]Alternatively, if you are just building an image for an already supported device, you can specify the -v switch:
phablet-dev-bootstrap -v [device codenames] [target_directory]The phablet-dev-bootstrap command will automatically use the repo tool with the Ubuntu Touch Preview custom manifest to download all the git repositories and needed data. Be aware that this step takes a long time and requires at least 15GB (plus 2-3GB for the binary output).
搭建你的编译环境
我们将使用Android基础组件(基于Android AOSP)来编译。
我们只会用到Android中的C/C++代码,所以你会发现你的编译环境会比传统的Android编译环境要小。
你可以使用Ubuntu 12.04LTS到13.04的64位桌面版来开发Ubuntu Touch。(博主使用Mint 14.04,基于Ubuntu 14.04)
我们可以安装ccache(ccache会加快Android编译速度),但不是必需的。(http://source.android.com/source/initializing.html#ccache Android配置向导会指导你如何安装)
我们还需要这些安装包来编译主机上的编译工具:
$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool
在Utopic(Ubuntu 14.10)(或者其他)中,还需要安装g---4.8
$ sudo apt-get install g++-4.8-multilib
在Ubuntu 14.04稳定前你还需要安装PPA工具。(只需要把“Add PPAs (pre Trusty only)”那一步执行就ok了。)
然后安装phablet-tools:
$ sudo apt-get install phablet-tools
这会安装repo工具,repo用于同步Android的repositories。 点击了解repo工具。如果你已经有了repo工具且已经在之前的Android开发中把执行路径加入到$PATH中了,请把repo删除,或保证在$PATH中repo的路径在系统的repo command的路径(如/bin/repo)之后。你可以使用$ which repo验证repo路径是否正确。如果正确,会返回/usr/bin/repo。
(这段还没弄清楚什么意思,因为我还没编译过,应该保证是/usr/bin/repo就可以了。到时候回来补充)
然后使用repo和git(只需要安装git,不需要实际执行,repo会调用git工具),从以下网址获取Android源码。这一步对于Android Rom开发者应该很熟悉。
https://wiki.ubuntu.com/Touch/AndroidDevel
(此链接会另写一篇文章,下载源码的工作都在这个链接中)
使用之前步骤已经安装了的phablet-dev-bootstrap,就可以一个个项目地下载所有的Android代码(大概可有640多个)。这个工具使用Python将repo封装了起来。在所有的代码被repo和git管理之前,这个工具也可以用于下载bzr repositories(和repo相似的一个管理工具)的工程。不过只用于获取开发用的源码的话,已经不需要这个功能了。
接下来让代码跑起来:
phablet-dev-bootstrap [target_directory]
如果发生某些错误导致sync中途停止了,你可以使用-c参数继续同步:
phablet-dev-bootstrap -c [target_directory]
如果你只是编译一个已经被支持的设备的烧录文件,你可以使用-v参数:
phablet-dev-bootstrap -v [device codenames] [target_directory]
phablet-dev-bootstrap命令会使用repo工具自动下载manifest(项目列表)然后下载所有的git项目和需要的数据。注意这个步骤要很长的时间,而且需要至少15GB(加上2-3GB的二进制文件输出)的空间。
版权所有,转载请注明出处:
Ubuntu Touch环境搭建的更多相关文章
- win10子系统linux.ubuntu开发环境搭建
移步新博客... win10子系统linux.ubuntu开发环境搭建
- Ubuntu 开发环境搭建教程
Ubuntu 开发环境搭建教程 本文原始地址:https://sitoi.cn/posts/18425.html 更新 sudo apt upgrade sudo apt update 生成本机密钥 ...
- Ubuntu开发环境搭建
linux开发不得不用虚拟机,为了节省系统资源.决定采用Ubuntu Server逐步搭建出具有图形界面的开发环境. ubuntu server 安装英文版 安装选择选generic,不要LVM选项. ...
- vn.trader的Ubuntu运行环境搭建教程
作者:量衍投资 转载请注明来源:维恩的派(www.vnpie.com) 准备Ubuntu 建议使用一个新安装干净的Ubuntu环境(如果你一定要使用老环境也行,万一不幸掉坑后再回到这步就好),我这里使 ...
- ubuntu 开发环境搭建 lisp gcc python perl mysql
一: lisp sudo apt-get install emacs sudo apt-get install sbcl sudo apt-get install slime emacs里 Alt+x ...
- ubuntu hadoop环境搭建
安装Ubuntu系统:这个自行安装 下载jdk:我下的是1.8.0_141d的,下载好后在usr/lib下新建一个jvm的文件夹用来存放Java的文件,下载好的jdk可以在其他地方解压或者jvm里面解 ...
- sencha touch环境搭建
引入touch文件,包括resources和sencha-touch-debug.js文件 index.html文件内容如下: <!DOCTYPE HTML> <html> & ...
- Ubuntu Mininet环境搭建
我们通过源码方式搭建mininet仿真平台,使用git下载mininet源码 git clone git://github.com/mininet/mininet 下载完成之后,使用下面命令选择安装版 ...
- Ubuntu Spark 环境搭建(转)
在安装Spark之前,我们需要在自己的系统当中先安装上jdk和scala 可以去相应的官网上下载: JDK:http://www.oracle.com/technetwork/java/javase/ ...
随机推荐
- Leetcode. 回文字符串的分割和最少分割数
Q1: 回文字符串的分割 Given a string s, partition s such that every substring of the partition is a palindrom ...
- HTML如何给table添加滚动条
HTML如何给table添加滚动条 要给table添加滚动条其实很简单,主要是给table放到一个div里去,然后再设置div显示滚动条即可.示例代码如下所示: <!--div比table大小要 ...
- ExtJS6.0扩展日期选择控件为也可以选择时间
PS:ExtJS自带的日期选择控件只能够选择日期,但是现在的需求需要精确到秒,所以在网上搜索了一些例子(大部分是4.0的)作为参考,然后改出了6.0可用的一个日期时间选择控件. 1.找到extjs6. ...
- Alpha冲刺(7/10
团队信息 队名:爸爸饿了 组长博客:here 作业博客:here 组员情况 组员1(组长):王彬 过去两天完成了哪些任务 学会了POSTMAN的使用,对后端已经完成的接口进行了收发消息正确性的验证 推 ...
- StanFord 编程方法
教程下载地址:http://www.yyets.com/resource/26208 定制工具下载地址:http://www.stanford.edu/class/cs106a/cgi-bin/cla ...
- 【bzoj1391】[Ceoi2008]order 网络流最小割
原文地址:http://www.cnblogs.com/GXZlegend/p/6796937.html 题目描述 有N个工作,M种机器,每种机器你可以租或者买过来. 每个工作包括若干道工序,每道工序 ...
- 猜数字(C语言版)
编程先由计算机“想”一个1到100之间的数请人猜,如果人猜对了,则结束游戏,并在屏幕上输出人猜了多少次才猜对此数,以此来反映猜数者“猜”的水平,否则计算机给出提示,告诉人所猜的数是太大还是太小,最多可 ...
- Charles 抓包发现自动跳转为https 问题梳理
今天遇到个有点意思的问题.特此记录. 业务场景: 做了一个页面,但是对外是挂载在京东主站上.如:www.jd.com/yifu/123456.html. 现场情况: 在本地/测试环境/预发环境中,每次 ...
- 【考试记录】4.8 Path (网络流 —— 劲题)
手抄代码 + 学习指针 + 冥思苦想一晚上终于——在一瞬间开窍了.果然题目都是这样:突破了一个点,一切都是柳暗花明. 题面描述: 样例: 这道题目,首先注意到给定的边的性质:这些边在平面上构成了一棵树 ...
- [NOIP2017]列队 线段树
---题面--- 题解: 之前写的splay,,,然而一直没调出来,我感觉是某个细节想错了,,然而已经重构4次代码不想再写splay了.于是今天尝试了线段树的解法. 首先因为每次出列之后的变化都是将当 ...