Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for NanoPi R6S #147

Open
TalalMash opened this issue May 4, 2023 · 99 comments
Open

Support for NanoPi R6S #147

TalalMash opened this issue May 4, 2023 · 99 comments

Comments

@TalalMash
Copy link
Member

TalalMash commented May 4, 2023

Status: In development
Current source: official FriendlyWrt source build.

Notes:

  • Removed rtw88 module (failing to build on latest)

Known issues:

  • Connected USB ethernet device on powerup affects integrated ethernet ports
@TalalMash
Copy link
Member Author

@kputland #95 (comment), uploaded a test release: https://github.com/SmoothWAN/SmoothWAN/releases/tag/local1

@kputland
Copy link

kputland commented May 5, 2023

sd-card image?

@kputland
Copy link

kputland commented May 5, 2023

It boots from image installed on sd-card.

It doesn't want to flash to eMMC
image

default password remained password though adguard was the smoothwan default
USB network didn't get dhcp on reconnect.

speedify install logs show installed, but nothing is in /usr/share/speedify
image

/
root@FriendlyWrt:/# cd /usr/share/speedify/
root@FriendlyWrt:/usr/share/speedify# ls
logs
root@FriendlyWrt:/usr/share/speedify# ls -l
total 4
drwxr-xr-x 2 root root 4096 May  5 12:40 logs
root@FriendlyWrt:/usr/share/speedify#

speedify UI says not configured.

for cpufreq and irqbalance, the /etc/config files should be used

# from rc.local
#Set CPU to performance (some CPUs stutter when changing freq)
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor &

#Run irqbalance
irqbalance &

OR

for x in  /sys/devices/system/cpu/cpufreq/policy*/scaling_governor; do echo "performance" > $x; done

uci settings are there for speedifyconf

root@FriendlyWrt:~# uci show speedifyconf
speedifyconf.Setup=config
speedifyconf.Setup.enabled='1'
speedifyconf.Setup.apt='https://apt.connectify.me/'
speedifyconf.Setup.logpath='logs'
speedifyconf.Setup.renamer='1'
speedifyconf.Setup.version='13.2.1-10893'
root@FriendlyWrt:~#
root@FriendlyWrt:~# find / -name '*speedify*'
/etc/rc.d/S99speedifyconf
/etc/init.d/speedifyconf
/etc/config/speedifyconf
/www/luci-static/resources/view/speedifyconf
/usr/share/rpcd/acl.d/luci-app-speedifyconf.json
/usr/share/luci/menu.d/luci-app-speedifyconf.json
/usr/share/speedify
/usr/lib/lua/luci/view/speedifyconf
/usr/lib/lua/luci/view/admin_status/index.htm.speedify
/usr/lib/lua/luci/model/cbi/speedifyconf
/usr/lib/lua/luci/controller/speedifyconf
/usr/lib/opkg/info/luci-app-speedifyconf.control
/usr/lib/opkg/info/luci-app-speedifyconf.list
/usr/lib/opkg/info/luci-app-speedifyconf.prerm
/usr/lib/opkg/info/speedifyconf.conffiles
/usr/lib/opkg/info/speedifyconf.control
/usr/lib/opkg/info/speedifyconf.list
/usr/lib/opkg/info/speedifyconf.prerm
/usr/lib/speedifyconf
/usr/lib/speedifyconf/speedifyconfig.log
/tmp/speedifyconfig.log
/tmp/.uci/speedifyconf
/tmp/lock/procd_speedifyconf.lock
/tmp/run/rpcd/uci-2b87409dbe88683d21283d1dbdef1a67/speedifyconf
root@FriendlyWrt:~#

Let me know what you need

@kputland
Copy link

kputland commented May 5, 2023


sh: can't open 'DisableRpFilter.sh': No such file or directory
uci: Entry not found
sh: 1: unknown operand
nice: ‘capsh’: No such file or directory
/etc/rc.common: ./run.sh: line 96: ./speedify_cli: not found
Running
Syntax: ./run.sh [command]

Available commands:
        start           Start the service
        stop            Stop the service
        restart         Restart the service
        reload          Reload configuration files (or restart if service does not implement reload)
        enable          Enable service autostart
        disable         Disable service autostart
        enabled         Check if service is started on boot

