ubuntu12.04编译android4.4.4_r1并烧录到nexus5

下载源码

https://pan.baidu.com/s/1qWpCAhY#list/path=%2FAndroid%E6%BA%90%E7%A0%81

这里我下载的是android4.4.4_r1


搭建编译环境

首先安装jdk6,并配置环境变量,可以参考
http://blog.csdn.net/sp1336542268/article/details/46844179

安装要用的命令

$ sudo apt-get install git gnupg flex bison gperf build-essential zip 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
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

编译

由于我们要将编译好的东西刷到nexus5上,所以在编译前还得在官网上查到对应的驱动脚本
https://developers.google.com/android/drivers
这里写图片描述

将下载下来的三个驱动脚本解压,放到源码根目录,分别执行三个脚本,依次阅读协议,并回复I Agree,这样会在源码根目录生成一个vendor文件夹。
最后进行编译:
为了提高编译的效率,我们最好先设置一下编译器的高速缓存从而加快编译速度。
prebuilts/misc/linux-x86/ccache/ccache -M 50G
注意事项:
a. 前提是已经在 .bashrc 文件中添加:export USE_CCACHE = 1
b. ccache 是一个可执行文件
c. -M 50G 两个参数表示设置 50G 大小的空间作为缓存,根据自己时间硬盘空间大小调整
2) 依次输入如下命令编译
source build/envsetup.sh
Lunch
Make -j4(-j4 为四线程)

刷机

首先进入源码根目录,执行下面命令:

adb reboot bootloader 

手机重启 进入页面

fastboot flashall -w 烧录
< waiting for device >
可能是fastboot权限不足
fastboot -l devices
no permissions fastboot usb:1-1
于是知道是因为权限问题,是fastboot没有权限, 解决步骤:
1. 将fastboot的所有者属性改成root
用which fastboot命令找到fastboot所在的目录,然后进入此目录;再用命令chown改其属性:
sudo chown root:root fastboot
2. 将其权限更改一下:
sudo chmod +s fastboot
fastboot -l devices
???????????? fastboot usb:1-1

fastboot flashall -w

Bootloader Version…: HHZ11k
Baseband Version…..: M8974A-2.0.50.1.16

Serial Number……..: 0675af320acdb3b7

checking product…
OKAY [ 0.100s]
sending ‘boot’ (8700 KB)…
OKAY [ 1.300s]
writing ‘boot’…
FAILED (remote: not supported in locked device)
finished. total time: 1.893s

http://bbs.gfan.com/android-2119762-1-1.html
http://jingyan.baidu.com/article/a3a3f8118599438da2eb8afd.html

fastboot oem unlock

archur@ubuntu:~/android-4.4.4_r1$ fastboot flashall -w

Bootloader Version…: HHZ11k
Baseband Version…..: M8974A-2.0.50.1.16

Serial Number……..: 0675af320acdb3b7

checking product…
OKAY [ 0.100s]
sending ‘boot’ (8700 KB)…
OKAY [ 1.300s]
writing ‘boot’…
OKAY [ 0.746s]
sending ‘recovery’ (9284 KB)…
OKAY [ 1.394s]
writing ‘recovery’…
OKAY [ 0.780s]
erasing ‘system’…
OKAY [ 1.121s]
sending ‘system’ (291004 KB)…
OKAY [ 36.485s]
writing ‘system’…
OKAY [ 21.446s]
erasing ‘userdata’…
OKAY [ 8.092s]
formatting ‘userdata’ partition…
Creating filesystem with parameters:
Size: 13725835264
Block size: 4096
Blocks per group: 32768
Inodes per group: 8144
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 3351034
Block groups: 103
Reserved block group size: 823
Created filesystem with 11/838832 inodes and 93654/3351034 blocks
sending ‘userdata’ (137318 KB)…
writing ‘userdata’…
OKAY [ 26.867s]
erasing ‘cache’…
OKAY [ 0.648s]
formatting ‘cache’ partition…
Creating filesystem with parameters:
Size: 734003200
Block size: 4096
Blocks per group: 32768
Inodes per group: 7472
Inode size: 256
Journal blocks: 2800
Label:
Blocks: 179200
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/44832 inodes and 5813/179200 blocks
sending ‘cache’ (13348 KB)…
writing ‘cache’…
OKAY [ 3.147s]
rebooting…

finished. total time: 102.643s

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值