Compile and Install OpenWrt on VisionFive 2

This image version has passed internal testing, accesses ipv4\ipv6; accesses the network through direct connection or switch, router; supports real-time information, network diagnosis, and other network monitoring functions; and supports Passwall module. You can also install various plug-ins and configures Samba server, to meet your different development requirements.

The following instructions provide the user with the method to compile and install OpenWrt on VisionFive 2.

Installation

1. Download the code:

git clone https://github.com/starfive-tech/openwrt.git

Note: It is recommended to compile in Ubuntu system release 20 or above.

2. Execute the following command to enter wigyori directory:

cd openwrt/

3. Execute the following command to checkout the image:

git checkout jh71x0-openwrt

Configuration

1. Execute the following command to enter the menu configuration GUI:

make menuconfig

In the menu configuration GUI, follow the steps to select the corresponding option:

a. In OpenWrt Configuration, select Target System and Target Profile

→ Target System (StarFive JH71x0 (7100/7110))
→ Target Profile (StarFive VisionFive 2 v1.2a) or Target Profile (StarFive VisionFive 2 v1.3b)

Note: VisionFive 2 currently has 2 versions, v1.2a and v1.3b.

b. In OpenWrt Configuration, select Root filesystem archives under Target Image:

2. Luci configuration:

a. Execute the following command to install luci:

./scripts/feeds update packages luci
./scripts/feeds install -a -p luci

b. Execute the following command to enter the menu configuration GUI to configure luci:

make menuconfig

c. Select uhttpd in the configuration menu bar in the following order:

→ Network → Web Servers/Proxies → <*> uhttpd

d. Select luci in the configuration menu bar in the following order:

→ LuCI → 1. Collections → <*> luci

→ LuCI → 3. Applications → <> luci-app-ddns
<
> luci-app-firewall
<> luci-app-ntpc
<
> luci-app-samba4
<*> luci-app-uhttpd

→ LuCI → 4. Themes → Select all

3. Wireless Configuration

Due to the lack of WiFi modules on VisionFive 2, you need to purchase a WiFi Dongle. OpenWrt supports dozens of WiFi drivers, and the RTL8821AE PCI interface driver, which is easier to purchase, is chosen here. On VisionFive 2, there is an M.2 M-key interface, which needs to be connected to the NVME M.2 M-key to a/e key interface board to connect to the RTL8821AE module.

In the menu configuration GUI, follow the steps to configure wireless connection:

a. → Kernel modules → Wireless Driver → <> kmod-cfg80211
<
> kmod-mac80211
<*> kmod-rtl8821ae

b. → Network → WirelessAPD → <> wpad-basic-mbedtls
<
> hostapd-common
<> wpa-cli
<
> hostapd-utils

4. Execute the following command to download the dependency packages:

./scripts/feeds update -a
./scripts/feeds install -a
make download V=s

Note: The download process may take a long time, please be patient. If a “download fail” error occurs during the process, it indicates that the software package has not been fully downloaded. Please execute the above command again until no “download fail” occurs.

5. Execute the following command to compile:

make -j8

Note: The compilation may take 2 hours.

6. Execute the following command to generate an SD card image:

bin/targets/jh71x0/generic
openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img.gz

7. Unzip the SD card image:

gunzip openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img.gz

8. Flash the image into the SD card:

dd if=openwrt-jh71x0-generic-visionfive2-v1.3b-ext4-sdcard.img of=/dev/sdX bs=1M
oflag=direct

Note:

  • For Windows, you can use balenaEtcher to flash the image.

  • Since the image does not include SPL and U-Boot, Nor Flash needs to have SPL and U-Boot flashed and should boot with QSPI Nor Flash.

  • Use the sudo fdisk –l command to find your device so that you can replace X value. For exmple, if your device is /dev/sdb, X should be b.

9. Open OpenWrt.

10. Add passwall function.

Follow the steps below to add the passwall function. The passwall function is not included in the default function and requires code modification and package download support.

a. Execute the following command under wigori directory:

echo "src-git passwall_packages
https://github.com/xiaorouji/openwrt-passwall-packages.git;main" >> "feeds.conf.default"
echo "src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main" >>
"feeds.conf.default"

b. Modify include/target.mk:

diff --git a/include/target.mk b/include/target.mk
index b5e3e7ff6f..f65e127ecf 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -53,7 +53,7 @@ DEFAULT_PACKAGES.nas:=\
              mdadm
# For router targets
DEFAULT_PACKAGES.router:=\
-            dnsmasq \
+           dnsmasq-full \

c. Download and install the package of passwall:

./scripts/feeds update -a
./scripts/feeds install -a
./scripts/feeds install -a -f -p PWpackages
./scripts/feeds install luci-app-passwall

d. Configure passwall and unconfigure dnsmasq:

make menuconfig

Configure passwall:

→ OpenWrt Configuration → LuCI → 3. Applications → <*> luci-app-passwall

Unconfigure dnsmasq:

→ OpenWrt Configuration → Base system → < >dnsmasq
→ OpenWrt Configuration → Base system → -*- dnsmasq-full

e. Execute the following command to update and download software package:

make download V=s

f. Compilation:

The same as step 5。

2 Likes

It is good to know that there is SOME progress in the issue of fulfilling the router/gateway function promise given at the public introduction of the Vision Five 2 (3 Gigabit Ethernet ports would have been nice though, instead of only 2 Gigabit Ethernet ports for a DMZ configuration in full control of the Vision Five 2 machine not needing an extra OpenWRT box for its subnets). Though, the capabilities of the Vision Five 2 exceed by far that of an OpenWRT router and it would be a waste of its potential to make it an OpenWRT router box. I bought it to make it a DMZ (DMZ (computing) - Wikipedia) gateway and router as well as DMZ server and comfortably accessible machine. A working nftables kernel firewall and IP packet routing support in the debian-202308 image would have already done that job, but the starfive-5.15.0 kernel in the debian-202308 image does not support the nftables kernel firewall subsystem, which is quite pity.

Hi there, I confirmed with software engineers that nftables is suppoted and enabled in the kernel. Please check if you encounter any other issue that stops it from working.

Hi @ErinD

I am testing a WiFi dongle with OpenWRT, which is provided with the VisionFive 2 board. in steps(link) mentioned, in step 3 (Wireless Configuration), installed some drivers:

a. → Kernel modules → Wireless Driver → kmod-cfg80211 kmod-mac80211 <*> kmod-rtl8821ae

On the Luci page, there is no tab for wireless.
Also, in ifconfig, it does not show the WiFi port.

Do we need to install any other drivers to access the wireless network on the Vision 2 board using the WiFi dongle?

Did you use the aic8800 usb wifi dongle? This is not support by openwrt.
The tested WiFi is RTL8821AE, (The price is about 4$ in China).

1 Like

I’m using this wifi dongle i am not sure about the name of this model this came with a Vision Five 2 board,

image

This section has been updated:

1. Download the code:

git clone https://github.com/starfive-tech/openwrt.git

Note: It is recommended to compile in Ubuntu system release 20 or above.

2. Execute the following command to enter wigyori directory:

cd openwrt/

3. Execute the following command to checkout the image:

git checkout jh71x0-openwrt

3 Likes

Click to get the PDF version: