Ubuntu 14.04 编译 Android 4.2.2 for Tiny4412
.
.
.
.
.
在学校里是用 Redhat 6.4 编译的 Android 4.2.2 很顺利,把源码包拷贝到笔记本上的 Ubuntu 14.04 上再编译遭遇了各种坑,所以便有了这篇博客记录解决每一个坑的过程。所幸这些坑解决起来还不算复杂,稍微 Google 一下就找到了解决方案。
1.首先是安装 JDK 和 arm-linux-gcc 工具链,这两步只是解压缩之后配置环境变量就行了,所以这里就不再赘述了。
注意 JDK 必须采用 1.6 版本的,据说 android 4.x 都需要使用标准的 JDK 1.6 编译,也就是说 OpenJDK 是不行的,必须用 Sun 的 JDK,这一点我没有亲测过。
2.安装 gperf,我这里用的是 3.0.4,采用源码编译安装。
[yuhuashi@local android]$ tar xvzf gperf-3.0..tar.gz
[yuhuashi@local android]$ cd gperf-3.0./
[yuhuashi@local gperf-3.0.]$ ./configure
[yuhuashi@local gperf-3.0.]$ make -j4
[yuhuashi@local gperf-3.0.]$ make install
[yuhuashi@local android]$ man gperf
OK,如果没有报错的话,那么恭喜你第二步成功了。
3.接下来便进入正题了,开始编译 android 源码,版本是 4.4.2。
因为是在 Tiny4412 开发板上运行,所以代码包可能被修改过,具体有没有被修改过我也不知道,因为还没有研究过 android 移植,暂时先把步骤记录下来。
[yuhuashi@local android]$ tar xvf android-4.2.2_r1-fs-.tar.gz
[yuhuashi@local android]$ cd android-4.2.2_r1/
设置环境变量
[yuhuashi@local android-4.2.2_r1]$ source setenv
选择编译适用的平台
[yuhuashi@local android-4.2.2_r1]$ lunch
发现出现了一串"无法找到 bison 命令"的错误提示,于是安装 bison
[yuhuashi@local android-4.2.2_r1]$ sudo apt-get install bison
注意 千万不要手贱把 bison++ 也装上了,否则编译的时候会出现一个 double free 的错误!
接下来要开始编译了: ====前方高能预警,请无关人员立即撤离,关闭所有非必要运行的程序,并确保散热器正常工作!!!====
[yuhuashi@local android-4.2.2_r1]$ make -j4
过程中出现了 Switch.pm 的错误,具体的错误信息没有记录下来,如果各位也遇到了同样的错误,make 会自动停止,所以只写一下解决的方法吧。
其实只需要安装一下 perl 的 switch 库即可:
sudo apt-get install libswitch-perl
安装好 switch 库后重新 make -j4 继续编译。
过了一会儿出现了一个这样的错误:
byteswap.h:22:3: error: #error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead.
解决办法是安装 GCC 的 multilib 库,然后 make -j4 继续编译。
sudo apt-get install gcc-multilib
OK,所有的坑都解决了,经过将近2个小时的高速运转之后终于见到了如下提示:
Creating filesystem with parameters:
Size: 685768704
Block size: 4096
Blocks per group: 32768
Inodes per group: 6976
Inode size: 256
Journal blocks: 2616
Label:
Blocks: 167424
Block groups: 6
Reserved block group size: 47
Created filesystem with 1104/41856 inodes and 52043/167424 blocks
+ '[' 0 -ne 0 ']'
Running: simg2img out/target/product/tiny4412/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/tiny4412/obj/PACKAGING/systemimage_intermediates/unsparse_system.img
Running: e2fsck -f -n out/target/product/tiny4412/obj/PACKAGING/systemimage_intermediates/unsparse_system.img
e2fsck 1.41.14 (22-Dec-2010)Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
out/target/product/tiny4412/obj/PACKAGING/systemimage_intermediates/unsparse_system.img: 1104/41856 files (0.0% non-contiguous), 52043/167424 blocks
Install system fs image: out/target/product/tiny4412/system.img
out/target/product/tiny4412/system.img+ maxsize=700123776 blocksize=4224 total=203674048 reserve=7075200
如果你也看到了类似的提示消息,恭喜你成功了!
编译的结果在out文件夹下。
4.接下来生成刷机需要的 img 镜像文件
不过这需要依赖 UBoot 的一个工具:mkimage,如果你之前编译过 UBoot,可以在 UBoot 的 tools 目录下找到这个程序,也可以通过 apt-get 来安装它:
[yuhuashi@local android-4.2.2_r1]$ sudo apt-get install u-boot-tools
有了这个工具我们便可以制作 img 镜像文件了
[yuhuashi@local android-4.2.2_r1]$ ./gen-img.sh
OK,看看是不是在当前目录下出现了下面这几个文件:
[yuhuashi@local android-4.2.2_r1]$ ls
system.img
userdata-16g.img
userdata-4g.img
userdata-8g.img
userdata.img
ramdisk-u.img
......
隐藏了若干不相关文件
如果出现了这几个文件,那么说明刷机必要的镜像文件我们已经有了,恭喜你,还差一个内核就可以在开发板上烧写系统了。
现在只是编译了 android 本身,内核还没有编译,明天继续记录编译内核的过程。
Ubuntu 14.04 编译 Android 4.2.2 for Tiny4412的更多相关文章
- [原]Ubuntu 14.04编译Android Kernel
如何编译android kernel参考官方文档:https://source.android.com/source/building-kernels.html 在Ubuntu 14.04上编译a ...
- 在ubuntu 14.04 编译android 2.3.1 错误解决办法
首先必须降低gcc版本: sudo apt-get install gcc-4.4sudo apt-get install g++-4.4sudo rm -rf /usr/bin/gcc /usr/b ...
- Ubuntu 14.04 下 android studio 安装 和 配置【转】
本文转载自:http://blog.csdn.net/xueshanfeihu0/article/details/52979717 Ubuntu 14.04 下 android studio 安装 和 ...
- ubuntu 14.04编译安装xen4.4总结
1. 安装环境 操作系统:ubuntu14.04 xen版本:xen4.4 2. 依赖包的安装 在安装xen之前先进行依赖包的安装,在不停得尝试之后,总结出以下需要安装的依赖包. sudo apt-g ...
- Ubuntu 14.04 设置Android开发环境
准备Java环境 本文仅仅安装sdk,不安装什么IDE,由于我仅仅须要命令行模式开发就可以. 首先安装openjdk 1.6.然后安装ant.这个不赘述. 下载SDK 从这里下载SDK for Lin ...
- Ubuntu 14.04 编译安装 boost 1.58
简介 Boost is a set of libraries for the C++ programming language that provide support for tasks and s ...
- Ubuntu 14.04 编译安装 husky
简介 Husky是一个大数据分布式开发框架,用C++开发,因为粗粒度(coarse-grained)平台(如Spark,Hadoop,Flink)MR耗时太大,然后细粒度(fine-grained)平 ...
- ubuntu 14.04 编译安装 nginx
下载源码包 nginx 地址:http://nginx.org/en/download.html 下载nginx 1.4.7 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到 ...
- Ubuntu 14.04 编译newLISP 10.6.0
1. 确保安装了gcc4.8.2 2. 安装须要的库: apt-get install libreadline6 libreadline6-dev 3. 下载并解压newLISP源码,这个不多说了,去 ...
随机推荐
- Eclipse SQLExplorer插件的安装和使用
from: http://blog.csdn.net/flashlm/archive/2007/06/30/1672836.aspx 插件名称: SQLExplorer 插件分类: SQL Edito ...
- Selenium2自动化测试实战序言
记得很久之前接触自动化的时候看了一本关于某早期自动化测试工具的书,书名已经记不得了,内容却一直印象深刻.因为那本书根本就是把官方文档有选择性的翻译一遍,对于实际应用来说其作用几乎是零.因此从那时候起我 ...
- HANA初印象
今天手懒,看了一些SAP HANA 的一些外文介绍,不翻译了,直接剽窃过来,供参考. 1. HANA 是什么东西? “HANA doesn't actually mean anything, but ...
- [转]Java加密算法
如基本的单向加密算法: BASE64 严格地说,属于编码格式,而非加密算法 MD5(Message Digest algorithm 5,信息摘要算法) SHA(Secure Hash Algorit ...
- 常用的代码之一:用StopWatch计算代码运行花费的时间。
先引用Diagnostics using System.Diagnostics; 然后: Stopwatch stopWatch = new Stopwatch(); stopWatch.Start( ...
- JPA之@GeneratedValue注解(转)
JPA的@GeneratedValue注解,在JPA中,@GeneratedValue注解存在的意义主要就是为一个实体生成一个唯一标识的主键(JPA要求每一个实体Entity,必须有且只有一个主键), ...
- fiddler 抓取iphone发出的http和https包
1.清理iphone的描述文件,在通用里面设置.这一步目的防止手机里面已经存在了DO_NOT_TRUST_FiddlerRoot证书,导致后面抓不了包,所以先清理下 2.下载安装fiddler,百度或 ...
- 启动supervisord 生成openvpn用于android的证书
service supervisord start netstat -anp | grep 你的端口号 生成证书: 进入到openvpn的证书生成文件夹,通常在/etc/openvpn/easy-r ...
- MySQL 示例数据库 employees 详解
[引子] IT这一行在我看来是比较要求动手能力的,但是人非生而知之:人们身上的技能除了一些本能之外,大多都是通过学习而得到的. 前一段时间一直在整理素材,写一个关于explain 的系列文章:在一开始 ...
- wifiphisher 钓鱼工具的使用
wifiphisher 钓鱼工具的使用一.简介 Wifiphisher是一个安全工具,具有安装快速.自动化搭建的优点,利用它搭建起来的网络钓鱼攻击WiFi可以轻松获得密码和其他凭证.与其它(网络钓鱼) ...