笔者的环境

1. Macbook 电脑用于烧录树莓派系统到SD卡

2. 树莓派 zero w

把SD卡放进读卡器,插到Mac电脑上, 打开命令行工具Terminal

  • diskutil list列出disk列表
  • diskutil unmountDisk 设备名称
  • dd命令烧录
MacBook-Pro Volumes$ diskutil list
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 251.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 250.7 GB disk0s2 /dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +250.7 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD 207.1 GB disk1s1
2: APFS Volume Preboot 22.5 MB disk1s2
3: APFS Volume Recovery 515.0 MB disk1s3
4: APFS Volume VM 2.1 GB disk1s4 /dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *31.9 GB disk2
1: Windows_FAT_32 boot 268.4 MB disk2s1
2: Linux 31.6 GB disk2s2
MacBook-Pro Volumes$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
MacBook-Pro Volumes$ sudo dd if=/Users/klaus/Downloads/2019-07-10-raspbian-buster-lite.img of=/dev/disk2 bs=1m

烧录结束后,boot分区会自动挂载到Mac上

在boot分区上添加两个文件, ssh 文件是一个空文件,在系统启动后,系统会根据这个文件开启系统的SSh服务,wpa_supplicant.conf文件会让系统配置该文件内的WIFI信息

ssh

wpa_supplicant.conf

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1 network={
ssid="WIFI_SSID"
scan_ssid=1
psk="WIFI_PASSWORD"
key_mgmt=WPA-PSK
}

系统启动后,通过路由器找到树莓派的IP,默认用户名是pi, 默认密码是raspberry

05-23 00:10