でぶ

とあるサイトの開発室

よく使うのに忘れやすい、 TAR コマンド 覚書

ファイルの圧縮や解凍につかうUNIXコマンド。

TAR は Tape ARchive の略。 もともとはテープデバイスのためのコマンドだったそう。

TAR の使い方

$ tar (x|c|t)vf(z|j|J) hoge.tar [file1,…]

何をするかを指定して、

x extract 解凍
c create  作成
t list    一覧

形式を選ぶ。

z gzip(.tar.gz)  形式
j bzip(.tar.bz2) 形式
J lzma(.tar.xz)  形式

指定なしの場合はファイルをまとめたアーカイブを作成(.tar)

ちなみに、v と f は、

v verbose 詳細を表示
f file    ファイルを指定

解凍する例

x オプション 書庫からファイルを取り出す。

## tar 形式
$ tar xvf ファイル名.tar

## gzip 形式
$ tar xvfz 解凍するファイル.tar.gz

## bzip2 形式
$ tar xvfj 解凍するファイル.tar.bz2

## xz 形式
$ tar xvfJ 解凍するファイル名.tar.xz

圧縮する例

c オプション

## tar 形式
$ tar cvf ファイル名.tar

## gzip 形式
$ tar cvfz 圧縮後のファイル名.tar.gz 圧縮するファイル,…

## bzip2 形式
$ tar cvfj 圧縮後のファイル名.tar.bz2 圧縮するファイル,…

## xz 形式
$ tar cvfJ 圧縮後のファイル名.tar.xz 圧縮するファイル,…

アーカイブの内容を一覧表示する例

t オプション

$ tar tf ファイル名.tar

展開先を指定

C オプション 指定したディレクトリに移動してから動作を開始。

$ tar xvf -C 展開先のディレクトリ 解凍するファイル名.tar

最新の Git を Git のソースからインストールする方法

前準備

一般ユーザーの書き込み権限がない /usr/local/src に wheel グループに対して書き込み権限を与えます。

管理者権限で作業する場合はこの部分を飛ばしてください。

$ sudo chgrp wheel /usr/local/src
$ sudo chmod g+rwx /usr/local/src

必要なパッケージをインストール。

$ sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

Git のインストール

作業ディレクトリに移動。

$ cd /usr/local/src

Git から Git の最新のソースをダウンロード。

$ git clone https://github.com/git/git.git git

git ディレクトリに移動。

$ cd git

コンパイルしてインストール。

$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install

以上、最新の Git を Git のソースからインストールする方法でした。

最新の VIM を Git のソースからインストールする方法

はじめに

Google Code が閉鎖されるそうなので、 Git での VIM のインストール方法を。

とりあえず、いまインストールされている VIM を確認。

$ yum list installed | grep vim

前準備

一般ユーザーの書き込み権限がない /usr/local/src に wheel グループに対して書き込み権限を与えます。

管理者権限で作業する場合はこの部分を飛ばしてください。

$ sudo chgrp wheel /usr/local/src
$ sudo chmod g+rwx /usr/local/src

必要なパッケージのインストール

VIMコンパイルに必要なパッケージをインストールしておく。

CentOS の場合、

$ sudo yum install gcc git mercurial ncurses-devel lua lua-devel

Ubuntu の場合、

$ sudo apt-get install mercurial gettext libncurses5-dev libacl1-dev libgpm-dev

luajit のインストール

$ cd /usr/local/src
$ git clone http://luajit.org/git/luajit-2.0.git
$ cd luajit-2.0

$ make
$ sudo make install

VIM のインストール

いよいよここからが VIM のインストール。

まず、作業するディレクトリに移動。

$ cd /usr/local/src

Git から VIM のコードを落としてくる。

$ git clone https://github.com/vim/vim.git vim

ディレクトリを移動し、

$ cd vim/

Makefile を生成する。

$ ./configure --with-features=huge --enable-multibyte --enable-luainterp=dynamic --with-luajit --with-lua-prefix=/usr/local --enable-fail-if-missing

