でぶ

とあるサイトの開発室

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

はじめに。

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

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

今回の環境

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

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

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

Factory Images for Nexus Devices – Android — Google Developers

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

install-lmy48b-factory-image-01

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

ファイルの解凍と準備

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

圧縮・解凍ソフト 7-Zip

install-lmy48b-factory-image-02

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

install-lmy48b-factory-image-03

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

install-lmy48b-factory-image-04

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

install-lmy48b-factory-image-05

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

ちなみに必要なのは、

  • boot.img
  • bootloader-hammerhead-hhz12h.img
  • radio-hammerhead-m8974a-2.0.50.2.26.img
  • system.img

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

コマンドを入力

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

install-lmy48b-factory-image-06

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

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

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

起動の仕方は、

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

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

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

install-lmy48b-factory-image-07

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

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

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

> adb reboot bootloader
adb server is out of date. killing...
* daemon started successfully *

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

> fastboot flash bootloader bootloader-hammerhead-hhz12h.img
target reported max download size of 1073741824 bytes
sending 'bootloader' (3119KB)...
OKAY [ 0.314s]
writing 'bootloader'...
OKAY [ 0.549s]
finished. total time: 0.866s

.

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

.

> fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.26.img
target reported max download size of 1073741824 bytes
sending 'radio' (45425KB)...
OKAY [ 1.660s]
writing 'radio'...
OKAY [ 3.125s]
finished. total time: 4.789s

.

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

.

> fastboot flash system system.img
target reported max download size of 1073741824 bytes
erasing 'system'...
OKAY [  1.120s]
sending 'system' (1021744 KB)...
OKAY [ 33.322s]
writing 'system'...
OKAY [ 69.824s]
finished. total time: 104.272s

.

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

.

> 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.638s]
sending 'cache' (13348 KB)...
OKAY [  0.647s]
writing 'cache'...
OKAY [  1.082s]
finished. total time: 2.376s

.

> fastboot reboot
rebooting...

finished. total time: 0.002s

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

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

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

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

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

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

TWRP のダウンロードとインストールの準備

TeamWin Projects – TWRP 2.8 – | TeamWin

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

install-lmy48b-factory-image-08

Devices をクリックして、

install-lmy48b-factory-image-09

Search for TWRP for your device here: の下にあるテキストボックスに Nexus 5 と入力。

出てきた LG Nexus 5 (hammerhead) のリンクをクリックして移動。

install-lmy48b-factory-image-10

Primary (Recommended) のリンクをクリックし、ページを移動。

install-lmy48b-factory-image-11

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

install-lmy48b-factory-image-12

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

コマンドを実行していく

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

> adb reboot bootloader

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

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

> fastboot flash recovery twrp-2.8.6.1-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化やカーネルの変更などのときに便利です。