root@FriendlyWrt:/usr/lib/speedifyconf# find / -name ^C
root@FriendlyWrt:/usr/lib/speedifyconf# find / -name DisableRpFilter.sh
root@FriendlyWrt:/usr/lib/speedifyconf#

@kputland
Copy link

kputland commented May 5, 2023

capsh required libcap-bin and libcap-ng-bin

@kputland
Copy link

kputland commented May 5, 2023

ar missing so deb never extracted.

@kputland
Copy link

kputland commented May 5, 2023

Manually got it all installed.
eth2 2.5Gb WAN port is not configured by default

image

image

@kputland
Copy link

kputland commented May 5, 2023

Moved the hotspot onto a usb3 hub and the interface name changed
image

@kputland
Copy link

kputland commented May 5, 2023

eth2 (Comcast) has connectivity issues if speedify changes connections to a different server.

@kputland
Copy link

kputland commented May 5, 2023

I can definitely work with this kind of speeds.
image

@kputland
Copy link

kputland commented May 5, 2023

900Mbps

image

@kputland
Copy link

kputland commented May 5, 2023

root@FriendlyWrt:/sys/class/leds# /etc/init.d/led start
setting up led WAN
setting up led LAN1
setting up led LAN2
root@FriendlyWrt:/sys/class/leds# /etc/init.d/led enabled
root@FriendlyWrt:/sys/class/leds#

@kputland
Copy link

kputland commented May 5, 2023

weird interface state
image

root@FriendlyWrt:/sys/class/leds# ping -I USB_c146 192.168.2.1
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=2.292 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=2.069 ms
64 bytes from 192.168.2.1: seq=2 ttl=64 time=2.106 ms
^C
--- 192.168.2.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 2.069/2.155/2.292 ms
root@FriendlyWrt:/sys/class/leds#

@TalalMash
Copy link
Member Author

Thanks! Looks promising, gigabit is impressive, and this is on public servers.
Will release the EMMC image next time and Docker enabled too.

  • Info before next image:
uci show
service
ip route
ls /sys/devices/system/cpu
cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
  • For the ip route try to replicate the behaviour when eth2 is not working.
  • Regarding cpufreq, do you mean the FriendlyWrt CPU frequency LuCI app should replace it?
    - ...cpuinfo_cur_freq should show if the for loop is needed for small/large core adjustment.

Moved the hotspot onto a usb3 hub and the interface name changed

This is the expected behaviour.

USB network didn't get dhcp on reconnect.

Does it work with the renamer off and set manually in Network -> Interfaces?

  • What's under the NAS menu?

@kputland
Copy link

kputland commented May 5, 2023

under NAS.
image
Though in the default FriendlyWRT there were six or seven choices.

@kputland
Copy link

kputland commented May 5, 2023

smoothwan_r6s_logs.zip

irqbalance can be run from the service enabled, not from rc.local.

cpufreq I think will need the loop. luci/uci doesn't know about the different processor pools. The luci/uci settings only affected policy0 and left the performance cores at a lower frequence, unless it's smart enough to sort it all out. I'd have to do back-to-back tests with the governor changes.

image

@kputland
Copy link

kputland commented May 5, 2023

interfaces are still renamed with usb renaming checkbox unchcecked.

@kputland
Copy link

kputland commented May 5, 2023

thermal performance vs schedutil. Definitely cooler with schedutil.
image

@kputland
Copy link

kputland commented May 5, 2023

clicking restart interface in the network menu doesn't bring the interface back up.
log attached
usb_network_interface_restart.log

@TalalMash
Copy link
Member Author

TalalMash commented May 6, 2023

Added branch and new release:
https://github.com/SmoothWAN/SmoothWAN/releases/tag/local1
https://github.com/SmoothWAN/SmoothWAN/tree/npi-r6s/devconfigs/npir6s

Removed any cpu freq adjustment, default and the easy to use LuCI menu seems to be enough. (default ondemad is aggressive looking at source)
I'm guessing performance governor may be needed for UDP transport mode, and Engarde which is system latency sensitive.

Have yet to add USB profiles for when the renamer is off, you will need to add these manually, will be added next release.

Port Layout

@TalalMash
Copy link
Member Author

clicking restart interface in the network menu doesn't bring the interface back up. log attached usb_network_interface_restart.log

You may need to restart the device, this also happens with other hardware.

@TalalMash
Copy link
Member Author

Uploaded new image with pre-made usb0 files and uhttpd fix.

@kputland
Copy link

kputland commented May 6, 2023

Not sure what's going on here. eth2 is assigned to wan and wan6 as well as AutoWANeth2
image

@kputland
Copy link

kputland commented May 6, 2023

Causing two udhcpc instances

12202 root      1320 S    udhcpc -p /var/run/udhcpc-eth2.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth2 -x hostname:FriendlyWrt -C -R -O 121
12205 root      1320 S    udhcpc -p /var/run/udhcpc-eth2.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth2 -x hostname:FriendlyWrt -C -R -O 121

@kputland
Copy link

kputland commented May 6, 2023

speedifyui fails to download and install.
Manual installation and it's now running.

root@FriendlyWrt:/tmp/spddw/speedifyui# UIDW=$(sed -n '/speedifyui/{nnnnnnnn;p;q}' $PKGS | awk '/Filename/{gsub("Filename: ", "");print;exit}')
sed: -e expression #1, char 15: extra characters after command
root@FriendlyWrt:/tmp/spddw/speedifyui# 

had to change it to this

root@FriendlyWrt:/tmp/spddw/speedifyui# sed -n '/speedifyui/{n;n;n;n;n;n;n;n;p;q}' $PKGS
Filename: pool/main/s/speedifyui/speedifyui_13.2.1-10893_arm64.deb

Or this could work

root@FriendlyWrt:/tmp/spddw/speedifyui# grep 'Filename.*speedifyui' $PKGS | head -n1 | sed -n "s/Filename: //p"
pool/main/s/speedifyui/speedifyui_13.2.1-10893_arm64.deb
root@FriendlyWrt:/tmp/spddw/speedifyui# sed --version
sed (GNU sed) 4.8

This nnnnn is in two other places in run.sh

@kputland
Copy link

kputland commented May 6, 2023

uci-defaults/99_custom didn't appear to make it into the image. smoothwan_0.99.5HF5_4296f32_friendlywrt_22.03_20230506_nanopi-r6s_arm64_sd

root@FriendlyWrt:~# ls -l /etc/uci-defaults/
total 4
-rwxrwxr-x 1 root root 2938 Mar 10 16:34 99_luci-app-emmc-tools
root@FriendlyWrt:~# 

@kputland
Copy link

kputland commented May 6, 2023

eth0, though assisgned to AutoWANeth1 is also still part of the br-lan. In my case I need to leave it as attached to br-lan.
Maybe eth0 should be left unassigned with documentation to add it back for LAN or WAN use.

-rwxrwxr-x 1 root root 2938 Mar 10 16:34 99_luci-app-emmc-tools
root@FriendlyWrt:~# uci show network.@device[1]
network.cfg040f15=device
network.cfg040f15.name='br-lan'
network.cfg040f15.type='bridge'
network.cfg040f15.ports='eth1' 'eth0'

@kputland
Copy link

kputland commented May 6, 2023

Something with the eth2 config looks to have some bridge holdover. It souldn't have the list ports eth1

network.cfg030f15=device
network.cfg030f15.name='eth2'
network.cfg030f15.macaddr='52:53:d4:77:f2:cc'
network.cfg030f15.ports='eth1'

@TalalMash
Copy link
Member Author

TalalMash commented May 6, 2023

Thanks, seems like sed is full in friendlywrt.
Upon error free exit, OpenWrt deletes the uci-defaults contents.

Not sure what's going on here. eth2 is assigned to wan and wan6 as well as AutoWANeth2

Bridge is cfg040f15 apparently, also it seems like the USB profiles are missing, guess I uploaded the old image.
Uploading new one.

@TalalMash
Copy link
Member Author

Uploaded new one with rename to PortOne/PortTwo.

@kputland
Copy link

