本文是《【昉·星光 2 高性能RISC-V单板计算机体验】在昉·星光2上编译OpenWRT》的下篇,主要介绍如何基于编好的IMG文件烧入昉·星光 2 高性能RISC-V单板计算机并配置成一台真正可用的OpenWRT。
首先执行openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img.gz
将压缩文件解压缩成img文件。
root@EliteDesk:~/wigyori/bin/targets/jh71x0/generic$ gunzip openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img.gz
root@EliteDesk:~/wigyori/bin/targets/jh71x0/generic$ ls
config.buildinfo openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img profiles.json
feeds.buildinfo openwrt-jh71x0-generic-visionfive2-v1.3b.manifest sha256sums
openwrt-jh71x0-generic-rootfs.cpio.gz packages version.buildinfo
插入tf卡并找到tf卡的设备名,本次设备名是/dev/sdb
,如下:
Disk /dev/sdb: 14.86 GiB, 15931539456 bytes, 31116288 sectors
Disk model: SD Card Reader
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1EAB41CC-D75A-47CC-804D-CEB8295E2A38
Device Start End Sectors Size Type
/dev/sdb1 4096 8191 4096 2M HiFive Unleashed BBL
/dev/sdb2 8192 16383 8192 4M HiFive Unleashed FSBL
/dev/sdb3 16384 221183 204800 100M EFI System
/dev/sdb4 221184 8189918 7968735 3.8G Linux filesystem
最后执行命令sudo dd if=openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img of=/dev/sdb bs=1M oflagirect
将img写入tf卡。
root@EliteDesk:~/wigyori/bin/targets/jh71x0/generic$ sudo dd if=openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img of=/dev/sdb bs=1M oflagirect
197+1 records in
197+1 records out
206587685 bytes (207 MB, 197 MiB) copied, 13.3596 s, 15.5 MB/s
连接好串口线,上电启动。
可以看出,之前编译内核选择的MT7601U驱动已经注册上。
[ 7.768106] kmodloader: loading kernel modules from /etc/modules.d/*
[ 7.797958] Loading modules backported from Linux version v6.1.24-0-g0102425ac76b
[ 7.805455] Backport generated by backports.git v5.15.92-1-44-gd6ea70fafd36
[ 8.095998] urngd: v1.0.2 started.
[ 8.942390] usbcore: registered new interface driver mt7601u
[ 9.076183] PPP generic driver version 2.4.2
[ 9.081267] NET: Registered PF_PPPOX protocol family
[ 9.089881] kmodloader: done loading kernel modules from /etc/modules.d/*
最后熟悉的欢迎界面。
看看系统版本。
基本思路是把eth1配置成WAN口,eth0配置成LAN口,直接修改/etc/config/network
文件成如下内容(其中WAN6可以删除,没啥用途):
root@OpenWrt:/# cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd59:7202:60eb::/48'
config device
option type 'bridge'
option name 'br-lan'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
config interface 'wan'
option device 'eth1'
option proto 'dhcp'
config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'
保存文件,并通过/etc/init.d/network restart
重启系统网络服务。然后使用ping工具简单测试下网路是否通畅:
一切OK,PC先断WiFi并通过双绞线连接至VF2的eth0继续测试,可以看到PC已经拿到LAN内IP,192.168.2.204。
这样,简单的OpenWRT已经运行起来。
PC浏览器中敲入http://192.168.2.1/
登录openWRT管理系统。系统比之前RV社区发的那个IMG看起来版本要新,功能也多。
一进去reset好root密码后就是概览页,简洁明了。
实时状态看流量:
MT7601U设置启动并扫描无线信道,可以设置AP。
路由状态。
功能很多,一时半会无法尽数展示,最后来个PC侧跑网速测试。
来张全配置全连接合影图。
新的系统运行已超过24小时,期间PC一直在各种操作,包括高速下载,一切感受正常,系统也很稳定,可能冬天的关系,SoC没加散热片也能正常工作。
最后感谢StarFive & Elecfans提供的试用机会。
向从MIPS到RISC-V奉献的大佬们致敬。
更多回帖