LoginSignup
8
8

More than 5 years have passed since last update.

Mac で Raspbian Jessie を MicroSD に書き込んだ

Posted at

まずは 公式サイトから zip をダウンロードしてくる。

zip を展開

展開しようとすると怒られる。

% unzip 2015-09-24-raspbian-jessie.zip
Archive:  2015-09-24-raspbian-jessie.zip
warning [2015-09-24-raspbian-jessie.zip]:  76 extra bytes at beginning or within zipfile
  (attempting to process anyway)
error [2015-09-24-raspbian-jessie.zip]:  reported length of central directory is
  -76 bytes too long (Atari STZip zipfile?  J.H.Holm ZIPSPLIT 1.1
  zipfile?).  Compensating...
   skipping: 2015-09-24-raspbian-jessie.img  need PK compat. v4.5 (can do v2.1)

note:  didn't find end-of-central-dir signature at end of central dir.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

ダウンロードに失敗しているわけでもなさそう。

% openssl sha1 2015-09-24-raspbian-jessie.zip
SHA1(2015-09-24-raspbian-jessie.zip)= d8d4880cd0e4f155f343984725d5bd94c1f86023

どうやら unzip では展開できないらしい。

ということで、

tar xvf 2015-09-24-raspbian-jessie.zip

で展開できた。zip 圧縮なのに tar でかつ unzip オプションなしで展開できるのが不思議。

リンク先にある ditto でも可能だった。ditto は Mac OS X 固有のコマンドらしい。

img を書き込む

MicroSD を Mac に挿入して認識したら、disk 番号を確認する。

% diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            499.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +499.0 GB   disk1
                                 Logical Volume on disk0s2
                                 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
                                 Unencrypted
/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.7 GB    disk2
   1:             Windows_FAT_32                         31.7 GB    disk2s1

容量を見るに、disk2 が MicroSD そう。一度アンマウントする。

% diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

dd コマンドで書き込む! 4, 5 分かかる。

% sudo dd bs=1m if=2015-09-24-raspbian-jessie.img of=/dev/rdisk2
Password:
4125+0 records in
4125+0 records out
4325376000 bytes transferred in 236.633469 secs (18278801 bytes/sec)

できた。

ところで、dd って何の略なんだろう?

dd コマンドの機能は「convert and copy a file」なので本当は cc コマンドにしたかったが、既に C コンパイラが cc という名前を使っていたので、仕方なく cc の次の dd にしたらしい。
http://x68000.q-e-d.net/~68user/unix/pickup?dd

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8