コンパイルして、インストール。

$ make
$ make install

ちゃんと vim が起動できるかを確認。

$ /usr/local/bin/vim

ついでにシェルスクリプトも作っておく

いろいろとオプションの入力が面倒なので、シェルスクリプトを作っておくと次回からは楽ができる!

ってことなので、 myConfigure.sh ファイルを作成。

$ vim /usr/local/src/vim/myConfigure.sh

以下を記入。

#!/bin/sh
./configure --with-features=huge --enable-multibyte \
--enable-luainterp=dynamic --with-luajit --with-lua-prefix=/usr/local \
--enable-fail-if-missing

実行権限をつける。

$ chmod u+x myConfigure.sh

コンパイルしてインストール。

$ make
$ sudo make install

設定

自分の使っているシェルにあわせて、 .bashrc.zshrc などに以下の設定を追記。

export EDITOR='/usr/local/bin/vim'

alias vi='vim'
alias vim='/usr/local/bin/vim'

以後、VIM をアップデートするには

$ cd /usr/local/src/vim
$ git pull

make 前にスッキリさせておいて、

$ make distclean

以前作っておいた myConfigure.sh を実行。

$ ./myConfigure.sh

コンパイルしてインストール。

$ make
$ sudo make install

以上、最新の VIM を Git のソースからインストールする方法でした。

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

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

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

最新版がリリースされていたので、漢のシェルZSHを更新しておいた

2014年10月にZ Shellの最新バージョン(5.0.7)がリリースされていたので更新。

シェルはいつも最新版を使いたいので、男らしくソースからインストール☆

[browser-shot url="http://zsh.sourceforge.net/" width="240"] ZSH - THE Z SHELL

まず、

初めてZshをインストールするなら下記の作業が必要かも。

CentOSの場合、

$ sudo yum install ncurses-devel

Ubuntuの場合、

$ sudo apt-get install ncurses-dev

ッて感じで、事前にNcursesをインストールしておきましょう!

最新のソースをダウンロード

とりあえず、作業用ディレクトリを作って移動しておきましょう。

$ mkdir ~/tmp
$ cd ~/tmp

Mkdirコマンドでtmpディレクトリを作成し、Cdコマンドで移動。

こちらで最新のファイルを確認します。

$ wget http://jaist.dl.sourceforge.net/sourceforge/zsh/zsh-5.0.7.tar.gz

WgetコマンドでZshのソースをダウンロード。

ファイルの解凍

$ tar zxvf zsh-5.0.7.tar.gz

Tarコマンドでダウンロードしたファイルを解凍。

解凍してできたディレクトリに移動

$ cd zsh-5.0.7

Cdコマンドで解凍してできたzsh-5.0.6ディレクトリに移動。

インストール

configureスクリプトを実行。

ちなみに、configureスクリプトのオプションを指定したい場合

./configure --help

で、オプションの一覧を見ることができます。

あと、configureスクリプト実行後、何かおかしくなったりして実行前に戻したい場合

$ make distclean

で、初期化できます。

今回はそのままオプション無しで、

$ ./configure

$ make

MakeコマンドでZshコンパイル

$ sudo make install

Sudoコマンドで管理者権限になりZshをインストール。

ログインシェルを zsh

現在のシェルを確認。

$ echo $SHELL
/bin/bash

$ cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh

シェルのリストを確認。

$ sudo -e /etc/shells

/usr/local/bin/zshを追記。

ESCを押して、:wqで保存してエディターを終了。

$ chsh
hoge のシェルを変更します。
パスワード:
新しいシェル [/bin/bash]: /usr/local/bin/zsh
シェルを変更しました。

Chshコマンドでログインシェルを変更。

.zshrcを作成

[browser-shot url="http://news.mynavi.jp/column/zsh/" width="240"] 漢のzsh | コラム | マイナビニュース

ちょっと内容が古いけど、上記サイトなどを参考に.zshrcを作成しましょう☆

作成が終わったら、

$ source .zshrc

変更した設定を反映。

って感じでZshのインストールは終了!!