有馬総一郎のブログ

(彼氏の事情)

UbuntuでNexus 7 2012にAndroid 5.0 Lollipopをインストール

Ubuntu 14.04

oemロックを解除後、再起動すると、南京錠が外れたロゴが表示されるようになった。それとともに初期状態に戻ったのだが、再びgoogleアカウントでログインして、 USBデバッグモードにする必要があったので、再びこの端末(Ubuntu)でNexus7 2012と USBデバッグモードで接続できる状態にしておく。

でいよいよ、ファクトリーイメージを焼く。adb reboot bootloaderでブートローダーを起動する。

arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools$ sudo sh nakasi-lrx22g/flash-all.sh 
[sudo] password for arimasou16: 
nakasi-lrx22g/flash-all.sh: 17: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 18: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 19: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 20: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 21: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 22: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 23: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 24: nakasi-lrx22g/flash-all.sh: fastboot: not found
nakasi-lrx22g/flash-all.sh: 26: nakasi-lrx22g/flash-all.sh: fastboot: not found

あれ・・・fastbootコマンドが実行できないとのエラーメッセージ。

つまりだ、sudoでは platform-toolsまで通したパスがリセットされてしまった。初め、 flash-all.shを編集しようかと思ったけど、正攻法(?)でいくことにした。

【Ubuntu】sudoする際にPATHをどう引き継ぐか - Qiitaを参考にさせていただいた。

今のユーザーグループを exempt_groupに追加することにした。

sudo visudoを実行し、以下のとおり編集した。

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults>       env_reset
Defaults>       mail_badpass
Defaults>       secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults>       exempt_group="arimasou16"

exempt_groupを編集。

そして、~/android-sdk-linux/platform-tools/nakasi-lrx22gにまで移動。そして、シェルを実行。

arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ ls -l
合計 385972
-rw-r----- 1 arimasou16 arimasou16   2151068 12月 19 09:49 bootloader-grouper-4.23.img
-rw-r----- 1 arimasou16 arimasou16       984 12月 19 09:49 flash-all.bat
-rwxr-x--x 1 arimasou16 arimasou16       872 12月 19 09:49 flash-all.sh
-rwxr-x--x 1 arimasou16 arimasou16       698 12月 19 09:49 flash-base.sh
-rw-r----- 1 arimasou16 arimasou16 393060600 12月 19 09:49 image-nakasi-lrx22g.zip
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ sudo ./flash-all.sh 
...
(bootloader) Bootloader is already unlocked
OKAY [  0.013s]
finished. total time: 0.013s
erasing 'boot'...
OKAY [  1.194s]
finished. total time: 1.194s
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [  1.089s]
finished. total time: 1.089s
erasing 'recovery'...
OKAY [  0.816s]
finished. total time: 0.816s
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [  0.846s]
finished. total time: 0.846s
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
OKAY [  4.524s]
finished. total time: 4.524s
sending 'bootloader' (2100 KB)...
OKAY [  0.261s]
writing 'bootloader'...
FAILED (remote: (InvalidState))
finished. total time: 0.399s
rebooting into bootloader...
OKAY [  1.031s]
finished. total time: 1.783s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 664390972 bytes
error: update package missing system.img
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ 

writing 'bootloader'...で失敗。そのせいか、最後までうまく行かない。

どうも調べるとNexus 7 2012の端末でOSが4.4以下の場合では、いきなり Lollipopを焼けないらしい。ということらしいので、 4.4 (KRT16S)Factory Images for Nexus Devices - Android — Google Developersから落としてくる。

そして、同じように platform-tools配下に展開する。

arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools$ sudo ./nakasi-krt16s/flash-all.sh 
...
(bootloader) Bootloader is already unlocked
OKAY [  0.013s]
finished. total time: 0.013s
erasing 'boot'...
OKAY [  0.500s]
finished. total time: 0.500s
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [  0.281s]
finished. total time: 0.281s
erasing 'recovery'...
OKAY [  0.627s]
finished. total time: 0.627s
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [  0.765s]
finished. total time: 0.765s
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
OKAY [  4.421s]
finished. total time: 4.421s
error: cannot load 'bootloader-grouper-4.23.img'
rebooting into bootloader...
OKAY [  0.019s]
finished. total time: 1.072s
error: failed to load 'image-nakasi-krt16s.zip': No such file or directory

あ?もうひとつ下に移動しないとダメなようだ。

arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools$ cd nakasi-krt16s/
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-krt16s$ sudo ./flash-all.sh 
...
(bootloader) Bootloader is already unlocked
OKAY [  0.016s]
finished. total time: 0.016s
erasing 'boot'...
OKAY [  0.496s]
finished. total time: 0.496s
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [  0.267s]
finished. total time: 0.267s
erasing 'recovery'...
OKAY [  0.625s]
finished. total time: 0.625s
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [  0.778s]
finished. total time: 0.778s
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
OKAY [  4.418s]
finished. total time: 4.418s
sending 'bootloader' (2100 KB)...
OKAY [  0.263s]
writing 'bootloader'...
OKAY [  9.504s]
finished. total time: 9.767s
rebooting into bootloader...
OKAY [  0.019s]
finished. total time: 0.571s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Creating filesystem with parameters:
    Size: 30734811136
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 32768
    Label: 
    Blocks: 7503616
    Block groups: 229
    Reserved block group size: 1024
