Skip to content

Commit 146a829

Browse files
committed
hw: hikey: configure wifi
Signed-off-by: Luc Ma <luc@sietium.com>
1 parent 83163a7 commit 146a829

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

source/_posts/hw/hikey970.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,57 @@ total 4.0K
165165

166166
![Debian vs. Ubuntu](/images/hikey970/debian-vs-ubuntu.png)
167167

168+
## NetworkManager vs wpasupplicant
169+
170+
点亮吹灰 Hikey970 用的是 [hikey970-ubuntu-image](https://github.com/mengzhuo/hikey970-ubuntu-image), 它的 rootfs 里安装的是 NetworkManager, 当我试着将 hikey970-ubuntu-image 转换成 hikey970-debian-image 时,发现 debootstrap 会因为奇怪的包依赖问题,无法安装 NetworkManager, 而且了解到 wpasupplicant 可以完成同样的事情(连接 WiFi,让板子联网), 而且体量更小,更适合这种开发板。
171+
172+
所以这个 Debian 12 rootfs 网络这块使用了 **wpasupplicant**, **iw**, **iproute2**, **dhcpcd5** 四剑客
173+
174+
- wpasupplicant
175+
176+
```rootfs/etc/systemd/system/wpa_supplicant@.service
177+
[Unit]
178+
Description=WPA supplicant daemon (interface %i)
179+
After=sys-subsystem-net-devices-%i.device
180+
Wants=sys-subsystem-net-devices-%i.device
181+
182+
[Service]
183+
Type=simple
184+
ExecStart=/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i %i
185+
Restart=on-failure
186+
187+
[Install]
188+
WantedBy=multi-user.target
189+
```
190+
191+
Note:
192+
193+
1.`systemctl enable wpa_supplicant@wlan0.service` 时 systemd 会自动创建一个符号链接文件到 `/etc/systemd/system/wpa_supplicant@.service`, 而文件里的 `%i` 是无线网络设备接口名,即 **wlan0**.
194+
2. 手动创建 `/etc/wpa_supplicant/wpa_supplicant.conf`
195+
```
196+
wpa_passphrase <SSID> <PASSWORD> >/etc/wpa_supplicant/wpa_supplicant.conf
197+
```
198+
199+
- iw
200+
201+
```/sbin/iw
202+
iw dev wlan0 scan | grep 'SSID:'
203+
iw dev wlan0 connect <SSID>
204+
```
205+
- iproute2
206+
207+
```/bin/ip
208+
ip link show wlan0
209+
ip addr wlan0
210+
```
211+
212+
- dhcpcd5
213+
214+
```
215+
systemctl enable dhcpcd.service
216+
systemctl start dhcpcd.service
217+
```
218+
168219
# 显示
169220

170221
```mermaid

0 commit comments

Comments
 (0)