/amlogic-s9xxx-openwrt

Support for OpenWrt in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.

Primary LanguageShellGNU General Public License v2.0GPL-2.0

OpenWrt

View Chinese description | 查看中文说明

The OpenWrt project is a Linux router operating system for embedded devices. OpenWrt is not a single and immutable firmware, but rather provides a fully writable filesystem with package management capabilities, allowing you to freely select the required software packages to customize the router system. For developers, OpenWrt is a framework that allows application development without having to build a complete firmware around it; for ordinary users, it means having the capability for complete customization, and the ability to use the device in unexpected ways. It has over 3000+ standardized application software packages and extensive third-party plugin support, allowing you to easily apply them to various supported devices. Now you can replace the Android TV system on your TV box with the OpenWrt system, turning it into a powerful router.

This project, thanks to numerous contributors, builds the OpenWrt system for Amlogic, Rockchip, and Allwinner boxes. It supports writing to eMMC for use, supports updating the kernel, and more. For detailed usage instructions, see the OpenWrt User Guide. The latest firmware can be downloaded from Releases. You are welcome to Fork and customize the software packages. If you find it useful, you can click the Star in the upper right corner of the repository to show your support.

OpenWrt System Description

SoC Device Kernel OpenWrt
a311d Khadas-VIM3 All amlogic_a311d.img
s922x Beelink-GT-King, Beelink-GT-King-Pro, Ugoos-AM6-Plus, ODROID-N2, X88-King, Ali-CT2000 All amlogic_s922x.img
s905x3 X96-Max+, HK1-Box, Vontar-X3, H96-Max-X3, Ugoos-X3, TX3(QZ), TX3(BZ), X96-Air, X96-Max+_A100, A95X-F3-Air, Tencent-Aurora-3Pro(s905x3-b), X96-Max+Q1, X96-Max+100W, X96-Max+_2101, Infinity-B32, Whale, X88-Pro-X3, X99-Max-Plus, Transpeed-X3-Plus All amlogic_s905x3.img
s905x2 X96Max-4G, X96Max-2G, MECOOL-KM3-4G, Tanix-Tx5-Max, A95X-F2 All amlogic_s905x2.img
s912 Tanix-TX8-Max, Tanix-TX9-Pro(3G), Tanix-TX9-Pro(2G), Tanix-TX92, Nexbox-A1, Nexbox-A95X-A2, A95X, H96-Pro-Plus, VORKE-Z6-Plus, Mecool-M8S-PRO-L, Vontar-X92, T95Z-Plus, Octopus-Planet, Phicomm-T1, TX3-Mini, OneCloudPro-V1.1_V1.2 All amlogic_s912.img
s905d MECOOL-KI-Pro, Phicomm-N1, SML-5442TW All amlogic_s905d.img
s905x HG680P, B860H, TBee-Box, T95, TX9, XiaoMI-3S, X96, Nexbox-a95x All amlogic_s905x.img
s905w X96-Mini, TX3-Mini, W95, X96W/FunTV, MXQ-Pro-4K All amlogic_s905w.img
s905mb S65 All amlogic_s905s905mb.img
s905l UNT402A, M201-S, MiBox-4, MiBox-4C, MG101, E900V21C, IP108H-53u1m, Tencent-Aurora-1s, B860AV2.1 All amlogic_s905l.img
s905l2 MGV2000, MGV2000-K, MGV3000, Wojia-TV-IPBS9505, M301A, E900v21E, e900v21d, CM201-1 All amlogic_s905l2.img
s905l3 CM211-1, CM311-1, HG680-LC, M401A, UNT400G1, UNT402A, ZXV10-BV310, M411A, ZXV10-B860AV3.2-M, ZXV10-B860AV2.1-U, E900V22D-2 All amlogic_s905l3.img
s905l3a E900V22C/D, CM311-1a-YST, M401A, M411A, UNT403A, UNT413A, ZTE-B863AV3.2-M, CM311-1a-CH, IP112H, B863AV3.1-M2 All amlogic_s905l3a.img
s905l3b CM201-1, CM211-1, CM311-1, E900V21D, E900V22D, E900V21E, E900V22E, M302A/M304A, Hisense-IP103H, TY1608, TY1608, MGV2000, B860AV-2.1M, UNT403A, RG020ET-CA All amlogic_s905l3b.img
s905lb Q96-mini, BesTV-R3300L, SumaVision-Q7, MG101, s65, IPBS9505 All amlogic_s905lb.img
s905 Beelink-Mini-MX-2G, Sunvell-T95M, MXQ-Pro+4K, SumaVision-Q5 All amlogic_s905.img
rk3588 Radxa-Rock5B, Radxa-Rock5C, Orange-Pi-5-Plus, Beelink-IPC-R, HLink-H88K, HLink-H88K-V3, NanoPC-T6 rk3588 rockchip_boxname.img
rk3568 FastRhino-R66S, FastRhino-R68S, Radxa-E25, NanoPi-R5S, NanoPi-R5C, HLink-H66K, HLink-H68K, HLink-H69K, Seewo-sv21, Mrkaio-m68s, Swan1-w28 rk35xx
6.x.y
rockchip_boxname.img
rk3566 Panther-X2, JP-TvBox rk35xx
6.x.y
rockchip_boxname.img
rk3528 HLink-H28K, Radxa-E20C, H96-Max-M2 rk35xx rockchip_boxname.img
rk3399 EAIDK-610, King3399, TN3399, Kylin3399, ZCube1-Max, CRRC, SMART-AM40, SW799, ZYSJ, DG-3399, DLFR100, Emb3531, Leez-p710, tvi3315a, xiaobao, Fine3399, Firefly-RK3399, LX-R3S, Hugsun-x99, Tb-ls3399, Hisense-hs530r, Tpm312, ZK-rk39a 6.x.y rockchip_boxname.img
rk3328 BeikeYun, Chainedbox-L1-Pro, Station-M1, Bqeel-MVR9, Renegade/Firefly All rockchip_boxname.img
rk3318 RX3318-Box 6.x.y rockchip_boxname.img
h6 Vplus, Tanix-TX6, TQC-A01 6.x.y
h6
allwinner_boxname.img

