OpenWrt
View Chinese description | 查看ä¸æ–‡è¯´æ˜Ž
OpenWrt is a Linux-based router operating system designed for embedded devices. Unlike a single, unmodifiable firmware, OpenWrt provides a fully writable file system with package management capabilities, allowing users to freely choose the software packages they need to customize their router system. For developers, OpenWrt is a framework that allows them to develop applications without having to build a complete firmware around it. For regular users, this means having the ability to fully customize and use the device in unexpected ways. It offers over 3000 standardized application software packages and extensive third-party plugin support, making it easy to apply them to various supported devices. Now you can replace the Android TV system on your TV box with OpenWrt, turning it into a powerful router.
This project relies on many contributors to build OpenWrt systems for Amlogic
, Rockchip
, and Allwinner
boxes. It supports writing to eMMC, updating the kernel, and other functions. For detailed instructions on how to use it, please refer to the OpenWrt Documentation. The latest firmware can be downloaded from Releases. You are welcome to Fork
and customize the software package according to your needs. If it is useful to you, please click Star
in the upper right corner of the repository to show your support.
OpenWrt System Description
TF/SD/USB
, while other models of boxes can support writing to EMMC
. For more information, please refer to the Supported Device List Description. You can refer to Chapter 12.15 of the documentation for the method on Adding New Supported Devices.
Installation and Upgrade Instructions
Select the OpenWrt image that corresponds to your TV box model and refer to the corresponding instructions for usage of different devices.
-
Install OpenWrt
-
For installation instructions on the
Rockchip
platform, please refer to Chapter 8 in the Documentation. The installation process is the same as that for Armbian. -
For the
Amlogic
andAllwinner
platforms, use tools such as Rufus or balenaEtcher to write the firmware into a USB drive, then insert the USB into the device. Access OpenWrt's default IP address from your browser: 192.168.1.1 →log in to OpenWrt using the default credentials
→System Menu
→Amlogic Service
→Install OpenWrt
. Select your device from the list of supported devices, and click theInstall OpenWrt
button to start the installation process.
-
Update OpenWrt
Access OpenWrt's IP address from your browser, such as 192.168.1.1 → Log in to OpenWrt using the account
→ System Menu
→ Amlogic Service
→ Manually Upload Update / Download Update Online
. From there, you can choose to manually upload an update or download an update online.
If you choose to Manually Upload Update
, you can upload the compiled OpenWrt firmware package, such as openwrt_xxx_k5.15.50.img.gz (it is recommended to upload the compressed package, as the system will automatically decompress it). If you upload a xxx.img format file that has been decompressed, the upload may fail due to its large size. Once the upload is complete, the interface will display an Update Firmware
button. Click this button to update the firmware.
If you choose to Manually Upload Update
, you can upload the 3 kernel files boot-xxx.tar.gz
, dtb-xxx.tar.gz
, and modules-xxx.tar.gz
(other kernel files are not required, but uploading them will not affect the update, as the system can accurately identify the necessary kernel files). Once the upload is complete, the interface will display an Update Kernel
button. Click this button to update the kernel.
If you choose to Download Update Online
for OpenWrt firmware or kernel, it will be downloaded based on the Firmware Download Address
and Kernel Download Address
settings in the plugin. You can customize and modify the download source. For detailed instructions on how to do this, please refer to the compilation and usage instructions of luci-app-amlogic.
-
Creating swap for OpenWrt
If you are using memory-intensive applications such as docker
and find that the current box doesn't have enough memory, you can create a swap
virtual memory partition that virtualizes a certain capacity of /mnt/*4
disk space to use as memory. The unit used in the following command input parameters is GB
, and the default is 1
.
Access OpenWrt's default IP 192.168.1.1 from your browser → Log in to OpenWrt using the default account
→ System Menu
→ TTYD Terminal
→ Enter the following command:
openwrt-swap 1
-
Backing up/Restoring eMMC Original System
Support for backing up/restoring eMMC partitions using TF/SD/USB
. Before installing OpenWrt on your box, it is recommended to backup the pre-installed Android TV system in case you need to restore it later.
Boot the OpenWrt system from TF/SD/USB
, access OpenWrt's default IP 192.168.1.1 from your browser → Log in to OpenWrt using the default account
→ System Menu
→ TTYD Terminal
→ Enter the following command:
openwrt-ddbr
Follow the prompt to enter b
to backup the system or r
to restore the system.
-
Controlling the LED display
Access OpenWrt's default IP 192.168.1.1 from your browser → Log in to OpenWrt using the default account
→ System Menu
→ TTYD Terminal
→ Enter the following command:
openwrt-openvfd
Follow the LED Screen Display Control Instructions for debugging.
-
More usage instructions
Using the firstboot
command allows you to restore the system to its initial state. For common issues that may be encountered when using OpenWrt, please refer to the documentation.
Local build instructions
- Installing necessary build dependencies (for Ubuntu 22.04 LTS users)
sudo apt-get update -y
sudo apt-get full-upgrade -y
# For Ubuntu-22.04
sudo apt-get install -y $(curl -fsSL https://is.gd/depend_ubuntu2204_openwrt)
- Clone the repository to your local machine using
git clone --depth 1 https://github.com/ophub/amlogic-s9xxx-openwrt.git
. - Create a
openwrt-armvirt
folder in the root directory of~/amlogic-s9xxx-openwrt
and upload theopenwrt-armvirt-64-default-rootfs.tar.gz
file to this directory. - In the root directory of
~/amlogic-s9xxx-openwrt
, enter the packaging command, such assudo ./make -b s905x3 -k 6.1.10
. The OpenWrt firmware generated by the packaging process will be placed in theout
folder in the root directory.
-
Local packaging parameters
Parameter | Meaning | Description |
---|---|---|
-b | Board | Specify the TV box model using -b , such as -b s905x3 . Multiple models can be specified using _ , such as -b s905x3_s905d . Use all to indicate all models. Model codes can be found in the BOARD setting of model_database.conf. The default value is all . |
-r | KernelRepo | Specify the <owner>/<repo> of the kernel repository on github.com. The default value is ophub/kernel . |
-u | kernelUsage | Set the tags suffix of the kernel to be used, such as stable, flippy, dev. The default value is stable . |
-k | Kernel | Specify the kernel name, such as -k 5.10.125 . Multiple kernels can be specified using _ , such as -k 5.10.125_5.15.50 . The kernel version specified by the -k parameter is only valid for the stable/flippy/dev kernel series. Other kernel series such as rk3588 can only use specific kernels. |
-a | AutoKernel | Set whether to automatically use the latest version of the same series kernel. When set to true , it will automatically search for newer versions of the same series specified in -k , such as version 5.10.125, and if there is a newer version after 5.10.125, it will be replaced with the latest version automatically. When set to false , the specified version of the kernel will be compiled. The default value is true . |
-s | Size | Set the size of the ROOTFS partition of the system, which must be greater than 2048MiB. For example: -s 2560 . The default value is 2560 . |
-g | GH_TOKEN | Optional. Set ${{ secrets.GH_TOKEN }} for querying api.github.com. The default value is none . |
sudo ./make
: Package for all TV box models using the latest kernel package in the kernel library with default configuration.sudo ./make -b s905x3 -k 6.1.10
: Package for a specific model (s905x3
) and kernel version (6.1.10
) with default configuration (recommended).sudo ./make -b s905x3_s905d -k 6.1.10_5.15.50
: Package for multiple models (s905x3
ands905d
) and kernels (6.1.10
and5.15.50
) simultaneously with default configuration.sudo ./make -b s905x3 -k 6.1.10 -s 1024
: Package for a specific model (s905x3
) and kernel version (6.1.10
) with default configuration, and set the firmware size to 1024 MiB.sudo ./make -b s905x3_s905d
: Package for all models (s905x3
ands905d
) with default configuration and all available kernels.sudo ./make -k 6.1.10_5.15.50
: Package for all TV box models with multiple specified kernel versions (6.1.10
and5.15.50
) with default configuration.sudo ./make -k 6.1.10_5.15.50 -a true
: Package for all TV box models with multiple specified kernel versions (6.1.10
and5.15.50
) with default configuration, and automatically upgrade to the latest version of the same series kernel if available.sudo ./make -s 1024 -k 6.1.10
: Package for all TV box models with a specific kernel version (6.1.10
) and set the firmware size to 1024 MiB with default configuration.
Compiling with GitHub Actions
You can customize and compile OpenWrt firmware that suits you by modifying the personalized firmware configuration files in the config-openwrt directory, as well as the .yml files. The firmware can be uploaded to Actions
and Releases
on github.com.
- You can find personalized firmware configuration instructions in the documentation. The workflow control file is .yml.
- Freshly compile: On github.com's Action page, select
Build OpenWrt
. Click theRun workflow
button to perform one-stop firmware compilation and packaging. - Re-compile: If there is already a compiled
openwrt-armvirt-64-default-rootfs.tar.gz
file in Releases, and you only want to make another box of a different board, you can skip compiling the OpenWrt source file and go directly to the secondary production. On the Actions page, selectUse Releases file to Packaging
and click theRun workflow
button to re-compile. - More support: The compiled
openwrt-armvirt-64-default-rootfs.tar.gz
file is a universal file for making various board firmware. It is also suitable for making OpenWrt firmware using unifreq's packaging script. As the pioneer of using OpenWrt and Armbian systems in boxes, it supports more devices, such as OpenWrt used in Armbian system throughKVM
virtual machine (QEMU version), Amlogic, Rockchip, and Allwinner series. For packaging methods, please refer to its repository instructions. You can call his packaging script to make more firmware through packaging-openwrt-for-qemu-etc.yml in Actions.
- name: Package Armvirt as OpenWrt
uses: ophub/amlogic-s9xxx-openwrt@main
with:
openwrt_path: openwrt/bin/targets/*/*/*rootfs.tar.gz
openwrt_board: s905x3_s905x2_s905x_s905w_s905d_s922x_s912
openwrt_kernel: 6.1.10_5.15.50
gh_token: ${{ secrets.GH_TOKEN }}
-
GitHub Actions Input Parameter Description
The related parameters correspond to the local packaging command
, please refer to the above instructions.
Parameter | Defaults | Description |
---|---|---|
openwrt_path | None | You can set the file path of openwrt-armvirt-64-default-rootfs.tar.gz using a relative path such as openwrt/bin/targets/*/*/*rootfs.tar.gz or a network file download address such as https://github.com/*/releases/*/*rootfs.tar.gz . |
openwrt_board | all | You can set the board for packaging the box, which is equivalent to using -b function. |
kernel_repo | ophub/kernel | You can specify the <owner>/<repo> of the GitHub kernel repository, which is equivalent to using the -r function. |
kernel_usage | stable | You can set the tags suffix of the kernel used, which is equivalent to using the -u function. |
openwrt_kernel | 6.1.1_5.15.1 | You can set the kernel version, which is equivalent to using the -k function. |
auto_kernel | true | You can set whether to automatically use the latest kernel version in the same series, which is equivalent to using the -a function. |
openwrt_size | 1024 | You can set the size of the firmware rootfs partition, which is equivalent to using the -s function. |
gh_token | None | This is an optional parameter. You can set ${{ secrets.GH_TOKEN }} , which is equivalent to using the -g function. |
-
GitHub Actions Output Variable Description
To upload to Releases
, you need to add ${{ secrets.GITHUB_TOKEN }}
and ${{ secrets.GH_TOKEN }}
to the repository and set Workflow read/write permissions
. For more information, please refer to the usage instructions.
Parameter | For example | Description |
---|---|---|
${{ env.PACKAGED_OUTPUTPATH }} | out | OpenWrt firmware storage path |
${{ env.PACKAGED_OUTPUTDATE }} | 04.13.1058 | Packing date(month.day.hour.minute) |
${{ env.PACKAGED_STATUS }} | success / failure | Package status |
openwrt-*-rootfs.tar.gz Firmware compilation parameters
Option | Value |
---|---|
Target System | QEMU ARM Virtual Machine |
Subtarget | QEMU ARMv8 Virtual Machine(cortex-a53) |
Target Profile | Default |
Target Images | tar.gz |
For more instructions please see: documents
OpenWrt firmware default information
Name | Value |
---|---|
Default IP | 192.168.1.1 |
Default username | root |
Default password | password |
Default WIFI name | OpenWrt |
Default WIFI password | none |
Compile the kernel
For more information on how to compile the kernel, please refer to compile-kernel.
- name: Compile the kernel
uses: ophub/amlogic-s9xxx-armbian@main
with:
build_target: kernel
kernel_version: 6.1.10_5.15.50
kernel_auto: true
kernel_sign: -yourname
Resource Description
When making the OpenWrt system, the kernel and u-boot files used are the same as those used to make the Armbian system. In order to avoid duplicate maintenance, the relevant content is classified and placed in the corresponding resource repository, and will be automatically downloaded from the relevant repository when used.
The kernel
/ u-boot
and other resources used by this system are mainly copied from the unifreq/openwrt_packit project, and some files are shared by users in the Pulls and Issues of projects such as amlogic-s9xxx-openwrt / amlogic-s9xxx-armbian / luci-app-amlogic / kernel. Unifreq
opened the door for us to use OpenWrt on TV boxes, and my firmware inherited his consistent standards in production and use. In order to thank these pioneers and sharers, I have recorded them in CONTRIBUTORS.md. Thank you again for giving new life and meaning to the box.
Other distributions
- Unifreq has created
OpenWrt
systems for more boxes such as Amlogic, Rockchip, and Allwinner, which is a benchmark in the box community and recommended for use. - The amlogic-s9xxx-armbian project provides the
Armbian
system for use on boxes, which is also applicable to related devices that support OpenWrt.
Links
License
The amlogic-s9xxx-openwrt © OPHUB is licensed under GPL-2.0