でぶ

とあるサイトの開発室

OTAの配信まで待ちきれない!Nexus 5のファクトリーイメージ (LRX22C)を手動でインストールしました

はじめに。

今回の記事の内容を行う場合はすべて自己責任でお願いします!!

Nexus 5向けAndroid 5.0.1(LRX21T)のファクトリーイメージが公開されダウンロード可能だったので 今回もOTAの配信を待たずにインストールしてみました。

今回の環境

作業するPCでAndroid SDKの設定ができていて、なおかつC:\adt-bundle-windows\sdk\platform-toolsに環境パスが通っている状態での作業になります。 つまり、ADB、FASTBOOT コマンドが使える状態です。

ファクトリーイメージ (LRX22C)をインストール

ファクトリーイメージのダウンロード

[browser-shot url="https://developers.google.com/android/nexus/images" width="240"] Factory Images for Nexus Devices - Android — Google Developers

上記リンク先よりNexus 5用ファクトリーイメージのファイルをダウンロードします。

nexus5-lrx22c01

5.0.1 (LRX22C) と書いてある横のLinkをクリックするとダウンロードが始まります。 ファイル名は、hammerhead-lrx22c-factory-0f9eda1b.tgz

ファイルの解凍と準備

ファイルの解凍には「7-Zip」を使いました。

[browser-shot url="http://sevenzip.sourceforge.jp/" width="240"] 圧縮・解凍ソフト 7-Zip

nexus5-lrx22c02

さっきダウンロードしたhammerhead-lrx22c-factory-0f9eda1b.tgzを右クリック。 出てきたメニューの7-Zipを選び、展開…を選択する。

nexus5-lrx22c03

解凍するとフォルダーの中にhammerhead-lrx22c-factory-0f9eda1b.tarという圧縮されたファイルがあるので同じようにしてファイルを解凍。

nexus5-lrx22c04

解凍したフォルダーの中にimage-hammerhead-lrx22c.zipというファイルがあるので同様に解凍。

nexus5-lrx22c05

解凍してできたフォルダーの中にbootloader-hammerhead-hhz12d.imgradio-hammerhead-m8974a-2.0.50.2.22.imgも移動させ、フォルダーの中に必要なファイルをまとめる。

ちなみに必要なのは、

  • boot.img
  • bootloader-hammerhead-hhz12d.img
  • radio-hammerhead-m8974a-2.0.50.2.22.img
  • system.img

上記、4つのファイルです。

コマンドを入力

いよいよコマンドを入力していくわけですが、長いパスを打つのが面倒なので先ほどファイルを展開した場所でコマンド プロンプトを開きましょ。

nexus5-lrx22c07

展開した場所で[SHIFT]を押しながらマウスを右クリックし、コンテキストメニューからコマンドウィンドウをここで開くを選択。

ちなみに別の方法もあります。

まず、コマンド プロンプトを起動。

起動の仕方は、

  • スタートボタンを右クリックでコマンドプロンプトを選ぶ。
  • スタート画面を出し、cmdと入力して[Enter]を押す。

などでコマンド プロンプトの起動ができます。

コマンド プロンプトの画面に cd (cdの後に半角スペース) と入力します。

nexus5-lrx22c06

画像のようにコマンド プロンプトの画面にドラッグします。 パスがコピーされるので、[Enter]を押すと移動できます。

Nexus 5をPCに接続し、次のコマンドを実行。

「>」の後ろのコマンドを正確に入力。もしくは、コピペ。

> adb reboot bootloader

端末が再起動されて、ブートローダーに入ります。

> fastboot flash bootloader bootloader-hammerhead-hhz12d.img
target reported max download size of 1073741824 bytes
sending 'bootloader' (2579 KB)...
OKAY [  0.297s]
writing 'bootloader'...
OKAY [  0.492s]
finished. total time: 0.791s

> fastboot reboot-bootloader
rebooting into bootloader...
OKAY [  0.001s]
finished. total time: 0.002s

> fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.22.img
target reported max download size of 1073741824 bytes
sending 'radio' (45521 KB)...
OKAY [  1.666s]
writing 'radio'...
OKAY [  3.137s]
finished. total time: 4.804s

> fastboot reboot-bootloader
rebooting into bootloader...
OKAY [  0.001s]
finished. total time: 0.002s

> fastboot flash system system.img
target reported max download size of 1073741824 bytes
erasing 'system'...
OKAY [  1.167s]
sending 'system' (981472 KB)...
OKAY [ 32.053s]
writing 'system'...
OKAY [ 66.686s]
finished. total time: 99.909s

> fastboot flash boot boot.img
target reported max download size of 1073741824 bytes
sending 'boot' (8852 KB)...
OKAY [  0.503s]
writing 'boot'...
OKAY [  0.768s]
finished. total time: 1.273s

> fastboot format cache
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
target reported max download size of 1073741824 bytes
erasing 'cache'...
OKAY [  0.641s]
sending 'cache' (13348 KB)...
OKAY [  0.649s]
writing 'cache'...
OKAY [  1.086s]
finished. total time: 2.380s

> fastboot reboot
rebooting...

finished. total time: 0.001s

ちなみに、 fastboot flash userdata userdata.img これをするとユーザーデーターごとWipeされる(消える)ので注意!!

ファクトリーイメージをバッチファイル(flash-all.bat)でインストールすると上のコマンドが実行されちゃいます。 ってことで、面倒でもひとつずつコマンド入力してインストールするわけです。

Nexus 5 が再起動されるのでそのまま待っていればアップデート完了です。

カスタムリカバリーもインストールする場合は、コマンドプロンプトの画面はまだ閉じないように!!

カスタムリカバリ TWRP をインストール

インストールする準備が整っているので、 ついでにカスタムリカバリーの TWRP もインストールしてしまいます。

TWRP のダウンロード

[browser-shot url="http://www.teamw.in/project/twrp2" width="240"] TeamWin Projects - TWRP 2.8 - | TeamWin

上記リンク先よりNexus 5用カスタムリカバリーのファイルをダウンロードします。

nexus5-twrp01

Get TWRP for your device をクリックし、 出てきたウィンドウに Nexus 5 と入力。

TWRP for Nexus 5 をクリックし移動。

nexus5-twrp02

Download the newest .img file here をクリックし、ページを移動。

nexus5-twrp03

openrecovery-twrp-2.8.2.0-hammerhead.img をクリックし、ファイルをダウンロード。

nexus5-twrp04

ファクトリーイメージのインストール時にファイルをまとめておいたフォルダー image-hammerhead-lrx22c に ダウンロードしたファイル openrecovery-twrp-2.8.2.0-hammerhead.img も移動しておきます。

Nexus 5をPCに接続し、次のコマンドを実行。

> adb reboot bootloader

端末が再起動されて、ブートローダーに入ります。

以下のコマンドを正確に入力。もしくは、コピペ。

> fastboot flash recovery openrecovery-twrp-2.8.2.0-hammerhead.img
target reported max download size of 1073741824 bytes
sending 'recovery' (14910 KB)...
OKAY [  0.690s]
writing 'recovery'...
OKAY [  1.163s]
finished. total time: 1.855s

書き込みが終わったので下記コマンドで再起動させます。

> fastboot reboot
rebooting...

finished. total time: 0.001s

これで、TWRP のインストールも完了!!

カスタムリカバリーをインストールしておくと、 ROOT化やカーネルの変更などのときに便利です。