Tip

Currently, the s905 box can only be used with a SD card or a USB drive, other models of boxes support using the EMMC. For more information, please refer to the Supported Device List Description. You can refer to the method in Section 12.15 of the instruction manual to add new supported devices. Please read the OpenWrt User Guide before use. It provides solutions to common issues.

Install and Update OpenWrt

Choose the OpenWrt firmware corresponding to your TV box model, and refer to the corresponding instructions for the use of different devices.

  • Install OpenWrt

  1. For the Rockchip platform, please refer to the Chapter 8 of the instruction manual, the installation method is the same as that of Armbian.

  2. For the Amlogic and Allwinner platforms, use tools like Rufus or balenaEtcher to write the firmware to USB, then insert the USB with the written firmware into the box. Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with the default accountSystem MenuAmlogic Treasure BoxInstall OpenWrt, select your box from the dropdown list of supported devices, click Install OpenWrt button to install.

  • Update OpenWrt system or kernel

Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with your accountSystem MenuAmlogic Treasure BoxManually Upload Update / Online Download Update

If you select Manually Upload Update OpenWrt Firmware, you can upload the compressed package of the compiled OpenWrt firmware, such as openwrt_xxx_k5.15.50.img.gz (recommended to upload the compressed package, the system will automatically decompress. If you upload the decompressed xxx.img format file, it may fail due to the large file size). After the upload is complete, the interface will display the operation button of Update Firmware, click to update.

If you select Manually Upload Update OpenWrt Kernel, you can upload the three kernel files: boot-xxx.tar.gz, dtb-xxx.tar.gz, modules-xxx.tar.gz (other kernel files are not needed, if uploaded simultaneously, it does not affect the update, the system can accurately identify the needed kernel files). After the upload is complete, the interface will display the operation button of Update Kernel, click to update. When a kernel update failure causes the system to be unbootable, you can use the openwrt-kernel -s command for kernel recovery. For the method, see Kernel Recovery.

If you select Online Download Update for OpenWrt firmware or kernel, it will be downloaded according to the firmware download address and kernel download address in the Plugin Settings. You can customize the download source. For specific operation methods, please refer to the compilation and usage instructions of luci-app-amlogic.

  • Create swap for OpenWrt

If you feel that the current box's memory is not enough when using memory-intensive applications like docker, you can create a swap virtual memory partition, and use a certain capacity of the /mnt/*4 disk space as memory. The unit of the input parameter in the command below is GB, the default is 1.

Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with the default accountSystem MenuTTYD Terminal → enter the command

openwrt-swap 1
  • Backup/Restore Original EMMC System

Supports backing up/restoring the EMMC to a SD card or a USB flash drive. We recommend that you backup the Android TV system that comes with the box before installing the OpenWrt system in a brand-new box for future use in restoring the TV system, etc.

Please boot OpenWrt system from a SD card or a USB flash drive, then from the browser, Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with the default accountSystem MenuTTYD Terminal → enter the command

openwrt-ddbr

Follow the prompts to enter b to backup the system, or enter r to restore the system.

Important

