官术网_书友最值得收藏!

Using OS X to validate a Raspbian image and write it to an SD card

If you are a Mac user, the process will be a little different from the Windows recipe, but still not too difficult. To do it, we'll leverage OS X's built-in *nix system tools.

Note

Mac OS X used to have a lot of options for easy GUI image writers, but many of them were not updated over time. After Yosemite 10.10.5, the Raspberry Pi community recommends using command-line tools. Fortunately, it is a pretty easy process.

How to do it...

The process for validating and copying a NOOBs installation on OS X is fairly straightforward:

  1. Open a Terminal window in OS X.
  2. Next, run shasum against the downloaded ZIP file to validate the signature:
    $ shasum ~/Downloads/2016-05-27-raspbian-jessie.zip 
    64c7ed611929ea5178fbb69b5a5f29cc9cc7c157 /Users/ed/Downloads/2016-05-27-raspbian-jessie.zip
    

    The Raspbian Jessie download and SHA-1 signature

  3. If the return value matches the SHA-1 signature provided on the Raspberry Pi downloads page, your file is good and can be unzipped:
    Note

    As the downloads change, the SHA-1 will change too, so you'll likely be comparing a different number to your shasum output.

    $ unzip ~/Downloads/2016-05-27-raspbian-jessie.zip 
    Archive: /Users/ed.snajder/Downloads/2016-05-27- raspbian-jessie.zip
    inflating: 2016-05-27-raspbian-jessie.img 
    
  4. Next, look at the filesystem before inserting the SD card:
    $ df -h
    Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
    /dev/disk1 232Gi 216Gi 16Gi 94% 56751574 4163032 93% /
    devfs 205Ki 205Ki 0Bi 100% 710 0 100% /dev
    map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
    map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
    map -fstab 0Bi 0Bi 0Bi 100% 0 0 100% /Network/Servers
    
  5. Then, insert the SD card and run the command again:
    $ df -h
    Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
    /dev/disk1 232Gi 216Gi 16Gi 94% 56751576 4163030 93% /
    devfs 211Ki 211Ki 0Bi 100% 730 0 100% /dev
    map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
    map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
    map -fstab 0Bi 0Bi 0Bi 100% 0 0 100% /Network/Servers
     /dev/disk2s6 63Mi 20Mi 43Mi 32% 512 0 100% /Volumes/boot 
     /dev/disk2s1 1.1Gi 1.0Gi 92Mi 92% 0 0 100% /Volumes/RECOVERY 
    
  6. As you can see, /dev/disk2s6 and /dev/disk2s1 were added. This creates two partitions on disk2 - most SD cards will only have one, but however many there are mounted, you need to unmount them with diskutil:
    $ sudo diskutil unmount /dev/disk2s1
    Password:
    Volume RECOVERY on disk2s1 unmounted
    $ sudo diskutil unmount /dev/disk2s6
    Volume boot on disk2s6 unmounted
    
    Note

    Very important: Running dd on the wrong device will be disastrous - use with extreme caution!

  7. There is a critical difference now from typical Linux drives and dd use. Let's say you had the aforementioned configuration and see that the SD card disk is disk2. For the dd command, you will change this to rdisk2:
    $ sudo dd bs=1m if=./2016-05-27-raspbian-jessie.img of=/dev/rdisk2 
    3833+0 records in
    3833+0 records out 4019191808 bytes transferred in 377.097088 secs (10658241 bytes/sec)
    
    Note

    The dd command can take a while to run, and doesn't provide any output while it is, so you can get that feeling it might be stuck. Be patient, depending on the speed of your SD Card it could take several minutes to copy. Newer versions of dd (on Ubuntu 16.04 and newer) include the status=progress flag, which will indicate copying progress.

  8. Finally, eject the disk, and you are ready to go!
    $ sudo diskutil eject /dev/rdisk2
    Disk /dev/rdisk2 ejected
    
主站蜘蛛池模板: 渝北区| 三门峡市| 泽州县| 西城区| 体育| 长白| 宜章县| 富川| 临桂县| 太康县| 绥中县| 历史| 南乐县| 浦东新区| 吐鲁番市| 庐江县| 昌平区| 巫山县| 镇巴县| 舞阳县| 双柏县| 岢岚县| 和顺县| 襄汾县| 且末县| 三原县| 若尔盖县| 墨脱县| 清苑县| 拜城县| 板桥市| 海南省| 泸水县| 綦江县| 五指山市| 枞阳县| 高雄市| 蓬安县| 舟曲县| 班玛县| 济宁市|