赞
踩
页面:https://busybox.net/downloads/binaries/
地址:https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-armv7r
- hdc smode
- hdc shell mount -oremount,rw /
- hdc file send busybox-armv7r /system/bin/busybox
- hdc shell chmod a+x /system/bin/busybox
- hdc shell mkdir /system/busybox
- hdc shell busybox --install -s /system/busybox
- hdc shell
- export PATH="$PATH:/system/busybox"
现在你可以尽情的使用常见的linux命令
- # 如以下命令
- ifconfig -a
- ping 127.0.0.1
- vi /etc/prop.default
推送udhcpc.script到开发板
- hdc smode
- hdc shell mount -oremount,rw /
- hdc file send udhcpc.script /system/busybox/udhcpc.script
- hdc shell chmod a+x /system/busybox/udhcpc.script
udhcpc.script内容如下
- #!/system/bin/sh
- # file: udhcpc.script
- case $1 in
- bound|renew)
- [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
- [ -n "$subnet" ] && NETMASK="netmask $subnet"
- ifconfig $interface $ip $BROADCAST $NETMASK
-
- if [ -n "$router" ]; then
- ip route del default >/dev/null
- ip route add default via $router
- fi
-
- if [ -n "$dns" ]; then
- rm /data/local/tmp/busybox-resolv.conf -f
- for i in $dns; do
- echo "nameserver $i" >> /data/local/tmp/busybox-resolv.conf
- done
- ln -sf /data/local/tmp/busybox-resolv.conf /etc/resolv.conf
- fi
- esac
将开发板的网线插在路由器上
- hdc shell
- export PATH="$PATH:/system/busybox"
- # 使能eth0
- ifconfig eth0 up
- udhcpc -i eth0 -s /system/busybox/udhcpc.script
- # 检查网络连通
- ping www.baidu.com -c 4
- # 获取公网IP地址
- wget -O- http://checkip.amazonaws.com 2>/dev/null
注意:本篇文章中提供的busybox使用musl作为C库,所以nameserver需要用到/etc/resolv.conf文件。但openharmony标准系统并不需要用到这个文件。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。