でぶ

とあるサイトの開発室

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

はじめに。

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

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

今回の環境

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

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

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

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

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

install-lmy47d-factory-image01

5.1.0 (LMY47D) と書いてある横のLinkをクリックするとダウンロードが始まります。 ファイル名は、hammerhead-lmy47d-factory-6c1ad81e.tgz

ファイルの解凍と準備

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

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

install-lmy47d-factory-image02

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

install-lmy47d-factory-image03

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

install-lmy47d-factory-image04

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

install-lmy47d-factory-image05

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

ちなみに必要なのは、

  • boot.img
  • bootloader-hammerhead-hhz12f.img
  • radio-hammerhead-m8974a-2.0.50.2.25.img
  • system.img

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

コマンドを入力

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

install-lmy47d-factory-image06

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

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

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

起動の仕方は、

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

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

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

install-lmy47d-factory-image07

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

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

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

> adb reboot bootloader

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

> fastboot flash bootloader bootloader-hammerhead-hhz12f.img
target reported max download size of 1073741824 bytes
sending 'bootloader' (2579 KB)...
OKAY [  0.294s]
writing 'bootloader'...
OKAY [  0.500s]
finished. total time: 0.791s
> fastboot reboot-bootloader
rebooting into bootloader...
OKAY [  0.002s]
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' (45425 KB)...
OKAY [  1.653s]
writing 'radio'...
OKAY [  3.128s]
finished. total time: 4.784s
> fastboot reboot-bootloader
rebooting into bootloader...
OKAY [  0.002s]
finished. total time: 0.002s
> fastboot flash system system.img
target reported max download size of 1073741824 bytes
erasing 'system'...
OKAY [  1.151s]
sending 'system' (1021552 KB)...
OKAY [ 33.473s]
writing 'system'...
OKAY [ 69.955s]
finished. total time: 104.585s
> fastboot flash boot boot.img
target reported max download size of 1073741824 bytes
sending 'boot' (8930 KB)...
OKAY [  0.497s]
writing 'boot'...
OKAY [  0.773s]
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.722s]
sending 'cache' (13348 KB)...
OKAY [  0.649s]
writing 'cache'...
OKAY [  1.087s]
finished. total time: 2.462s

> fastboot reboot
rebooting...
 
finished. total time: 0.001s
> 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用カスタムリカバリーのファイルをダウンロードします。

install-twrp-2852-image01

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

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

install-twrp-2852-image02

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

install-twrp-2852-image03

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

install-twrp-2852-image04

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

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

> adb reboot bootloader

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

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

> fastboot flash recovery openrecovery-twrp-2.8.5.2-hammerhead.img
target reported max download size of 1073741824 bytes
sending 'recovery' (13918 KB)...
OKAY [  0.653s]
writing 'recovery'...
OKAY [  1.107s]
finished. total time: 1.765s

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

> fastboot reboot
rebooting...
 
finished. total time: 0.002s

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

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