Difference between revisions of "Template:FriendlyWrt19"

From FriendlyELEC WiKi
Jump to: navigation, search
(Work with USB WiFi)
(updated by API)
 
(42 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Work with FriendlyWrt==
 
==Work with FriendlyWrt==
 
===Introduction to FriendlyWrt===
 
===Introduction to FriendlyWrt===
FriendlyWrt is a customized system made by FriendlyElec based on an OpenWrt distribution. It is open source and well suitable for developing IoT applications, NAS applications, smart home gateways etc.<br />
+
FriendlyWrt is a customized system made by FriendlyElec based on an OpenWrt distribution. It is open source and well suitable for developing IoT applications, NAS applications etc.<br />
 +
 
 +
===First boot===
 +
For the first boot, the system needs to do the following initialization work: <br />
 +
1)Extended root file system <br />
 +
2)Initial setup(will execute /root/setup.sh) <br />
 +
So you need to wait for a while (about 2~3 minutes) to boot up for the first time, and then set FriendlyWrt, you can enter the ttyd terminal on the openwrt webpage, when the prompt is displayed as root@FriendlyWrt, it means the system has been initialized.
 +
<syntaxhighlight lang="text">
 +
root@FriendlyWrt
 +
</syntaxhighlight>
  
 
===Account & Password===
 
===Account & Password===
By default the password is NULL. You can set a password for root for web and SSH login.
+
The default password is password (empty password in some versions). Please set or change a safer password for web login and ssh login. It is recommended to complete this setting before connecting {{{1}}} to the Internet.
  
 
===Network Connection===
 
===Network Connection===
Line 10: Line 19:
  
 
===Login FriendlyWrt===
 
===Login FriendlyWrt===
Type {{{1}}}'s IP address or http://friendlywrt/ in a browser's address bar and enter to open FriendlyWrt's administration page or you can login into FriendlyWrt's administration page via SSH. <br />
+
Connect the PC to the LAN port of {{{1}}}. If your PC without a built-in ethernet port, connect the LAN port of the wireless AP to the LAN port of {{{1}}}, and then connect your PC to the wireless AP via WiFi , Enter the following URL on your PC's browser to access the admin page: <br />
By default, the IP address of the LAN port is 192.168.2.1, and the WAN will dynamically obtain the IP address from your main router.
+
* http://friendlywrt/
 +
* http://192.168.2.1/
 +
* http://[fd00:ab:cd::1]
 +
The above is the LAN port address of {{{1}}}. The IP address of the WAN port will be dynamically obtained from your main router through DHCP.<br />
 +
 
 +
===Recommended security settings===
 +
The following settings are highly recommended to complete before connecting {{{1}}} to the Internet。
 +
* Set a secure password
 +
* Only allow access to ssh from lan, change the port
 +
===Safe shutdown operation===
 +
Enter the ttyd terminal, enter the poweroff command and hit enter, wait until the led light is off, and then unplug the power supply.
  
 
===Install Software Packages===
 
===Install Software Packages===
Line 39: Line 58:
 
$ opkg remove <package names>
 
$ opkg remove <package names>
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
===Disable IPv6===
 +
<syntaxhighlight lang="text">
 +
sed -i -e "s/DISABLE_IPV6=0/DISABLE_IPV6=1/g" /root/setup.sh
 +
rm -rf /etc/board.json /etc/config/system /etc/config/network /etc/config/wireless /etc/firstboot_* /root/.friendlyelec
 +
reboot
 +
</syntaxhighlight>
 +
 +
===Configure the function of the user button===
 +
By default, the user button is configured to reboot the device, as shown below:
 +
<syntaxhighlight lang="bash">
 +
echo 'BTN_1 1 /sbin/reboot' >> /etc/triggerhappy/triggers.d/example.conf
 +
</syntaxhighlight>
 +
You can change its behavior by changing the configuration file above.
 +
 +
===Some common issues of FriendlyWrt===
 +
* Unable to dial up
 +