Not sure hwo the usb thing is happening. The 2.5G ethernet is loaded with 10-r8125 and the usb starts with 20-usb-core

@kputland
Copy link

I wonder if turning renaming back on would help. Though searching for the errors I was receiving shows a patch that needs to be looked for

https://patchwork.ozlabs.org/project/openwrt/patch/20200311131310.32594-1-kristian.evensen@gmail.com/

With renaming on I was getting the Claim failed error.

@TalalMash
Copy link
Member Author

TalalMash commented May 10, 2023

If the USB interface gets renamed, what would the internal port use? I would assume eth2+? Since the USB port boots with eth*.
Not sure how complex this may get... Mainline OpenWrt seems to be trivial: https://forum.openwrt.org/t/nanopi-r6s-kernel-6-1-intergration/154677
Reverting changes to the ports for the next build with a tweak regarding MAC address.

@kputland
Copy link

kputland commented May 10, 2023

OK. I was able to get the keyboard hooked up on the latest. Also had a forced update on my mac and the network preferences pane is not showing updates so I had no idea that it was getting connected until a peek at ifconfig.
edited because I was a knucklehead and forgot to insert the sdcard Checking it out now.

BTW... Smoothwan had a shoutout on the Speedify office hours call today https://youtu.be/XydKR_byZqs?t=2495

@kputland
Copy link

root@FriendlyWrt:/usr/share/speedify# ./speedify -d logs
-bash: ./speedify: cannot execute: required file not found

@kputland
Copy link

What do I need for a build environment? It could speed things up if I can build and test images.

@TalalMash
Copy link
Member Author

TalalMash commented May 11, 2023

BTW... Smoothwan had a shoutout on the Speedify office hours call today https://youtu.be/XydKR_byZqs?t=2495

Thanks @Connectify for the praise!

Reverted the changes for working ports.
If you're using Windows, Docker in VM may be less invasive, Docker WSL2/Hyper-V is untested.
First build takes a long time, rough setup using Ubuntu Docker for OS agnostic build:

  • Replace ~/build with a directory of your choice (builds outside docker)
    docker run --name ubuntu18 --privileged -it -v ~/build:/work ubuntu:18.04 bash
  • Note: to resume after exit do:
    docker start ubuntu18
    docker exec -it ubuntu18 bash
  • Continue:
    apt update && apt install git python build-essential clang flex bison g++ gawk gcc-multilib g++-multilib \ gettext git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev file wget
    cd /work && mkdir friendlywrt21-rk3588
    git clone https://github.com/friendlyarm/repo --depth 1 tools
    git config --global user.email "anon@anon.com"
    git config --global user.name "anon"
    tools/repo init -u https://github.com/friendlyarm/friendlywrt_manifests -b master-v21.02 -m rk3588.xml --repo-url=https://github.com/friendlyarm/repo --no-clone-bundle
  • Press Enter
    tools/repo sync -c --no-clone-bundle
    cd friendlywrt && git clone https://github.com/SmoothWAN/SmoothWAN.git && mkdir smoothwan-feeds
    cd SmoothWAN && git checkout npi-r6s && cp -rP devconfigs/npir6s/. .. && cp -rP packages/. ../smoothwan-feeds && cd ..
    sh sideload-glibc.sh
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    FORCE_UNSAFE_CONFIGURE=1 make -j16 (reduce -j16 to -j8 for <10GB RAM)
  • Run on fresh start only:
    ./build.sh uboot && ./build.sh kernel
  • Create the image, use emmc-img for flashable EMMC.
    cd .. && ./build.sh sd-img
  • Image found in out folder, you can use your file browser to access the folder assigned in the first step.

@kputland
Copy link

I'll look at getting the build env set up.
I was testing the other FriendlyElec images and the unbuntu desktop image has the same problem with USB network interfaces being configured before the 2.5G interfaces.

@TalalMash
Copy link
Member Author

TalalMash commented May 11, 2023

Great test, will add a rename script for the internal ports using PCI-E paths or other means.

@kputland
Copy link

Are you on discord/slack/.... ?

@kputland
Copy link

I'm on an M1 mac. I have docker desktop installed. I have an x86 mac available and a windoze machine if needed. I tried from the M1 in an ubuntu container.

