Difference between revisions of "Template:OpenWrt1"

From FriendlyELEC WiKi
Jump to: navigation, search
(System Login)
(updated by API)
 
(8 intermediate revisions by 4 users not shown)
Line 44: Line 44:
 
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:<br />
 
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:<br />
 
[[File:PSU-ONECOM-R1.jpg|frameless|500px]]<br>
 
[[File:PSU-ONECOM-R1.jpg|frameless|500px]]<br>
 +
| NanoPi-R1S-H3 =
 +
Here is a hardware setup:<br>
 +
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:<br />
 +
[[File:PSU-ONECOM-R1S.jpg|frameless|500px]]<br>
 +
| NanoPi-R1S-H5 =
 +
Here is a hardware setup:<br>
 +
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:<br />
 +
[[File:PSU-ONECOM-R1S.jpg|frameless|500px]]<br>
 +
| NanoPi-NEO2-Black =
 +
Here is a hardware setup:<br>
 +
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:<br />
 +
[[File:PSU-ONECOM-NEO2-Black.jpg|frameless|500px]]<br>
 
  | NanoPi-Duo =
 
  | NanoPi-Duo =
 
  | NanoPi-Duo2 =
 
  | NanoPi-Duo2 =
Line 55: Line 67:
 
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:T4usb2serialport.jpg|frameless|500px]]<br>
 
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:T4usb2serialport.jpg|frameless|500px]]<br>
 
  | NanoPi-M4 =
 
  | NanoPi-M4 =
 +
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:m4usb2serialport.jpg|frameless|500px]]<br>
 +
| NanoPi-M4V2 =
 +
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:m4usb2serialport.jpg|frameless|500px]]<br>
 +
| NanoPi-M4B =
 
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:m4usb2serialport.jpg|frameless|500px]]<br>
 
{{{1}}}you need to use a USB to serial board and here is a hardware setup:<br>[[File:m4usb2serialport.jpg|frameless|500px]]<br>
 
  | NanoPi-NEO4 =  
 
  | NanoPi-NEO4 =  
Line 88: Line 104:
 
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power:<br>
 
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power:<br>
 
[[File:Matrix-USB2UART_nanopi_R1.jpg|frameless|500px]]<br>
 
[[File:Matrix-USB2UART_nanopi_R1.jpg|frameless|500px]]<br>
 +
| NanoPi-R1S-H3 =
 +
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power:<br>
 +
[[File:Matrix-USB2UART_nanopi_R1S-H3.jpg|frameless|500px]]<br>
 +
| NanoPi-R1S-H5 =
 +
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power:<br>
 +
[[File:Matrix-USB2UART_nanopi_R1S-H3.jpg|frameless|500px]]<br>
 +
| NanoPi-NEO2-Black =
 +
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power:<br>
 +
[[File:Matrix-USB2UART_nanopi_NEO2-Black.jpg|frameless|500px]]<br>
 
  | #default =
 
  | #default =
 
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power.
 
or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power.
Line 101: Line 126:
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
 
  | NanoPi-R1
 
  | NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1
 
  | NanoPi-M1
Line 108: Line 135:
 
  | NanoPi-NEO-Core2
 
  | NanoPi-NEO-Core2
 
  | NanoPi-NEO-Plus2
 
  | NanoPi-NEO-Plus2
  | NanoPi-NEO2 =
+
  | NanoPi-NEO2
 +
| NanoPi-NEO2-Black =
 
In FriendlyElec's OpenWrt system the Ethernet(eth0) is configured as WAN.<br>
 
In FriendlyElec's OpenWrt system the Ethernet(eth0) is configured as WAN.<br>
 
Before power on your board make sure your board is connected to a master router's LAN with an Ethernet cable and the eth0 will be assigned an IP address by DHCP.<br>
 
Before power on your board make sure your board is connected to a master router's LAN with an Ethernet cable and the eth0 will be assigned an IP address by DHCP.<br>
Line 130: Line 158:
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
 
  | NanoPi-R1
 
  | NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1
 
  | NanoPi-M1
Line 137: Line 167:
 
  | NanoPi-NEO-Core2
 
  | NanoPi-NEO-Core2
 
  | NanoPi-NEO-Plus2
 
  | NanoPi-NEO-Plus2
  | NanoPi-NEO2 =
+
  | NanoPi-NEO2
 +