** Go to "Network" -> "Firewall" and set "Inbound Data", "Outbound Data" and "Forwarding" in "WAN Zone" to "Accept";
 +
** If you still cannot access the Internet, you can try to turn off IPV6;
 +
* Unable to power on
 +
** Try to replace the power adapter and cable. It is recommended to use a power supply with specifications above 5V/2A;
 +
** Note that some fast chargers with Type-C interface will have a delay, it may take a few seconds to start providing power;
 +
* When doing secondary routing, the computer cannot connect to the Internet
 +
** If your main network is IPv4, and {{{1}}} works in IPv6, the computer may not be able to connect to the Internet. It is recommended to turn off IPv6 (the method is described later in this WiKi), or switch the main route to IPv6;
 +
* If you have questions or have better suggestions, please send an email to techsupport@friendlyarm.com;
 +
 +
===Let FriendlyWrt regenerate network settings===
 +
This method will trigger FriendlyWrt to re-identify the hardware model and generate the network configuration under /etc/config, which is similar but not completely equivalent to restoring factory settings:<br />
 +
<syntaxhighlight lang="text">
 +
rm -rf /etc/board.json /etc/config/system /etc/config/network /etc/config/wireless /etc/firstboot_* /root/.friendlyelec
 +
reboot
 +
</syntaxhighlight>
 +
The /root/setup.sh initialization script will be executed again at the next boot, so you can debug the /root/setup.sh script through this method.
 +
 +
===Use USB2LCD to view IP and temperature===
 +
Plug the USB2LCD module to the USB interface of{{{1}}} and power on, the IP address and CPU temperature will be displayed on the LCD:<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 +
[[File:R2S-usb2lcd-01.jpg|frameless|600px]]<br />
 +
| #default =
 +
}}
 +
 +
{{#switch: {{{1}}}
 +
| NanoPi-R4S =
 +
===How to Control Fan Speed for Cooling===
 +
(Note: The contents of this section are based on firmware released after 2021/08/31, kernel version kernel 5.10.xyz)
 +
* The default behavior of the current PWM fan is: after a short wait (about 20 seconds) for power on, the fan will first work automatically for about 5 seconds, after which the behavior is driven by the kernel, which decides the fan on/off and the speed according to the CPU temperature.<br />
 +
* The behavior of the fan can be changed by modifying the following script: /usr/bin/fa-fancontrol.sh. For example, to change the CPU temperature when the fan starts working, you can change the following two lines:<br />
 +
<syntaxhighlight lang="text">
 +
echo 50000 > trip_point_3_temp  # Indicates that the fan starts working at the lowest speed when the CPU temperature reaches 50 degrees
 +
echo 55000 > trip_point_4_temp  # Indicates that when the CPU temperature reaches 55 degrees, the fan rises to the second gear and above and automatically adjusts to the highest gear (4th gear) or reduces the speed according to the CPU cooling situation
 +
</syntaxhighlight>
 +
* If you need to adjust the speed of each gear, you can modify the kernel dts file and recompile the kernel to achieve the purpose, the specific dts and modified location can be referred to the following commit: https://github.com/friendlyarm/kernel-rockchip/commit/f74ac319f02e2d22cdd33227e7f167e4232809f9 <br />
 +
As shown below, the cooling-levels define 4 levels, with 0 being off and the highest level being 255:
 +
<syntaxhighlight lang="text">
 +
fan: pwm-fan {
 +
compatible = "pwm-fan";
 +
- /* FIXME: adjust leveles for the connected fan */
 +
- cooling-levels = <0 12 18 255>;
 +
+ cooling-levels = <0 18 102 170 255>;
 +
</syntaxhighlight>
 +
* If you are using kernel version 4.19.xyz, the fan is operated by PWM at the application level to achieve temperature control, the above content is not applicable, you need to modify this script:
 +
<syntaxhighlight lang="text">
 +
/usr/bin/fa-fancontrol-direct.sh
 +
</syntaxhighlight>
 +
| #default =
 +
}}
 +
  
 
===Work with USB WiFi Device===
 
===Work with USB WiFi Device===
 
====Check USB WiFi Device with Command Line Utility====
 
====Check USB WiFi Device with Command Line Utility====
(1) Click on "service>ttyd" to start the command line utility<br />
+
(1) Click on "services>ttyd" to start the command line utility<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2s-wrt-jellyfin-002.jpg|frameless|800px]]<br />
 
