Template:OpenWrt1

From FriendlyELEC WiKi
Revision as of 14:27, 5 May 2019 by Yftan (Talk | contribs) (Check Network->Interfaces Configurations)

Jump to: navigation, search

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

When you do kernel development you'd better connect your board to a serial communication board and do your development in a command-line utility.
It is better to do development with a serial communication board. Here is a hardware setup:
After you connect your board to a serial communication board you can power on your board from either the board's MicroUSB port(if there is one) or the DC port on the serial communication board

You can use a USB to serial board to debug. Attention: you need to plug a 5V/2A power to the board's MicroUSB port.

By default you will automatically login as root without a password. You can set the "root" user's password by using the passwd command.
op_login
When your system boots for the first time it will automatically extend the TF card's file system to its max capacity:
resize_rootfs_userdata
Please wait patiently for the process to be completed.

  • Login via SSH


  • Login via Web

OpenWrt supports system login and setup via the LuCI Web page.

By default the user is root without a password. You can click on the "Login" button 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
$ 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. Each core's frequency is adjusted on demand and the current working frequency is 624 MHz. You can reset 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

After you open the OpenWrt-LuCI page go to "Statistics ---> Graphs" and you will see various system statistics such as:
1) System Load:
statistics_system_load
2) RAM:
statistics_memory
3) CPU Temperature:
statistics_thermal
All the statistics listed on the Statistics page are provided by the luci-app-statistics package which uses the Collectd utility to collect data and present them with the RRDtool utility.
If you want to check 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

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