Raspberry Pi Zeroのセットアップ
日本でもRaspberrry Pi Zeroが購入出来る様になりましたが、出遅れてしまい売り切れになってたのが悔しくて、PIMORONIでRaspberry Pi Zeroを購入してみました。通常配送で注文の翌日に発送されて11日後にポストに投函されていました。
Raspberry Pi自体が初めてなので、いろいろ調べながらセットアップしてみましたが、意外に簡単でした。問題はここから何をするかなのですが。
環境等
macOS Sierra 10.12.3
Raspberry Pi Zero v1.3
SanDisk Ultra microSDHC Class10 UHS-1 16G
Raspberry Pi Zeoは、Message KitとしてScroll pHatがセットになっているものを購入しました。
Raspberry Pi Zero Project Kits
SDカードにイメージを書き込み
イメージをダウンロードします。
Download Raspbian for Raspberry Pi
GUIは必要ないのでLITE版を選択しました。
RASPBIAN JESSIE LITE
2017-03-02-raspbian-jessie-lite.zip
ダウンロードしたZIPファイルを展開します。
2017-03-02-raspbian-jessie-lite.img
SDカードの場所を確認します。
$ diskutil list /dev/disk4 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *15.9 GB disk4 1: DOS_FAT_32 RPZ 15.9 GB disk4s1
SDカードをアンマウントします。
$ sudo diskutil unmountDisk /dev/disk4 Unmount of all volumes on disk4 was successful
イメージを書き込みます。
$ sudo dd bs=1m if=/Users/user/Desktop/2017-03-02-raspbian-jessie-lite.img of=/dev/disk4 1329+0 records in 1329+0 records out 1393557504 bytes transferred in 394.756262 secs (3530172 bytes/sec)
control + T で進捗を確認出来ます。
load: 1.77 cmd: dd 914 uninterruptible 0.00u 6.23s 1151+0 records in 1150+0 records out 1205862400 bytes transferred in 341.178260 secs (3534406 bytes/sec)
書き込みが終わるとbootが自動的にマウントされますので、OTG接続する為に設定ファイルを修正していきます。
config.txtの最終行に追加する。
dtoverlay=dwc2
cmdline.txtのrootwait quietの間に追加する。
modules-load=dwc2,g_ether
“ssh”の空ファイルで作成する。最初にはまりましたが、空ファイルを作成することでSSHが有効になる様です。
SDカードをアンマウントします。
$ sudo diskutil unmountDisk /dev/disk4 Unmount of all volumes on disk4 was successful
microUSBでRaspberry Pi ZeroにSSH接続
イメージを書き込んだmicroSDカードを挿入してmicroUSBで繋ぎます。緑色のLEDが点滅して点灯に変われば起動しているはずです。起動したらSSHで接続します。Bonjourで「raspberrypi.local」で接続出来ます。
ユーザーは「pi」、パスワードは「raspberry」です。
$ ssh pi@raspberrypi.local The authenticity of host 'raspberrypi.local (fe80::ccb8:7a6a:d02a:d1ee%en4)' can't be established. ECDSA key fingerprint is SHA256:tdCDwa1PoczdYv2DA0GITB5Tp3KZ0XtLGAWtlUA+kog. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'raspberrypi.local,fe80::ccb8:7a6a:d02a:d1ee%en4' (ECDSA) to the list of known hosts. pi@raspberrypi.local's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. pi@raspberrypi:~ $
シャットダウンは緑色のLEDが消えればOKです。
pi@raspberrypi:~ $ sudo shutdown -h now Broadcast message from pi@raspberrypi on pts/0 (Tue 2017-03-07 12:05:07 UTC): The system is going down for power-off NOW! pi@raspberrypi:~ $ Connection to raspberrypi.local closed by remote host. Connection to raspberrypi.local closed.
参考
Installing operating system images on Mac OS – Raspberry Pi Documentation