[[File:R2s-wrt-jellyfin-002.jpg|frameless|800px]]<br />
 
+
| #default =
(2) Make sure no USB devices are connected to the board and run the following command to check if any USB devices are connected or not<br />
+
}}
 +
(2) Make sure no USB devices are connected to your board and run the following command to check if any USB devices are connected or not<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
lsusb
 
lsusb
</syntaxhighlight><br />
+
</syntaxhighlight>
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-09.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-09.jpg|frameless|800px]]<br />
 +
| #default =
 +
}}
  
 
(3) Connect a USB WiFi device to the board and run the command again<br />
 
(3) Connect a USB WiFi device to the board and run the command again<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
lsusb
 
lsusb
</syntaxhighlight><br />
+
</syntaxhighlight>
 
You will see a new device is detected. In our test the device's ID was 0BDA:C811<br />
 
You will see a new device is detected. In our test the device's ID was 0BDA:C811<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-10.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-10.jpg|frameless|800px]]<br />
 +
| #default =
 +
}}
  
 
(4) Type your device's ID (in our case it was "0BDA:C811" or "VID_0BDA&PID_C811") in a search engine and you may find a device that matches the ID. In our case the device we got was Realtek 8811CU.
 
(4) Type your device's ID (in our case it was "0BDA:C811" or "VID_0BDA&PID_C811") in a search engine and you may find a device that matches the ID. In our case the device we got was Realtek 8811CU.
  
====如何使用USB WiFi作为AP====
+
====Configure a USB WiFi Device as AP====
(1) 把USB WiFi插入NanoPi R2S,推荐使用以下列表中支持AP模式的WiFi芯片模块(以下列表基于rk3328-sd-friendlywrt-5.4-20200514.img固件经测试可用)<br />
+
(1) Connect a USB WiFi device to the {{{1}}}. We recommend you to use the following devices:<br />
[[File:R2swrt+usbwifi-08.jpg|frameless|800px]]<br />
+
[[File:R2swrt+usbwifi-20210831.jpg|frameless|600px]]<br />
<span style="color: blue; ">注:符合以上WiFi芯片型号并符合以上VID&PID信息的USB无线网卡都可以使用,支持的型号不局限于某个品牌某个型号</span>
+
<span style="color: blue; ">Note: devices that match these VID&PIDs would most likely work.</span><br />
 
+
(2) Click on "System>Reboot" and reboot your {{{1}}}<br />
(2) 插入USB WiFi后,点击上方菜单栏的“系统>重启”,点击“执行重启”按钮重启NanoPi R2S<br />
+
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-01.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-01.jpg|frameless|800px]]<br />
 
<br />
 
<br />
 
[[File:R2swrt+usbwifi-02.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-02.jpg|frameless|800px]]<br />
 
+
| #default =
(3) 点击“网络>无线”进入配置无线WiFi界面<br />
+
}}
 +
(3) Click on "Network>Wireless" to enter the WiFi configuration page<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-03.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-03.jpg|frameless|800px]]<br />
 
+
| #default =
(4) 点击“编辑”按钮可编辑WiFi设置<br />
+
}}
 +
(4) Click on "Edit" to edit the configuration<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-04.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-04.jpg|frameless|800px]]<br />
 
+
| #default =
(5) 在“接口配置”中可设置WiFi 模式和SSID等,然后点击到“无线安全”项可修改加密方式和WiFi密码,默认密码为password,设置完成后点击“保存”<br />
+
}}
 +
(5) On the "Interface Configuration" page you can set the WiFi mode and SSID, and then go to "Wireless Security" to change the password. By default the password is "password". After you make your changes click on "Save" to save<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-05.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-05.jpg|frameless|800px]]<br />
 
