修改boot盘下文件
使用USB Gadget驱动将USB-OTG模拟为有线网卡:
1. 修改boot分区里的config.txt文件,在新一行添加:
dtoverlay=dwc2
2. 修改boot分区里的cmdline.txt文件,在rootwait后添加:
modules-load=dwc2,g_ether
注意添加内容前后需要有空格。
连接电脑
先接通电源,然后使用USB连接电脑,利用SSH登录树莓派,初始密码为raspberry:
ssh pi@raspberrypi.local
如果出现Host key verification failed. 的错误,只要清除已存的公钥信息就可以:
ssh-keygen -R raspberrypi.local
配置网络连接文件
1. 更改interfaces文件:
sudo nano /etc/network/interfaces
在文件中更改:
auto lo
iface lo inet loopback
iface eth0 inet manual
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
2. 更改wpa_supplicant.conf文件:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
在文件最后添加:
network={
ssid="YourAP"
key_mgmt=WPA-PSK
psk="YourPassword"
priority=5
}
network={
ssid="YourAP"
key_mgmt=NONE
priority=4
}
其中priority为优先级,数字大的优先级较高
连接无线网络
1. 输入以下命令(用于连接无密码的Wi-Fi网络):
sudo iwconfig wlan0 essid "YourAP"
使用iwconfig wlan0命令查看连接状态。
2. 完成后重启网络:
sudo /etc/init.d/networking restart
重启网络后可以ping下其他网络看是否连接成功。
更换源
1. 打开sources.list文件:
sudo nano /etc/apt/sources.list
2. 加入阿里源(可选择其他国内源):
deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
3. 更新:
sudo apt-get update && apt-get upgrade -y
本文详述了在macOS Sierra 10.12.6环境下配置Raspberry Pi Zero W的步骤,包括修改boot分区文件、通过USB连接电脑、配置网络连接文件以连接无线网络,并指导更换软件源以加速下载。
&spm=1001.2101.3001.5002&articleId=78065252&d=1&t=3&u=c5575d44248f4acda15d39fd0f3ca17a)
6263

被折叠的 条评论
为什么被折叠?