In addition, the Android system can also be flashed into eMMC using the method of flashing via a cable. The download image of the Android system can be found in Tools.

  • Control LED Display

Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with the default accountSystem MenuTTYD Terminal → enter the command

openwrt-openvfd

Refer to LED Screen Display Control Description for debugging.

  • Restore to Initial State

Browser access to OpenWrt's IP (e.g. 192.168.1.1) → Log in to OpenWrt with the default accountSystem MenuAmlogic ServiceBackup Firmware ConfigSnapshot ManagementSelect Initialize Snapshot, and click on Restore Snap to revert to the initial state.

Alternatively, you can navigate to System menuTTYD Terminal → Enter the command firstboot to restore the system to its initial state. Both methods yield the same result.

  • More Usage Instructions

Some common problems that might be encountered during the use of OpenWrt can be found in the User Guide

Local Packaging

  1. Install necessary packages (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)
  1. Clone repository to local git clone --depth 1 https://github.com/ophub/amlogic-s9xxx-openwrt.git
  2. In the root directory of ~/amlogic-s9xxx-openwrt, create openwrt-armvirt folder, and upload the openwrt-armvirt-64-default-rootfs.tar.gz file to this directory.
  3. Enter the packaging command in the root directory of ~/amlogic-s9xxx-openwrt, such as sudo ./make -b s905x3 -k 6.1.10. The packaged OpenWrt firmware is placed in the out folder in the root directory.
  • Explanation of Local Packaging Parameters

Parameter Meaning Description
-b Board Specify the model of the TV box, such as -b s905x3. Connect multiple models with _, such as -b s905x3_s905d. Use all to represent all models. See the BOARD setting in model_database.conf for model codes. Default: all
-r KernelRepo Specify the <owner>/<repo> of the github.com kernel repository. Default: ophub/kernel
-u kernelUsage Set the tag suffix of the kernel to be used, such as stable, flippy, dev, beta. Default: stable
-k Kernel Specify the kernel name, such as -k 5.10.125. Connect multiple kernels with _, such as -k 5.10.125_5.15.50. The kernel version freely specified by the -k parameter is only valid for kernels using stable/flippy/dev/beta. Other kernel series such as rk3588 / rk35xx / h6 can only use specific kernels.
-a AutoKernel Set whether to automatically adopt the latest version of the same series of kernels. When set to true, it will automatically search the kernel library for updates of the same series as the kernel specified in -k, such as 5.10.125, and will automatically switch to the latest version if there is a version later than 5.10.125. When set to false, it will compile the specified version of the kernel. Default: true
-s Size Set the size of the system's image partitions. When setting only the ROOTFS partition size, you can specify a single value, for example: -s 1024. When setting both BOOTFS and ROOTFS partition sizes, use / to connect the two values, for example: -s 256/1024. The default value is 256/1024
-n BuilderName Set the signature of the OpenWrt system builder. Do not include spaces when setting signatures. Default: none
  • sudo ./make : Use default configuration, use the latest kernel package in the kernel library, and package all models of TV boxes.
  • sudo ./make -b s905x3 -k 6.1.10 : Recommended. Use default configuration for related kernel packaging.
  • sudo ./make -b s905x3 -k 6.1.y : Package the relevant kernels using the default configuration; the kernel utilizes the latest version of the 6.1.y series.
  • sudo ./make -b s905x3_s905d -k 6.1.10_5.15.50 : Use the default configuration and package multiple kernels at the same time. Use _ to connect multiple kernel parameters.
  • sudo ./make -b s905x3 -k 6.1.10 -s 1024 : Use the default configuration, specify a kernel, a model for packaging, and set the firmware size to 1024 MiB.
  • sudo ./make -b s905x3_s905d : Use default configuration, package all kernels for multiple models of TV boxes, use _ to connect multiple models.
  • sudo ./make -k 6.1.10_5.15.50 : Use the default configuration, specify multiple kernels, package all models of TV boxes, and connect kernel packages with _.
  • sudo ./make -k 6.1.10_5.15.50 -a true : Use the default configuration, specify multiple kernels, package all models of TV boxes, and connect kernel packages with _. Automatically upgrade to the latest kernel of the same series.
  • sudo ./make -s 1024 -k 6.1.10 : Use the default configuration, set the firmware size to 1024 MiB, and specify the kernel as 6.1.10 to package all models of TV boxes.

Use GitHub Actions for Compilation