<br />
 
<br />
 
[[File:R2swrt+usbwifi-06.jpg|frameless|800px]]<br />
 
[[File:R2swrt+usbwifi-06.jpg|frameless|800px]]<br />
 
+
| #default =
(4) 配置完成后使用手机端或电脑端搜索对应SSID的WiFi即可<br />
+
}}
 +
(6) After you change the settings you can use a smartphone or PC to search for WiFi<br />
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 
[[File:R2swrt+usbwifi-07.png|frameless|277px]]<br />
 
[[File:R2swrt+usbwifi-07.png|frameless|277px]]<br />
 +
| #default =
 +
}}
 +
 +
====Common USB WiFi issues====
 +
1) It is recommended to plug in the usb wifi in the off state, then power it on, FriendlyWrt will automatically generate the configuration file /etc/config/wireless, if not, see if there is wlan0 by ifconfig -a, if there is no wlan0, usually there is no driver. <br />
 +
2) If ifconfig -a sees wlan0, but the hotspot is not working properly, try changing the channel and country code, an inappropriate country code can also cause the WiFi to not work. <br />
 +
3) Some USB WiFis (e.g. MTK MT7662) work in CD-ROM mode by default and need to be switched by usb_modeswitch, you can try to add usb_modeswitch configuration to the following directory: /etc/usb_modeswitch.d.<br />
  
 
===Work with Docker Applications===
 
===Work with Docker Applications===
====Work with Docker: Install JellyBin====
+
====Work with Docker: Install JellyFin====
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
mkdir -p /jellyfin/config
 
mkdir -p /jellyfin/config
Line 101: Line 246:
 
After installtion, visit port 8888.
 
After installtion, visit port 8888.
  
 +
<!--
 
===Enable Swap Partition===
 
===Enable Swap Partition===
 
Run the following commands in a commandline utility and reboot:
 
Run the following commands in a commandline utility and reboot:
Line 107: Line 253:
 
reboot
 
reboot
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
-->
  
 
===Mount smbfs===
 
===Mount smbfs===
Line 113: Line 260:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
===Use sdk to compile the package ===
 +
====Install the compilation environment====
 +
Download and run the following script on 64-bit Ubuntu (version 18.04+):
 +