Created filesystem with 11/1875968 inodes and 161774/7503616 blocks
Creating filesystem with parameters:
    Size: 464519168
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7088
    Inode size: 256
    Journal blocks: 1772
    Label: 
    Blocks: 113408
    Block groups: 4
    Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
--------------------------------------------
Bootloader Version...: 4.23
Baseband Version.....: N/A
Serial Number........: 015d2d42da13f209
--------------------------------------------
checking product...
OKAY [  0.042s]
checking version-bootloader...
OKAY [  0.016s]
sending 'boot' (4990 KB)...
OKAY [  0.616s]
writing 'boot'...
OKAY [  0.990s]
sending 'recovery' (5530 KB)...
OKAY [  0.747s]
writing 'recovery'...
OKAY [  1.405s]
erasing 'system'...
OKAY [  0.906s]
sending 'system' (611886 KB)...
OKAY [ 72.760s]
writing 'system'...
OKAY [ 36.759s]
erasing 'userdata'...
OKAY [  4.891s]
sending 'userdata' (139197 KB)...
OKAY [ 16.533s]
writing 'userdata'...
OKAY [ 13.257s]
erasing 'cache'...
OKAY [  0.695s]
sending 'cache' (9052 KB)...
OKAY [  1.092s]
writing 'cache'...
OKAY [  1.878s]
rebooting...

finished. total time: 153.183s
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-krt16s$ 

うまく行った。今度こそ、 Lollipopを焼けるはずだ・・・と、その前にまたNexus7が初期状態に戻っていたのでgoogleアカウントでログインして、 USBデバッグモードを有効にして、端末(Ubuntu)との接続ができる状態にする。

arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-krt16s$ cd ../nakasi-lrx22g/
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ 
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ adb reboot bootloader
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ sudo ./flash-all.sh
...
(bootloader) Bootloader is already unlocked
OKAY [  0.008s]
finished. total time: 0.008s
erasing 'boot'...
OKAY [  1.168s]
finished. total time: 1.168s
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [  1.092s]
finished. total time: 1.092s
erasing 'recovery'...
OKAY [  0.806s]
finished. total time: 0.806s
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [  0.795s]
finished. total time: 0.795s
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
OKAY [  4.594s]
finished. total time: 4.594s
sending 'bootloader' (2100 KB)...
OKAY [  0.263s]
writing 'bootloader'...
FAILED (remote: (InvalidState))
finished. total time: 0.401s
rebooting into bootloader...
OKAY [  1.039s]
finished. total time: 1.792s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Creating filesystem with parameters:
    Size: 30734811136
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 32768
    Label: 
    Blocks: 7503616
    Block groups: 229
    Reserved block group size: 1024
Created filesystem with 11/1875968 inodes and 161774/7503616 blocks
Creating filesystem with parameters:
    Size: 464519168
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7088
    Inode size: 256
    Journal blocks: 1772
    Label: 
    Blocks: 113408
    Block groups: 4
    Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
--------------------------------------------
Bootloader Version...: 4.23
Baseband Version.....: N/A
Serial Number........: 015d2d42da13f209
--------------------------------------------
checking product...
OKAY [  0.231s]
checking version-bootloader...
OKAY [  0.009s]
sending 'boot' (5152 KB)...
OKAY [  0.633s]
writing 'boot'...
OKAY [  1.088s]
sending 'recovery' (5688 KB)...
OKAY [  0.695s]
writing 'recovery'...
OKAY [  0.487s]
erasing 'system'...
OKAY [  0.911s]
sending 'system' (648819 KB)...
OKAY [ 77.661s]
writing 'system'...
OKAY [ 40.899s]
erasing 'userdata'...
OKAY [  4.878s]
sending 'userdata' (139197 KB)...
OKAY [ 16.554s]
writing 'userdata'...
OKAY [ 13.296s]
erasing 'cache'...
OKAY [  0.689s]
sending 'cache' (9052 KB)...
OKAY [  1.095s]
writing 'cache'...
OKAY [  1.879s]
rebooting...

finished. total time: 161.615s
arimasou16@arimasou16-Peppy:~/android-sdk-linux/platform-tools/nakasi-lrx22g$ 

writing 'bootloader'...でまたずっこけたが、処理はそのまま継続されて、そのままファクトリーイメージは焼けた。その後、Nexus7 2012を起動させると、ちゃんと Lollipop(5.0.2)として起動できた。しかも、既存機能でアプリの復元ができて、あっという間に元に戻れた!動作も遅くなるようなことも、今のところない。

Comments