Nexus5刷入google 官方镜像包

原文 http://06peng.com/archives/83 

由于同事的白色版Nexus5收不到官方5.0的推送,于是我决定手动刷入官方5.0的镜像包。下载地址:https://developers.google.com/android/nexus/images#takjujwr66v

其中遇到一些问题,在这里记录一下。下面是官方的刷机教程:

To flash a system image:

  1. Download the appropriate system image for your device below, then unzip it to a safe directory.

  2. Connect your device to your computer over USB.

  3. Start the device in fastboot mode with one of the following methods:

  • Using the adb tool: With the device powered on, execute:

    adb reboot bootloader
    
  • Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device. For example, to put a Nexus 5 (“hammerhead”) into fastboot mode, press and hold Volume Up + Volume Down + Power as the device begins booting up.

  1. If necessary, unlock the device’s bootloader by running:

    fastboot oem unlock
    

    The target device will show you a confirmation screen. (This erases all data on the target device.)

  2. Open a terminal and navigate to the unzipped system image directory.

  3. Execute the flash-all script. This script installs the necessary bootloader, baseband firmware(s), and operating system.

Once the script finishes, your device reboots. You should now lock the bootloader for security:

  1. Start the device in fastboot mode again, as described above.

  2. Execute:

    fastboot oem lock
    

Locking the bootloader does not wipe any data, but when you want to flash it again, you must run fastboot oem unlock again, which will wipe the data.

操作这些命令行可能相对有些麻烦。于是我收集了一些简单的工具,方便以后使用。Nexus 5一键解锁+一键刷Recovery+一键root工具

这个工具很简单,解压到任意目录,然后执行对应的bat即可。

下面开始刷机步骤:

第一步是解锁:执行上面工具的一键解锁.bat即可。

第二步是将下载好的镜像包解压,然后进入对应的目录:

111

直接执行flash-all.bat,按照google 官方的教程的这样的,但我执行这一步的时候却出现了问题:

target reported max download size of 518205818 bytes

archive does not contain ‘boot.sig’

archive does not contain ‘recovery.sig’

failed to allocate 1813984020 bytes

error: update package missing system.img

Press any key to exit…

卧槽上网一搜索才发现是google的问题。还要解压image-hammerhead-lrx21o 这个目录,得到下面这些文件:

2222

然后再重新执行flash-all.bat即可,要耐心等待。这个过程会比较久。

如果上述步骤不行的话,就尝试自己手动执行命令:

1、刷入bootloader、radio,命令如下:

fastboot flash bootloader bootloader-hammerhead-hhz12d.img

fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.21>.img

两处文件名要替换成相应的文件名字。

2、重启(必须的):

fastboot reboot-bootloader

3、依次刷入其他镜像文件:

fastboot flash recovery recovery.img

fastboot flash boot boot.img

fastboot flash system system.img

fastboot flash vendor vendor.img

4、为了避免刷机后出现各种意外问题,包括返回、最近按键无法使用,存储容量只有16GB,强烈建议双清(注意备份数据):

fastboot flash cache cache.img

fastboot flash userdata userdata.img

5、再次重启:

fastboot reboot