[https://github.com/friendlyarm/build-env-on-ubuntu-bionic How to setup the Compiling Environment on Ubuntu bionic]
  
 +
====Download and decompress sdk from the network disk====
 +
The sdk is located in the toolchain directory of the network disk:
 +
{{#switch: {{{1}}}
 +
| NanoPi-R2S
 +
| NanoPi-R2C-Plus
 +
| NanoPi-R2S-Plus
 +
| NanoPi-R2C =
 +
<syntaxhighlight lang="bash">
 +
tar xvf ~/dvd/RK3328/toolchain/friendlywrt/openwrt-sdk-19.07.5-rockchip-rk3328_gcc-7.5.0_musl.Linux-x86_64.tar.xz
 +
# If the path is too long, it will cause some package compilation errors, so change the directory name here
 +
mv openwrt-sdk-19.07.5-rockchip-rk3328_gcc-7.5.0_musl.Linux-x86_64 sdk
 +
cd sdk
 +
./scripts/feeds update -a
 +
./scripts/feeds install -a
 +
</syntaxhighlight>
 +
| #default =
 +
<syntaxhighlight lang="bash">
 +
tar xvf ~/dvd/FriendlyELEC-NanoPiR4S/toolchain/friendlywrt/openwrt-sdk-19.07.5-rockchip-rk3399_gcc-7.5.0_musl.Linux-x86_64.tar.xz
 +
# If the path is too long, it will cause some package compilation errors, so change the directory name here
 +
mv openwrt-sdk-19.07.5-rockchip-rk3399_gcc-7.5.0_musl.Linux-x86_64 sdk
 +
cd sdk
 +
./scripts/feeds update -a
 +
./scripts/feeds install -a
 +
</syntaxhighlight>
 +
}}
  
===Compile u-boot,kernel or friendlywrt===
+
====Compile the package====
* Refer to:
+
download the source code of the example (a total of 3 examples are example1, example2, example3), and copy to the package directory:
** [https://github.com/friendlyarm/sd-fuse_rk3328 sd-fuse_rk3328]
+
<syntaxhighlight lang="bash">
** [[How to Build FriendlyWrt]]
+
git clone https://github.com/mwarning/openwrt-examples.git
 +
cp -rf openwrt-examples/example* package/
 +
rm -rf openwrt-examples/
 +
</syntaxhighlight>
 +
Then enter the configuration menu through the following command:
 +
<syntaxhighlight lang="bash">
 +
make menuconfig
 +
</syntaxhighlight>
 +
In the menu, select the following packages we want to compile (actually selected by default):
 +
<syntaxhighlight lang="bash">
 +
"Utilities" => "example1"
 +
"Utilities" => "example3"
 +
"Network" => "VPN" => "example2"
 +
</syntaxhighlight>
 +
execute the following commands to compile the three software packages:
 +
<syntaxhighlight lang="bash">
 +
make package/example1/compile V=99
 +
make package/example2/compile V=99
 +
make package/example3/compile V=99
 +
</syntaxhighlight>
 +
After the compilation is successful, you can find the ipk file in the bin directory, as shown below:
 +
<syntaxhighlight lang="bash">
 +
$ find ./bin -name example*.ipk
 +
./bin/packages/aarch64_cortex-a53/base/example2_0.1-1_aarch64_cortex-a53.ipk
 +
./bin/packages/aarch64_cortex-a53/base/example3_0.1-1_aarch64_cortex-a53.ipk
 +
./bin/packages/aarch64_cortex-a53/base/example1_0.1-1_aarch64_cortex-a53.ipk
 +
</syntaxhighlight>
 +
==== Install the ipk to NanoPi ====
 +
You can use the scp command to upload the ipk file to NanoPi:
 +
<syntaxhighlight lang="bash">
 +
cd ./bin/packages/aarch64_cortex-a53/base/
 +
scp example*.ipk root@192.168.2.1:/root/
 +
</syntaxhighlight>
 +
Then use the opkg command to install them:
 +
<syntaxhighlight lang="bash">
 +
cd /root/
 +
opkg install example2_0.1-1_aarch64_cortex-a53.ipk
 +
opkg install example3_0.1-1_aarch64_cortex-a53.ipk
 +
opkg install example1_0.1-1_aarch64_cortex-a53.ipk
 +
</syntaxhighlight>

Latest revision as of 10:53, 4 December 2023

1 Work with FriendlyWrt

1.1 Introduction to FriendlyWrt

FriendlyWrt is a customized system made by FriendlyElec based on an OpenWrt distribution. It is open source and well suitable for developing IoT applications, NAS applications etc.

1.2 First boot

For the first boot, the system needs to do the following initialization work:
1)Extended root file system
2)Initial setup(will execute /root/setup.sh)
So you need to wait for a while (about 2~3 minutes) to boot up for the first time, and then set FriendlyWrt, you can enter the ttyd terminal on the openwrt webpage, when the prompt is displayed as root@FriendlyWrt, it means the system has been initialized.

root@FriendlyWrt

1.3 Account & Password

The default password is password (empty password in some versions). Please set or change a safer password for web login and ssh login. It is recommended to complete this setting before connecting {{{1}}} to the Internet.

1.4 Network Connection

Use a network cable to connect {{{1}}}'s WAN to a master router and the board will get an IP address via DHCP. Login into the router and check {{{1}}}'s IP address.

1.5 Login FriendlyWrt

Connect the PC to the LAN port of {{{1}}}. If your PC without a built-in ethernet port, connect the LAN port of the wireless AP to the LAN port of {{{1}}}, and then connect your PC to the wireless AP via WiFi , Enter the following URL on your PC's browser to access the admin page:

The above is the LAN port address of {{{1}}}. The IP address of the WAN port will be dynamically obtained from your main router through DHCP.

