博客链接: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 devicereturns 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 givenserial number or qualifier. Overrides ANDROID_S
ERIALenvironment variable.-p <product name or path>     - simple product name like 'sooner', ora relative/absolute path to a productout directory like 'out/target/product/sooner'.If -p is not specified, the ANDROID_PRODUCT_OUTenvironment variable is used, which mustbe 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/IPPort 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 argumentswill 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 interactivelyadb shell <command>          - run remote shell commandadb emu <command>            - run emulator console commandadb logcat [ <filter-spec> ] - View device logadb 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 connectionsforward 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 failsif <local> is already forwardedadb forward --remove <local> - remove a specific forward socket connectionadb forward --remove-all     - remove all forward socket connectionsadb jdwp                     - list PIDs of processes hosting a JDWP transportadb 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 devicethat 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 writtento "backup.ab" in the current directory.(-apk|-noapk enable/disable backup of the .apks themselvesin 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 includessystem 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 archiveadb help                     - show this help messageadb version                  - show version numscripting:adb wait-for-device          - block until device is onlineadb start-server             - ensure that there is a server runningadb kill-server              - kill the server if it is runningadb get-state                - prints: offline | bootloader | deviceadb get-serialno             - prints: <serial-number>adb get-devpath              - prints: <device-path>adb status-window            - continuously print device status for a specified deviceadb remount                  - remounts the /system partition on the device re
ad-writeadb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery programadb reboot-bootloader        - reboots the device into the bootloaderadb root                     - restarts the adbd daemon with root permissionsadb usb                      - restarts the adbd daemon listening on USBadb 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 usepeerdnsadb 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 partitionis updated.environmental variables:ADB_TRACE                    - Print debug information. A comma separated list of the following values1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwpANDROID_SERIAL               - The serial number to connect to. -s takes priority 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. 小米2s刷原生安卓_小米2S升级安卓5.0原生ROM下载刷机教程

    昨天双11,小米天猫旗舰店半天时间交易额就突破10亿大关,今天就来给大家发福利了,继前几日"小米3/小米4MIUI6稳定版正式发布下载"(地址:http://www.jikeji. ...

  2. note edge android 6.0 root,三星Note Edge N9150刷机包带ROOT权限固件ZCU1BOH2线刷Rom

    最新官方优化流畅系统救砖包三星galaxy Note Edge N9150刷机包带ROOT权限固件N9150ZCU1BOH2线刷Rom 推荐使用(安卓软件园刷机精灵),内置了数万ROM刷机包一键在线刷 ...

  3. 谷歌的android官方刷机,一加手机谷歌原生Android ROM包刷机教程

    [TechWeb报道]自发售之后,一加手机一直秉承着兼收并蓄的姿态,在系统方面也让消费者有了诸多的选择. 一加手机除了默认的Color OS系统外,已经开发了CM系统的刷机包下载,同时,MIUI的适配 ...

  4. mate7 刷机 android 7,Mate7 四大版本完整稳定版刷机包大集合!

    [REC固件] Mate7 四大版本完整稳定版刷机包大集合! 176513868 电梯直达 BH8AVW 花粉版主 发表于 2016-9-25 00:38:30 来自:浏览器 最新回复 5 天前 本帖 ...

  5. oppoA83怎么升级android版本,OPPO A83 A1刷机教程_OPPO A83 A1卡刷升级更新官方系统包...

    接下来说一下咱们的OPPO A83手机的刷机操作了,这个刷机是针对官方的固件包,之前已经给大家说过咱们的这个手机专用的官方固件rom包了,很多机友不知道如何进行官方包的刷机操作,所以在这里整理了一下相 ...

  6. mate7 android go,Mate7 四大版本完整稳定版刷机包大集合!

    [REC固件] Mate7 四大版本完整稳定版刷机包大集合! 176505868 电梯直达 BH8AVW 花粉版主 发表于 2016-9-25 00:38:30 来自:浏览器 最新回复 5 天前 本帖 ...

  7. 华为android强刷系统下载地址,华为P6S官方rom固件刷机包下载_华为P6S原版系统强刷升级包...

    来分享一下华为Ascend P6S的官方rom固件包吧,现在这个手机的官方固件包还不是很多,不过官方还是更新的有,也为了方便一些机友,今天在这里来给大家分享一下官方的rom包,因为官方的包咱们很多时间 ...

  8. android 2.2 刷机,Android 2.2! 谷歌G1/Dream快速刷机教程

    1第一步:开root权限 [天极网手机频道]谷歌G1手机可谓是一款经典的Gphone,其全称为HTC Dream,谷歌G1于08年上市,是世界上第一款采用谷歌Android操作系统的手机.如今谷歌Gp ...

  9. mi2 android 5.0 方法,小米2/2S怎么刷Android5.0 小米2/2S刷Android5.0教程【详解】

    在之前,小米MIUI团队就公布了适配小米2的Android5.0运行图片,今天终于放出了适配小米2/2S的Android5.0刷机包,下面就来看看怎么给小米2/2S刷入Android5.0吧. 我们了 ...

最新文章

  1. 美国德州光伏装机可能拉低当地峰值电价
  2. androidwakelock_Android中的WakeLock
  3. python3.x与python2.x的区别汇总
  4. 英伟达用AI给自家纪录片配音,情绪节奏稳稳拿捏,不说根本听不出来
  5. valgrind 的使用简介
  6. 数据库mysql驱动在8.0以上解决时区问题
  7. 1339: 考试排名
  8. leetcode35 C++ 4ms 搜索插入位置
  9. CentOS 6.5配置本地YUM源
  10. javascript遍历json对象数据的方法
  11. Spring Cloud Zuul--服务网关
  12. c#中类的简单使用学习
  13. 【shell】通过shell编写ping包及arp的监控并发送短信
  14. 怎样利用通达信公式选股?
  15. 最详细的世界集成电路发展历史足迹
  16. C++ 遇到reference to ' *** ' is ambiguous 错误
  17. 【5G】NAS安全密钥衍生算法详解
  18. 环境保护概论课程作业
  19. 如何使用esp32从零制作一个ROS2的teleop遥控器(cmd_vel)
  20. 安装黑苹果后,使用PD引导Windows7失败 0xc000000e 引导选择失败,因为需要的设备不可访问

热门文章

  1. 数字媒体技术专业方向
  2. 如何优雅地测量一只猫的体积,而不使其感到惊恐或受到伤害?
  3. java远程打印机 文件_使用Java将文本文件打印到特定打印机
  4. 高博视觉SLAM十四讲--罗德里格斯公式推导
  5. 访谈 | C++之父Bjarne Stroustrup: 简单的表述方式才是最优的方案
  6. uTools插件-Excalidraw轻量的在线白板绘图工具
  7. [CVPR2021-oral]Learning to Aggregate and Personalize 3D Face from In-the-Wild Photo Collection
  8. 移植opencv到嵌入式arm详细过程
  9. docker 安装 onlyoffice
  10. SpringBoot使用Netty实现远程调用