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

  • Raspberry Pi Zero Cookbook
  • Edward Snajder
  • 567字
  • 2021-07-09 19:12:08

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
    
主站蜘蛛池模板: 罗江县| 根河市| 南城县| 昌图县| 准格尔旗| 上饶市| 鄂尔多斯市| 文登市| 富顺县| 晋中市| 金昌市| 宿州市| 和平区| 巴南区| 鄂托克旗| 清丰县| 腾冲县| 刚察县| 呼和浩特市| 吴堡县| 会昌县| 秭归县| 嘉鱼县| 渑池县| 鹿邑县| 吉安市| 青阳县| 福安市| 呼玛县| 红桥区| 利辛县| 嫩江县| 瓮安县| 垦利县| 吉林省| 琼结县| 鄂伦春自治旗| 突泉县| 汨罗市| 长垣县| 华蓥市|