1.6 Recommended security settings

The following settings are highly recommended to complete before connecting {{{1}}} to the Internet。

  • Set a secure password
  • Only allow access to ssh from lan, change the port

1.7 Safe shutdown operation

Enter the ttyd terminal, enter the poweroff command and hit enter, wait until the led light is off, and then unplug the power supply.

1.8 Install Software Packages

1.8.1 Update Package List

Before install software packages update the package list:

$ opkg update

1.8.2 List Available Packages

$ opkg list

1.8.3 List Installed Packages

$ opkg list-installed

1.8.4 Install Packages

$ opkg install <package names>

1.8.5 Remove Packages

$ opkg remove <package names>

1.9 Disable IPv6

sed -i -e "s/DISABLE_IPV6=0/DISABLE_IPV6=1/g" /root/setup.sh
rm -rf /etc/board.json /etc/config/system /etc/config/network /etc/config/wireless /etc/firstboot_* /root/.friendlyelec
reboot

1.10 Configure the function of the user button

By default, the user button is configured to reboot the device, as shown below:

echo 'BTN_1 1 /sbin/reboot' >> /etc/triggerhappy/triggers.d/example.conf

You can change its behavior by changing the configuration file above.

1.11 Some common issues of FriendlyWrt

  • Unable to dial up
    • Go to "Network" -> "Firewall" and set "Inbound Data", "Outbound Data" and "Forwarding" in "WAN Zone" to "Accept";
    • If you still cannot access the Internet, you can try to turn off IPV6;
  • Unable to power on
    • Try to replace the power adapter and cable. It is recommended to use a power supply with specifications above 5V/2A;
    • Note that some fast chargers with Type-C interface will have a delay, it may take a few seconds to start providing power;
  • When doing secondary routing, the computer cannot connect to the Internet
    • If your main network is IPv4, and {{{1}}} works in IPv6, the computer may not be able to connect to the Internet. It is recommended to turn off IPv6 (the method is described later in this WiKi), or switch the main route to IPv6;
  • If you have questions or have better suggestions, please send an email to techsupport@friendlyarm.com;

1.12 Let FriendlyWrt regenerate network settings

This method will trigger FriendlyWrt to re-identify the hardware model and generate the network configuration under /etc/config, which is similar but not completely equivalent to restoring factory settings:

rm -rf /etc/board.json /etc/config/system /etc/config/network /etc/config/wireless /etc/firstboot_* /root/.friendlyelec
reboot

The /root/setup.sh initialization script will be executed again at the next boot, so you can debug the /root/setup.sh script through this method.

1.13 Use USB2LCD to view IP and temperature

Plug the USB2LCD module to the USB interface of{{{1}}} and power on, the IP address and CPU temperature will be displayed on the LCD:



1.14 Work with USB WiFi Device

1.14.1 Check USB WiFi Device with Command Line Utility

(1) Click on "services>ttyd" to start the command line utility

(2) Make sure no USB devices are connected to your board and run the following command to check if any USB devices are connected or not

lsusb


(3) Connect a USB WiFi device to the board and run the command again

lsusb

You will see a new device is detected. In our test the device's ID was 0BDA:C811


(4) Type your device's ID (in our case it was "0BDA:C811" or "VID_0BDA&PID_C811") in a search engine and you may find a device that matches the ID. In our case the device we got was Realtek 8811CU.

1.14.2 Configure a USB WiFi Device as AP

(1) Connect a USB WiFi device to the {{{1}}}. We recommend you to use the following devices:
R2swrt+usbwifi-20210831.jpg
Note: devices that match these VID&PIDs would most likely work.
(2) Click on "System>Reboot" and reboot your {{{1}}}

(3) Click on "Network>Wireless" to enter the WiFi configuration page

(4) Click on "Edit" to edit the configuration

(5) On the "Interface Configuration" page you can set the WiFi mode and SSID, and then go to "Wireless Security" to change the password. By default the password is "password". After you make your changes click on "Save" to save