root@2e70d70de620:~# apt install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package git
root@2e70d70de620:~# 

@TalalMash
Copy link
Member Author

Discourse chat is working, I'm available.
Not sure if x86 is emulated or using arm64, you may have to use x86 Mac
Forgot to add apt update

@kputland
Copy link

Making some slow progress

Checking 'ldconfig-stub'... ok.
ERROR: please fix package/friendlyelec/luci-app-cpufreq/Makefile - see logs/package/friendlyelec/luci-app-cpufreq/dump.txt for details
ERROR: please fix package/friendlyelec/luci-app-netdata/Makefile - see logs/package/friendlyelec/luci-app-netdata/dump.txt for details

This step repo-url=https://github.com/friendlyarm/repo --no-clone-bundle took a very long time
Now in the make step

WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!

@TalalMash
Copy link
Member Author

TalalMash commented May 11, 2023

Ensure that the .config file is copied and equal to repo (as well as the other files in friendlwrt folder), you can ignore the warning.

@TalalMash
Copy link
Member Author

Sorry, forgot to add:

./scripts/feeds update -a
./scripts/feeds install -a

before make...

@TalalMash
Copy link
Member Author

Updated .config for usbmuxd.

@kputland
Copy link

Downloaded latest.

Even though uhttpd is disabled it still starts.
Adding this to end of /etc/rc.local sorts it out

/etc/init.d/uhttpd stop
/etc/init.d/nginx start

eth0 needs to be removed from br-lan by default if assigned to PortOne
MAC address of eth0 should not be set by uci. It currently matches br-lan and other LAN interfaces.
image

Network completely disconnects when I connect device to USB.
Disabled the usb renaming.
Was able to connect the console and see that there was still network assigned.

Tried to reboot and it entered a boot loop.

@kputland
Copy link

getting this

Sat May 13 06:02:26 2023 daemon.info uwsgi-luci: ./speedify: cannot execute: required file not found

@TalalMash
Copy link
Member Author

I'm a bit confused, did the previous version smoothwan_770edbe_nanopi-r6s_arm64_sd.img.gz work, or was it an issue with your Mac?

@kputland
Copy link

I'm stepping back to what is currently running on the first box as a baseline.
smoothwan_0.99.9HF5_d452860_friendlywrt_22.03_20230507_nanopi-r6s_arm64_sd.img.gz
Then I'll test/retest the latest.

@TalalMash
Copy link
Member Author

I see, the latest vs 770edbe has the MAC address assignment removed..

getting this

Sat May 13 06:02:26 2023 daemon.info uwsgi-luci: ./speedify: cannot execute: required file not found

Is Speedify working?

@kputland
Copy link

After fixing typos, everything runs with latest speedify 13.3 on smoothwan_0.99.9HF5_d452860_friendlywrt_22.03_20230507_nanopi-r6s_arm64_sd.img.gz
renaming off.

@kputland
Copy link

Will flash latest on another card.

@kputland
Copy link

@TalalMash I have until Friday to work on this device. Let me know when you have a new build to test.

@TalalMash
Copy link
Member Author

Sure, should be soon.

@kputland
Copy link

any progress?

I did try again to get a build env working this time on ubuntu18 aarch64 running on the M1 mac. It was chugging along just fine, but eventually failed. package/Makefile:114: recipe for target 'package/firmware/linux-firmware/compile' failed

@TalalMash
Copy link
Member Author

TalalMash commented May 19, 2023

will upload when I can, OpenWrt has no support for aarch64 yet, add --platform linux/amd64 to docker run...

@kputland
Copy link

ok. I will try again.

@kputland
Copy link

I never did get the build env working. I'm back at a point where I can test again. I've been running on one R6S, and have a second to test with. Most stable is at uptime 27d on SmoothWAN v0.99.5HF5 / LuCI ce20b4a6e0c86313c0c6e9c89eedf8f033f5e637 branch git-23.124.59637-f3e3c08

@TalalMash
Copy link
Member Author

Speedify installer for OpenWrt: https://github.com/TalalMash/Unofficial-Speedify-Installer-For-OpenWrt
Not sure how it would behave with friendlyWrt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants