博客链接:http://blog.csdn.net/qq1084283172/article/details/52334452

折腾Android逆向的时候,经常需要给Nexus 5刷机。最近给Nexus 5刷机的时候发现谷歌官方提供给Nexus 5的Android 4.X版本的官方ROM,按照官方的刷机方法能够比较顺利的刷机成功,但是Nexus 5的刷Android 5.0的官方ROM经常出现错误,后面也懒得折腾了,索性下载一些刷机助手之类的软件进行刷机,但是发现这些懒人刷机软件刷的ROM 不是不正宗就是垃圾App一堆或者已经内置了su软件,不满足我的需求。于是百度(不要鄙视额)搜了搜,也发现一些网友提供能一些解决的办法,有些还是比较有效的,下面就整理一下,方便自己查阅也方便需要的同学。

谷歌Nexus系列移动设备的官方ROM的下载地址:https://developers.google.com/android/nexus/images#hammerhead (可能需要自备梯子)

国内贴吧提供的部分Nexus系列移动设备的官方ROM的下载地址:http://tieba.baidu.com/p/4212134253

下面就以在Windows平台下Nexus 5手机刷谷歌官方Android 5.0的ROM为例,已经测试了谷歌官方的Android 5.0、Android5.10、Android5.11的ROM均能用下面的方法刷机成功。


在对Nexus 5进行线刷官方的ROM的前提:已经在电脑上为Nexus 5手机安装好手机驱动,手机设备与电脑使用USB数据线连接正常,Nexus 5手机已经被解锁(重要的前提之一)。

1.如果没有做好这些准备也比较简单,一般在手机连接电脑的时候,只需要在电脑上下载安装比如:豌豆荚之类的手机助手类应用,这些手机助手类应用就会自动根据手机设备的型号自动帮我们安装相关需要的驱动,然后将手机设备设置成开发者模式并在开发者模式下开启USB调试-允许连接USB后开启调试模式,按照提示允许电脑连接该手机设备(一般手机连接正常,豌豆荚这类应用都会有提示的)。

2.Nexus 5手机的解锁方法:手机与电脑通过USB数据线连接正常的情况下,在cmd命令环境下执行命令:adb
reboot-bootloader 进入Fast boot Mode模式,然后在cmd环境下执行命令:fastboot oem unlock按照提示界面的提示选择
Yes 对Nexus 5手机进行解锁处理。

Nexus 5的Android 5.0的官方ROM的下载地址为:https://dl.google.com/dl/android/aosp/hammerhead-lrx21o-factory-01315e08.tgz

下载之后的ROM的压缩文件的名称为:hammerhead-lrx21o-factory-01315e08.tgz,对下载的官方Android 5.0的ROM进行解压如下图,其中flash-all.bat是Windows平台的刷机脚本,flash-all.sh、flash-base.sh是Linux平台的刷机脚本,bootloader-hammerhead-hhz12d.img和radio-hammerhead-m8974a-2.0.50.2.21.img以及image-hammerhead-lrx21o.zip是刷机需要的重要文件,对这几个文件具体的不熟悉,具体不展开了。由于下面的刷机操作是在Windows平台进行的,因此我只关注的是刷脚本flash-all.bat而不去关注flash-all.sh、flash-base.sh这两个Liux平台的刷机脚本。

谷歌官方的提供的在Windows平台的刷机教程比较简单:手机(移动设备)与电脑以USB数据线连接正常,只需关闭手机设备,然后同时按下Nexus 5手机的电源键和音量减键(手机设备进入Fastboot Mode模式),然后在电脑上运行刷机脚本flash-all.bat就可以开始刷机之旅了,在刷机的过程中不要随意拔掉USB数据连接线,静静的等待刷机完成--提示脚本运行成功,点击任意键手机设备重启,刷机成功。

让Nexus 5进入Fastboot Mode模式的方法:

1.关闭手机,当让手机再次重启时,同时按住 音量下和电源键,直至进入bootloader;

2.手机与电脑通过USB数据线连接正常的情况下,在cmd命令环境下执行命令:adb
reboot-bootloader;

3.使用一些刷机大师等刷机软件,提供的刷机进入 Fastboot Mode模式
的功能。

当让手机设备进入Fastboot
Mode模式后,直接按照谷歌官方的刷机方法在windows平台直接运行flash-all.bat脚本进行刷机,会提示下面的错误,看样子是执行flash-all.bat脚本脚本中的 fastboot
-w update image-hammerhead-lrx21o.zip 命令出现错误。

出现这类问题该怎么解决呢?需要将刷机需要的文件image-hammerhead-lrx21o.zip进行解压,然后分步骤的将相关的文件刷到Nexus
5手机上.对image-hammerhead-lrx21o.zip文件进行解压,然后将解压后的所有文件全部拷贝到刷机的根目录下如图:

并修改刷机脚本文件flash-all.bat为flash-all_data.bat或者flash-all_no_data.bat,说明一下:flash-all_data.bat为保留用户数据方式的刷机,flash-all_no_data.bat为清除用户数据方式的刷机。flash-all.bat脚本的修改如下如图,当需要保留用户数据刷机就直接运行flash-all_data.bat脚本,当不需要保留用户数据刷机就运行flash-all_no_data.bat脚本刷机。

Nexus 5手机刷官方Android 5.0的ROM保留用户数据方式的刷机脚本下载地址:http://download.csdn.net/detail/qq1084283172/9614519

Nexus 5手机刷官方Android 5.0的ROM清除用户数据方式的刷机脚本下载地址:http://download.csdn.net/detail/qq1084283172/9614520

Nexus 5手机刷官方Android 5.1.1的ROM保留用户数据方式的刷机脚本下载地址:http://download.csdn.net/detail/qq1084283172/9614523

Nexus 5手机刷官方Android 5.1.1的ROM清除用户数据方式的刷机脚本下载地址:http://download.csdn.net/detail/qq1084283172/9614528

adb常见命令帮助:

</pre><pre name="code" class="java">Android Debug Bridge version 1.0.31

 -a                            - directs adb to listen on all interfaces for a connection
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_S
ERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'. If -p is not specified, the ANDROID_PRODUCT_OUT environment variable is used, which must
be an absolute path.
-H - Name of adb server host (default: localhost)
-P - Port of adb server (default: 5037)
devices [-l] - list all connected devices
('-l' will also list device qualifiers)
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments will disconnect from all connected TCP/IP devices. device commands: adb push [-p] <local> <remote>
- copy file/dir to device
('-p' to display the transfer progress)
adb pull [-p] [-a] <remote> [<local>]
- copy file/dir from device
('-p' to display the transfer progress)
('-a' means copy timestamp and mode)
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward --list - list all forward socket connections.
the format is a list of lines with the following format:
<serial> " " <local> " " <remote> "\n"
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb forward --no-rebind <local> <remote>
- same as 'adb forward <local> <remote>' but fails
if <local> is already forwarded
adb forward --remove <local> - remove a specific forward socket connection
adb forward --remove-all - remove all forward socket connections
adb jdwp - list PIDs of processes hosting a JDWP transport adb install [-l] [-r] [-d] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
- push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-d' means allow version code downgrade)
('-s' means install on SD card instead of internal storage)
('--algo', '--key', and '--iv' mean the file is encrypted already)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report. adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all]
[-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default is noobb.)
(-shared|-noshared enable/disable backup of the device's shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If the -all or -shared flags are passed, then the package list is optional. Applications explicitly given on the command line will be included even if -nosystem would ordinarily cause them to be omitted.) adb restore <file> - restore device contents from the <file> backup archive adb help - show this help message
adb version - show version num scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb get-devpath - prints: <device-path>
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device re
ad-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways: - If <directory> is not specified, both /system and /data partitions will be u
pdated. - If it is "system" or "data", only the corresponding partition
is updated. environmental variables:
ADB_TRACE - Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes prior ity over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed.

感谢链接:

http://bbs.gfan.com/android-7776199-1-1.html

http://blog.csdn.net/lincyang/article/details/47836835

http://www.anruan.com/news/7128.html

Windows下Nexus 5的Android 5.0以上版本官方ROM的刷机教程的更多相关文章

  1. Windows下MySQL安装流程,8.0以上版本ROOT密码报错及修改

    官网下载MySQL安装后,解压,添加环境变量,以管理员方式运行cmd,运行以下命令 mysqld --initialize --console mysqld -install net start my ...

  2. Windows下Nexus 5 改user模式为debug模式

    博客链接:http://blog.csdn.net/qq1084283172/article/details/52337241 在学习Android软件安全的过程中,经常要用到Android的动态调试 ...

  3. react-native —— 在Windows下搭建React Native Android开发环境

    在Windows下搭建React Native Android开发环境 前段时间在开发者头条收藏了 @天地之灵_邓鋆 分享的<在Windows下搭建React Native Android开发环 ...

  4. 继《在Windows下编译扩展OpenCV 3.1.0 + opencv_contrib》修订

    在之前的<在Windows下编译扩展OpenCV 3.1.0 + opencv_contrib>中有些问题,后来由于时间不是很充足,故现在对其中的问题进行完善,如下所示对红色框框中的相应的 ...

  5. WINDOWS下好用的MongoDB 3.0以上客户端工具: NoSql Manager

      WINDOWS下好用的MongoDB 3.0以上客户端工具: NoSql Manager https://www.mongodbmanager.com/download  

  6. AOSP ON MAKO(在NEXUS 4上刷ANDROID 4.4 源代码包-下载/配置/编译/刷机)

    AOSP ON MAKO(在NEXUS 4上刷ANDROID 4.4 源代码包-下载/配置/编译/刷机) 特别感谢google官方文档及AOSP源代码开放 參考链接: https://source.a ...

  7. 对Android 8.0以上版本通知点击无效的一次分析

    版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/178 对Android 8.0以上版本通知点击无效的一次分 ...

  8. 快速解决设置Android 23.0以上版本对SD卡的读写权限无效的问题

    快速解决设置Android 23.0以上版本对SD卡的读写权限无效的问题 转 https://www.jb51.net/article/144939.htm 今天小编就为大家分享一篇快速解决设置And ...

  9. 小米刷机教程和GAE for android

    小米上的刷机教程:http://www.miui.com/getrom.php?r=2gae for android :https://github.com/madeye/gaeproxy/wiki

随机推荐

  1. mysql建表约束

    --mysql建表约束--主键约束它能够唯一确定一张表中的内容,也就是我们通过某个字段添加约束,就可以是的该字段唯一(不重复)且不为空.create table  user(    id int pr ...

  2. codefoces B - Phoenix and Beauty

    原题链接:https://codeforc.es/problemset/problem/1348/B 题意:告诉我们一个数组及其长度和k,判断是否可以构造一个新数组使得每K段长度和都相等. 思路:首先 ...

  3. SpringBoot Shiro 权限注解不起作用

    最近在学习springboot结合shiro做权限管理时碰到一个问题. 问题如下: 我在userRealm中的doGetAuthorizationInfo方法中给用户添加了权限,然后在Controll ...

  4. 在Ubuntu上安装TensorFlow-GPU开发环境

    深度学习是一个比较复杂的体系,今天记录一下开发环境的搭建步骤. 全新安装Ubuntu 20.10,系统默认安装的是python3,查看python的版本: mango@ubuntu:~$ python ...

  5. SpringBoot-08 SpringSecurity

    SpringBoot-08 SpringSecurity 创建了一个新项目,创建时选择导入starter-web 1.环境搭建 1.1 导入thymeleaf <dependency> & ...

  6. nsqlookupd:高性能消息中间件 NSQ 解析

    摘要:本篇将会结合源码介绍 nsqlookupd 的实现细节. 本篇将会结合源码介绍 nsqlookupd 的实现细节.nsqlookupd 主要流程与nsqd 执行逻辑相似,区别在于具体运行的任务不 ...

  7. [Azure Devops] 使用 Azure Pipelines 实现 CI

    1. 什么是 Azure Pipelines Azure Pipelines 会自动构建和测试代码项目,以将其提供给其他人.它适用于任何语言或项目类型.Azure Pipelines 结合了持续集成 ...

  8. 面试题:Linux 中一个文件的 MAC 代表什么意思

    查看文件状态 stat ls 命令能够查看文件的类型.时间.属主.属组,大小以及最近的修改时间等信息,但是还有一些文件的扩展属性,是使用 ls 命令无法查看到的 stat 命令则用于显示文件的详细属性 ...

  9. 记录给树莓派刷Raspberry Pi OS(Raspbian)系统的配置流程

    准备材料 树莓派(一定要贴散热片,最好再加个小风扇) TF内存卡 (记得选传输规范为Class10标准的) 读卡器 电脑(这里我使用的电脑是Windows系统,其它系统可能与下面的步骤有出入,还望悉知 ...

  10. 各种OJ网站,刷题必备

    各种OJ网站 落谷 vijos JoyOI CodeVS Comet OJ 北京大学 浙江大学 杭州电子科技大学 信息学奥赛一本通 以上就是本蒟蒻所知的OJ网站 收集和打字应该值一个赞吧