Difference between revisions of "RockpiE/OpenWRT"
(Created page with " = Working with ROCK Pi E OpenWrt = == Introduction to ROCK Pi E OpenWrt == The OpenWrt Project is a Linux operating system targeting embedded devices. It is primarily used...") |
(No difference)
|
Revision as of 02:44, 5 July 2020
Contents
Working with ROCK Pi E OpenWrt
Introduction to ROCK Pi E OpenWrt
The OpenWrt Project is a Linux operating system targeting embedded devices. It is primarily used on embedded devices to route network traffic. OpenWrt provides a fully writable filesystem with package management.
OpenWrt Default User Account
Root User:
User Name: root Password: NULL(empty)
Install and update necessary packages
Install packages;
# opkg update # opkg install htop
List Install packages;
# opkg list-installed # opkg list-installed | grep "htop"
Network Connection
There are two methods for network connection. One is Ethernet and the other is WIFI.
Ethernet Connection
ROCK Pi E provides dual ethernets. This makes it perfect as a router.
- eth1(1000M) -> LAN
- eth0(100M) -> WAN
You will need two network cables at the same time to connect your ROCK Pi E to the network and the LAN client to access it. The ROCK Pi E will automatically configure the network for the LAN clients.
To test the Ethernet, we need to follow the steps:
- Plug in WAN ethernet to eth0 (100M) port
- Plug in LAN ethernet to eth1 (1000M port)
After connection is established, the LAN client should get an IP in the network 192.168.1.0/24.
Use any SSH client to ssh into the ROCK Pi E.
ssh root@192.168.1.1
Check whether the internet connection is functioning by command, ifconfig, which would show us three interfaces, br-lan, eth0 and eth1, and the Ethernet IP address. Also, use tool, ping, to connect to a normal domain.
# ifconfig # ping www.baidu.com
Wireless Connection
Configure Wireless using OpenWrt Web-interface.
VLAN
OpenWrt supports 802.1Q VLAN.
Usage Example:
- For tagged traffic on VLAN100 on eth0 interface, use eth0.100
- For untagged traffic, use eth0
Web Interface
OpenWrt provides an web-interface for the easy of configuration.
Follow these steps to open the web-interface:
- Connect client to LAN port
- Open 192.168.1.1 with any browser
- Login with the root password (default: empty)
Wireless Access-Point in web-interface
1. Connect to the web-interface at http://192.168.1.1, and login with your “root” password
2. Go to Network → Wireless. This page lists a separate Wi-Fi configuration section for each of your physical radios, (many devices you may have, will have one radio for 2.4 GHz and a second one for 5 GHz).
3. For each of your radios, you can create a Wi-Fi network by clicking Add:
3.1. On the first Wi-Fi network that you configure, go to the Device Configuration and open the tab Advanced Settings: in the Country Code field, select the correct county code, where your OpenWrt device is installed. This is important to ensure your OpenWrt device meets the legal regulations in your country. (all other configured radios will use the same device settings)
3.2. For each Wi-Fi network, in the “Interface Configuration” section, configure your Wi-Fi settings:
- In the tab General Setup, enter an ESSID to become the name of your Wi-Fi network
- In the tab Wireless Security, select an Encryption method (e.g. “WPA2-PSK”, recommended for home/small office networks)
- In the tab Wireless Security, select a Cipher (e.g. “auto” is recommended)
- In the tab Wireless Security, enter a Key, a secret phrase which clients must use to connect to your Wi-Fi network. NB: With WPA2-PSK, the Key must be at least eight (8) characters.
- If needed, configure further settings according to your needs. Other default settings ordinarily correct for general usage.
4. Click Save & Apply when done.
Common Hardware Interfaces, I2C, SPI, UART, etc
I2C
To enable I2C, follow the following steps:
1. Compile OpenWrt with i2c support
2. Access OpenWrt console via SSH
ssh root@192.168.1.1
3. Execute
i2cdetect 0
4. Check I2C address
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0. I will probe address range 0x03-0x77. Continue? Y/n 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: XX XX XX XX XX XX XX XX XX XX XX XX XX 10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 40: XX XX XX XX XX XX XX XX 48 XX XX XX XX XX XX XX 50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 70: XX XX XX XX XX XX XX XX
UART
The debugger console baud rate options: 1500000n8.
Compiling from sources
Compiling OpenWrt for ROCK Pi E
1. git clone --depth 1 https://github.com/jayanta525/rock-pi-e.git openwrt/ 2. cd openwrt/ 3. ./scripts/feeds update -a 4. ./scripts/feeds install -a 5. make menuconfig #select device and required packages here 6. make -j$(nproc)
Target System > Rockchip Subtarget > RK33xx boards (64 bit) Target Profile > Radxa Rock Pi E
For installing web-interface in openwrt during compilation, select the packages in menuconfig
LuCi > Collection > luci
For using i2c in openwrt during compilation, select the packages in menuconfig
Kernel Modules > kmod-i2c-core Kernel Modules > kmod-i2c-gpio Kernel Modules > kmod-i2c-gpio-custom Utilities > i2c-tools
For installing python in openwrt during compilation, select the packages in menuconfig
Languages > Python > python Languages > Python > python-dev