You can modify the related personalized firmware configuration files in the config directory, as well as the .yml file, customize and compile your OpenWrt firmware, and the firmware can be uploaded to Actions and Releases on github.com.

  1. You can view the personalized firmware configuration instructions in the user documentation. The compilation process control file is .yml
  2. New compilation: In github.com's Action select Build OpenWrt. Click the Run workflow button for one-stop firmware compilation and packaging.
  3. Re-compilation: If there is already a compiled openwrt-armvirt-64-default-rootfs.tar.gz file in Releases, and you just want to remake other different boards, you can skip the compilation of OpenWrt source files and go directly to the second production. Select Use Releases file to Packaging on the Actions page, and click the Run workflow button to recompile.
  4. More Support: The compiled openwrt-armvirt-64-default-rootfs.tar.gz file is a universal file for making firmware for different boards. It is also applicable for creating OpenWrt firmware using unifreq's packaging scripts. As the pioneer of using OpenWrt and Armbian systems in TV boxes, he provides support for more devices, such as OpenWrt (QEMU version) used in the Armbian system through a KVM virtual machine, and Amlogic, Rockchip, and Allwinner series, etc. For packaging methods, please refer to the instructions in his repository. In Actions, through packaging-openwrt-for-qemu-etc.yml, you can call his packaging scripts to create more firmware.
- 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.y_5.15.y
  • GitHub Actions Input Parameters Explanation

These parameters correspond to the local packaging command, please refer to the explanations above.

Parameter Default Value Description
openwrt_path None Set the file path of openwrt-armvirt-64-default-rootfs.tar.gz, you can use relative path like openwrt/bin/targets/*/*/*rootfs.tar.gz or a network file download URL like https://github.com/*/releases/*/*rootfs.tar.gz
openwrt_board all Set the board of the box to be packaged, functionality refers to -b
kernel_repo ophub/kernel Specify <owner>/<repo> of the kernel repository on github.com, functionality refers to -r
kernel_usage stable Set the tags suffix of the kernel to be used, functionality refers to -u
openwrt_kernel 6.1.y_5.15.y Set the kernel version, functionality refers to -k
auto_kernel true Set whether to automatically adopt the latest version of the same series of kernels, functionality refers to -a
openwrt_size 256/1024 Set the size of the system BOOTFS and ROOTFS partitions, function reference -s
builder_name None Set the signature of the OpenWrt system builder, functionality refers to -n
  • GitHub Actions Output Variables Explanation

To upload to Releases, you need to set Workflow read/write permissions for repository. For details, see usage instructions.

Parameter Default Value Description
${{ env.PACKAGED_OUTPUTPATH }} out OpenWrt system files output path
${{ env.PACKAGED_OUTPUTDATE }} 04.13.1058 Packaging date (month.day.hourminute)
${{ env.PACKAGED_STATUS }} success / failure Packaging status. success / failure

Compilation Options of openwrt-*-rootfs.tar.gz for Packaging

Option Value
Target System Arm SystemReady (EFI) compliant
Subtarget 64-bit (armv8) machines
Target Profile Generic EFI Boot
Target Images tar.gz

For more information, please refer to the User Documentation

Default Information for OpenWrt Firmware

Name Value
Default IP 192.168.1.1
Default Account root
Default Password password
Default WIFI Name OpenWrt
Default WIFI Password None

Compile the Kernel

For instructions on how to compile the kernel, see compile-kernel.

- name: Compile the kernel
  uses: ophub/amlogic-s9xxx-armbian@main
  with:
    build_target: kernel
    kernel_version: 6.1.y_5.15.y
    kernel_auto: true
    kernel_sign: -yourname

Resource Description

When making the OpenWrt system, the files used, such as kernel and u-boot, are the same files used to create the Armbian system. In order to avoid repeated maintenance, related content has been classified and placed in the corresponding resource repositories, and will be automatically downloaded from the relevant repositories during use.

The u-boot, kernel and other resources used by this system mainly come from the unifreq/openwrt_packit project. Some files are shared by users in the Pull and Issues of the amlogic-s9xxx-openwrt / amlogic-s9xxx-armbian / luci-app-amlogic / kernel / u-boot and other projects. unifreq has opened the door for us to use OpenWrt in TV boxes. Deeply influenced by him, my firmware production and usage follow his consistent standards. To thank these pioneers and sharers, I have recorded them in CONTRIBUTORS.md. Once again, I want to thank everyone for giving new life and meaning to the boxes.

Other Distributions

  • unifreq has made OpenWrt systems for more boxes such as Amlogic, Rockchip, and Allwinner. It is a benchmark in the box circle, recommended for use.
  • The amlogic-s9xxx-armbian project provides the Armbian system used in the box, which is also applicable in devices that support OpenWrt.

Links

License

The amlogic-s9xxx-openwrt © OPHUB is licensed under the GPL-2.0 license