| NanoPi-NEO2-Black =
 
After you go through all the steps in <Login via SSH> and get an IP address e.g. 192.168.1.163 for the Ethernet connection, type this IP address in a browser's address bar and you will be able to login OpenWrt-LuCI:<br>
 
After you go through all the steps in <Login via SSH> and get an IP address e.g. 192.168.1.163 for the Ethernet connection, type this IP address in a browser's address bar and you will be able to login OpenWrt-LuCI:<br>
 
[[File:R1-OpenWrt-LuCI.jpg|frameless|600px|R1-OpenWrt-LuCI]]<br>
 
[[File:R1-OpenWrt-LuCI.jpg|frameless|600px|R1-OpenWrt-LuCI]]<br>
Line 268: Line 299:
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
 
  | NanoPi-R1
 
  | NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1-Plus
 
  | NanoPi-NEO-Plus2
 
  | NanoPi-NEO-Plus2
Line 278: Line 311:
 
  | NanoPi-NEO-Core
 
  | NanoPi-NEO-Core
 
  | NanoPi-NEO-Core2
 
  | NanoPi-NEO-Core2
  | NanoPi-NEO2 =
+
  | NanoPi-NEO2
 +
| NanoPi-NEO2-Black =
 
  [[File:op_interface_eth0.png|frameless|600px|op_interface_eth0]] <br>
 
  [[File:op_interface_eth0.png|frameless|600px|op_interface_eth0]] <br>
 
  | NanoPi-NEO-Air =
 
  | NanoPi-NEO-Air =
Line 287: Line 321:
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
 
  | NanoPi-R1
 
  | NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 
  | NanoPi-M1-Plus
 
  | NanoPi-M1-Plus
 
  | NanoPi-NEO-Plus2
 
  | NanoPi-NEO-Plus2
Line 300: Line 336:
  
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
  | NanoPi-R1 =
+
  | NanoPi-R1  
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5 =
 
===Check LED Configurations===
 
===Check LED Configurations===
 
* After open the OpenWrt-LuCI page, go to System ---> LED Configuration and you will see the LED's configurations: <br>
 
* After open the OpenWrt-LuCI page, go to System ---> LED Configuration and you will see the LED's configurations: <br>
Line 313: Line 351:
  
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
  | NanoPi-R1 =
+
  | NanoPi-R1  
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5 =
 
===Check BUTTON Configurations===
 
===Check BUTTON Configurations===
 
FriendlyElec's OpenWrt system uses the triggerhappy utility to configure BUTTON's functions. By default when BUTTON is pressed a reboot will be triggered.
 
FriendlyElec's OpenWrt system uses the triggerhappy utility to configure BUTTON's functions. By default when BUTTON is pressed a reboot will be triggered.
Line 322: Line 362:
 
** [https://openwrt.org/docs/guide-user/hardware/hardware.button openwrt hardware.button]
 
** [https://openwrt.org/docs/guide-user/hardware/hardware.button openwrt hardware.button]
 
}}
 
}}
 +
 +
===USB WiFi===
 +
Currently the NanoPi NEO2 Black only works with a RTL8821CU USB WiFi dongle, plug and play. After this module is connected to the board it will by default work under AP mode and the hotspot's name is "rtl8821cu-mac address" and the password is "password";
 +
 +
===Huawei's WiFi 2 mini(E8372H-155) Module===
 +
After this module is connected to the board it will be plug and play. The hotspot's name is "HUAWEI-8DA5". You can connect a device to the internet by connecting to this hotspot.

Latest revision as of 06:35, 27 November 2019

1 Work with OpenWrt

1.1 Introduction

OpenWrt is a highly extensible GNU/Linux distribution for embedded devices.Unlike many other distributions for routers, OpenWrt is built from the ground up to be a full-featured, easily modifiable operating system for embedded devices. In practice, this means that you can have all the features you need with none of the bloat, powered by a modern Linux kernel. For more details you can refer to:OpenWrt Website.

1.2 System Login

  • Login via Serial Port