(6) After you change the settings you can use a smartphone or PC to search for WiFi


1.14.3 Common USB WiFi issues

1) It is recommended to plug in the usb wifi in the off state, then power it on, FriendlyWrt will automatically generate the configuration file /etc/config/wireless, if not, see if there is wlan0 by ifconfig -a, if there is no wlan0, usually there is no driver.
2) If ifconfig -a sees wlan0, but the hotspot is not working properly, try changing the channel and country code, an inappropriate country code can also cause the WiFi to not work.
3) Some USB WiFis (e.g. MTK MT7662) work in CD-ROM mode by default and need to be switched by usb_modeswitch, you can try to add usb_modeswitch configuration to the following directory: /etc/usb_modeswitch.d.

1.15 Work with Docker Applications

1.15.1 Work with Docker: Install JellyFin

mkdir -p /jellyfin/config
mkdir -p /jellyfin/videos
docker run --restart=always -d -p 8096:8096 -v /jellyfin/config:/config -v /jellyfin/videos:/videos jellyfin/jellyfin:10.1.0-arm64 -name myjellyfin

After installation, visit port 8096 and here is what you would find:
FriendlyWrt+JerryFin

1.15.2 Work with Docker: Install Personal Nextcloud

mkdir /nextcloud -p
docker run -d -p 8888:80  --name nextcloud  -v /nextcloud/:/var/www/html/ --restart=always --privileged=true  arm64v8/nextcloud

After installtion, visit port 8888.


1.16 Mount smbfs

mount -t cifs //192.168.1.10/shared /movie -o username=xxx,password=yyy,file_mode=0644

1.17 Use sdk to compile the package

1.17.1 Install the compilation environment

Download and run the following script on 64-bit Ubuntu (version 18.04+): How to setup the Compiling Environment on Ubuntu bionic

1.17.2 Download and decompress sdk from the network disk

The sdk is located in the toolchain directory of the network disk:

tar xvf ~/dvd/FriendlyELEC-NanoPiR4S/toolchain/friendlywrt/openwrt-sdk-19.07.5-rockchip-rk3399_gcc-7.5.0_musl.Linux-x86_64.tar.xz
# If the path is too long, it will cause some package compilation errors, so change the directory name here
mv openwrt-sdk-19.07.5-rockchip-rk3399_gcc-7.5.0_musl.Linux-x86_64 sdk
cd sdk
./scripts/feeds update -a
./scripts/feeds install -a

1.17.3 Compile the package

download the source code of the example (a total of 3 examples are example1, example2, example3), and copy to the package directory:

git clone https://github.com/mwarning/openwrt-examples.git
cp -rf openwrt-examples/example* package/
rm -rf openwrt-examples/

Then enter the configuration menu through the following command:

make menuconfig

In the menu, select the following packages we want to compile (actually selected by default):

"Utilities" => "example1"
"Utilities" => "example3"
"Network" => "VPN" => "example2"

execute the following commands to compile the three software packages:

make package/example1/compile V=99
make package/example2/compile V=99
make package/example3/compile V=99

After the compilation is successful, you can find the ipk file in the bin directory, as shown below:

$ find ./bin -name example*.ipk
./bin/packages/aarch64_cortex-a53/base/example2_0.1-1_aarch64_cortex-a53.ipk
./bin/packages/aarch64_cortex-a53/base/example3_0.1-1_aarch64_cortex-a53.ipk
./bin/packages/aarch64_cortex-a53/base/example1_0.1-1_aarch64_cortex-a53.ipk

1.17.4 Install the ipk to NanoPi

You can use the scp command to upload the ipk file to NanoPi:

cd ./bin/packages/aarch64_cortex-a53/base/
scp example*.ipk root@192.168.2.1:/root/

Then use the opkg command to install them:

cd /root/
opkg install example2_0.1-1_aarch64_cortex-a53.ipk
opkg install example3_0.1-1_aarch64_cortex-a53.ipk
opkg install example1_0.1-1_aarch64_cortex-a53.ipk