When you do kernel development you'd better get a serial communication board. After you connect your board to a serial communication board you will be able to do development work from a commandline utility.
Here is a hardware setup:
After you connect your board to a serial communication board (e.g. FriendlyElec's serial communication board) you can power the whole system from either the DC port on the serial communication board or the MicroUSB port(if there is one) on your board:

or you can use a USB to serial board and power on the whole system at the MicroUSB port with a 5V/2A power.

By default you will login as root without a password. You can use "passwd" to set a password for root.
op_login
On first boot the system will automatically extend the file system on the TF card to the max capacity:
resize_rootfs_userdata
Please wait for this to be done.

  • Login via SSH


  • Login via Web

You can login OpenWrt via a LuCI Web page.

By default you will login as root without a password, just click on "Login" to login.

1.3 Manage Software Packages

OpenWrt has a package management utility: opkg. You can get its details by running the following command:

$ opkg
Package Manipulation:
        update                  Update list of available packages
        upgrade <pkgs>          Upgrade packages
        install <pkgs>          Install package(s)
        configure <pkgs>        Configure unpacked package(s)
        remove <pkgs|regexp>    Remove package(s)
        flag <flag> <pkgs>      Flag package(s)
         <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)
 
Informational Commands:
        list                    List available packages
        list-installed          List installed packages
        list-upgradable         List installed and upgradable packages
        list-changed-conffiles  List user modified configuration files
        files <pkg>             List files belonging to <pkg>
        search <file|regexp>    List package providing <file>
        find <regexp>           List packages whose name or description matches <regexp>
        info [pkg|regexp]       Display all info for <pkg>
        status [pkg|regexp]     Display all status for <pkg>
        download <pkg>          Download <pkg> to current directory
...

These are just part of the manual. Here are some popular opkg commands.

  • Update Package List

Before you install a package you'd better update the package list:

$ opkg update
  • Check Available Packages
$ opkg list

At the time of writing there are 3241 packages available.

  • Check Installed Packages:
$ opkg list-installed

At the time of writing 124 packages have been installed.

  • Install/Delete Packages:
$ opkg install <pkgs>
$ opkg remove <pkgs>
  • Check Files Contained in Installed Packages:
$ opkg files <pkg>
  • Install Chinese Language Package for LuCI
$ opkg install luci-i18n-base-zh-cn
  • Check Changed Files:
$ opkg list-changed-conffiles

1.4 Check System Status

  • Check CPU Temperature & Frequency via Commandline
$ cpu_freq 
Aavailable frequency(KHz):
        480000 624000 816000 1008000
Current frequency(KHz):
        CPU0 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU1 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU2 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU3 online=1 temp=26548C governor=ondemand freq=624000KHz

These messages mean that there are four CPU cores working online simultaneously. Each core's temperature is 26.5 degrees in Celsius, the scheduling policy is on-demand and the working frequency is 624MHz. You can set the frequency by running the following command:

$ cpu_freq -s 1008000
Aavailable frequency(KHz):
        480000 624000 816000 1008000
Current frequency(KHz):
        CPU0 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU1 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU2 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU3 online=1 temp=36702C governor=userspace freq=1008000KHz

These messages mean four CPU cores are working online. Each core's temperature is 26.5 degrees. Each core's governor is on demand and the frequency is 480 MHz.

  • Check System Status on OpenWrt-LuCI Web Page

After open the OpenWrt-LuCI page, go to "Statistics ---> Graphs" and you will see various system statistics e.g.:
1) System Load:
statistics_system_load
2) RAM:
statistics_memory
3) CPU Temperature:
statistics_thermal
All the statistics listed on the Statistics page are presented by the luci-app-statistics package which uses the Collectd utility to collect data and presents them with the RRDtool utility.
If you want to get more statistics you can install other collectd-mod-* packages. All collectd-mod-* packages use the same configuration file: /etc/config/luci_statistics.

1.5 Check Network->Interfaces Configurations

  • After open the OpenWrt-LuCI page, go to "Network" ---> "Interfaces" and you will see the current network's configurations:
  • All the configurations listed on the Network->Interfaces page are stored in the "/etc/config/network" file.




1.6 USB WiFi

Currently the NanoPi NEO2 Black only works with a RTL8821CU USB WiFi dongle, plug and play. After this module is connected to the board it will by default work under AP mode and the hotspot's name is "rtl8821cu-mac address" and the password is "password";

1.7 Huawei's WiFi 2 mini(E8372H-155) Module

After this module is connected to the board it will be plug and play. The hotspot's name is "HUAWEI-8DA5". You can connect a device to the internet by connecting to this hotspot.