Skip to content

Latest commit

 

History

History
217 lines (150 loc) · 19.1 KB

README.md

File metadata and controls

217 lines (150 loc) · 19.1 KB

OpenWrt for Amlogic s9xxx tv box

View Chinese description | 查看中文说明

The OpenWrt Project is a Linux router operating system targeting embedded devices. Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. Allows you to freely choose the software package you need to customize your router system. For developers, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned. It has more than 3000+ standardized application packages and a very rich third-party plug-in support, so you can easily replicate the same setup on any supported device.

Now you can replace the Android TV system of the TV box with the Amlogic chip with the OpenWrt system, making it a powerful router. This project supports one-stop complete compilation of github.com (compiling from custom software packages to packaging firmware, all in one stop at giuhub.com). Support localized packaging (firmware packaging in local Ubuntu and other environments). including OpenWrt firmware install to EMMC and update related functions. Support Amlogic s9xxx tv box are a311d, s922x, s905x3, s905x2, s905l3a, s912, s905d, s905x, s905w, s905, etc. such as Belink GT-King, Belink GT-King Pro, UGOOS AM6 Plus, X96-Max+, HK1-Box, H96-Max-X3, Phicomm-N1, Octopus-Planet, Fiberhome HG680P, ZTE B860H, etc.

The latest version of the OpenWrt firmware can be downloaded in Releases. Welcome to use Fork for personalized OpenWrt firmware configuration. If you like it, Please click the Star.

OpenWrt Firmware instructions

SoC Device Optional kernel OpenWrt Firmware
a311d Khadas-VIM3 All openwrt_a311d_k*.img
s922x Beelink-GT-King, Beelink-GT-King-Pro, Ugoos-AM6-Plus, ODROID-N2 All openwrt_s922x_k*.img
s905x3 X96-Max+, HK1-Box, H96-Max-X3, Ugoos-X3, TX3, X96-Air, A95XF3-Air All openwrt_s905x3_k*.img
s905x2 X96Max-4G, X96Max-2G, MECOOL-KM3-4G All openwrt_s905x2_k*.img
s912 H96-Pro-Plus, Tanix-TX92, VORKE-Z6-Plus, Mecool-M8S-PRO-L, Octopus-Planet All openwrt_s912_k*.img
s905d MECOOL-KI-Pro, Phicomm-N1 All openwrt_s905d_k*.img
s905x HG680P, B860H All openwrt_s905x_k*.img
s905w X96-Mini, TX3-Mini 5.15.y openwrt_s905w_k*.img
s905 Beelink-Mini-MX-2G, MXQ-PRO+4K All openwrt_s905_k*.img
s905l3a E900V22C/D All openwrt_s905l3a_k*.img

💡Tip: The current s905w series of boxes only support the use of the 5.15.y kernel, and cannot use the 5.10.y or higher version. Other types of boxes can use optional kernel versions. Currently s905 boxes can only be used in TF/SD/USB, other types of boxes also support writing to EMMC. Please refer to the instructions for dtb and u-boot of each device.

Install to EMMC and update instructions

Choose the corresponding firmware according to your box. Then write the IMG file to the USB hard disk through software such as Rufus or balenaEtcher. Insert the USB hard disk into the box. Common for all Amlogic s9xxx tv box.

  • Install OpenWrt

Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuAmlogic ServiceInstall OpenWrt, Select your box in the Supported Devices drop-down list and click the Install OpenWrt button to install it.

  • Update OpenWrt

Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuAmlogic ServiceUpload updates manually / Download updates online

If you choose Upload Updates Manually OpenWrt firmware, You can upload the corresponding OpenWrt firmware package, such as openwrt_s9xxx_k5.15.25_xxx.img.gz (It is recommended to upload the compressed package, and the system will automatically decompress it. If you upload the decompressed xxx.img file, the upload may fail because the file is too large), After the upload is complete, the interface will display the Update firmware operation button, click to update.

If you choose Manually upload updates OpenWrt kernel, You can upload the three kernel files boot-xxx.tar.gz, dtb-amlogic-xxx.tar.gz, modules-xxx.tar.gz (Other kernel files are not required. If uploading at the same time does not affect the update, the system can accurately identify the required kernel files.),After the upload is complete, the interface will display the Update Kernel operation button, click to update.

If you choose Online Download Update OpenWrt firmware or kernel, it will be downloaded according to Firmware download address and Kernel download address in Plugin Settings, you can customize and modify the download source, For details, please refer to the compilation and usage instructions of luci-app-amlogic.

Tip: Functions such as install/update are provided by luci-app-amlogic to provide visual operation support. Also supports command operations.

  • Use OpenWrt in TF/SD/USB

Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuTTYD terminal → input command

openwrt-tf

After activating the remaining space, the kernel and OpenWrt system can be upgraded in TF/SD/USB.

  • Create swap for openwrt system

If you feel that the memory of the current box is not enough when you are using applications with a large memory footprint such as docker, you can create a swap virtual memory partition, Change the disk space of /mnt/*4 A certain capacity is virtualized into memory for use. The unit of the input parameter of the following command is GB, and the default is 1.

Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuTTYD terminal → input command

openwrt-swap 1
  • Backup/restore the original EMMC system

Supports backup/restore of the box's EMMC partition in TF/SD/USB. It is recommended that you back up the Android TV system that comes with the current box before installing the OpenWrt system in a brand new box, so that you can use it in the future when restoring the TV system.

Please start the OpenWrt system from TF/SD/USB, Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuTTYD terminal → input command

openwrt-ddbr

According to the prompt, enter b to perform system backup, and enter r to perform system recovery.

💡Tip: You must use the /mnt/*4/ space to store the BACKUP-arm-64-emmc.img.gz backup file, Users who have not created the TF/SD/USB extended partition must first use the openwrt-tf command to create the extended partition.

  • Controlling the LED display

Log in to the default IP: 192.168.1.1 → Login in to openwrtsystem menuTTYD terminal → input command

openwrt-led

Debug according to LED screen display control instructions.

  • More instructions for use

In the use of OpenWrt, please refer to router-config for some common problems that may be encountered.

Local build instructions

  1. Install the necessary packages (E.g Ubuntu 20.04 LTS user)
sudo apt-get update -y
sudo apt-get full-upgrade -y
sudo apt-get install -y $(curl -fsSL https://raw.githubusercontent.com/ophub/amlogic-s9xxx-armbian/main/compile-kernel/tools/script/ubuntu2004-openwrt-depends)
  1. Clone the repository to the local. git clone --depth 1 https://github.com/ophub/amlogic-s9xxx-openwrt.git
  2. Create a openwrt-armvirt folder, and upload the OpenWrt firmware of the ARM kernel ( Eg: openwrt-armvirt-64-default-rootfs.tar.gz ) to this ~/amlogic-s9xxx-openwrt/openwrt-armvirt directory.
  3. Enter the ~/amlogic-s9xxx-openwrt root directory. And run Eg: sudo ./make -d -b s905x3 -k 5.10.100. The generated OpenWrt firmware is in the out directory under the root directory.
  • Description of localized packaging parameters

Parameter Meaning Description
-d Defaults Compile all cores and all firmware types.
-b BuildSoC Specify the Build firmware type. Write the build firmware name individually, such as -b s905x3 . Multiple firmware use _ connect such as -b s905x3_s905d . Use all for all SoC models. You can use these codes: a311d, s905x3, s905x2, s905l3a, s905x, s905w, s905d, s905d-ki, s905, s922x, s922x-n2, s912, s912-m8s . Note: s922x-reva is s922x-gtking-pro-rev_a, s922x-n2 is s922x-odroid-n2, s912-m8s is s912-mecool-m8s-pro-l, s905d-ki is s912-mecool-ki-pro, s905x2-km3 is s905x2-mecool-km3
-k Kernel Specify the kernel name. Write the kernel name individually such as -k 5.10.100 . Multiple kernel use _ connection such as -k 5.15.25_5.10.100
-a AutoKernel Set whether to automatically adopt the latest version of the kernel of the same series. When it is true, it will automatically find in the kernel library whether there is an updated version of the kernel specified in -k such as 5.10.100 version. If there is the latest version of same series, it will automatically Replace with the latest version. When set to false, the specified version of the kernel will be compiled. Default value: true
-v VersionBranch Specify the name of the kernel version branch, Such as -v stable. The specified name must be the same as the branch directory name. The stable branch version is used by default.
-s Size Set the ROOTFS partition size for firmware (MiB). The default is 960 MiB, and the specified size must be greater than 512 MiB. Such as -s 960
  • sudo ./make -d: Compile latest kernel versions of openwrt for all SoC with the default configuration.
  • sudo ./make -d -b s905x3 -k 5.10.100: recommend. Use the default configuration, specify a kernel and a firmware for compilation.
  • sudo ./make -d -b s905x3_s905d -k 5.15.25_5.10.100: Use the default configuration, specify multiple cores, and multiple firmware for compilation. use _ to connect.
  • sudo ./make -d -b s905x3 -k 5.10.100 -s 960: Using the default configuration, one kernel is specified, one model is packaged, and the firmware size is set to 960 MiB.
  • sudo ./make -d -b s905x3 -v dev -k 5.7.19: Use the default configuration, specify the model, specify the version branch, and specify the kernel for packaging.
  • sudo ./make -d -b s905x3_s905d: Use the default configuration, specify multiple firmware, use _ to connect. compile all kernels.
  • sudo ./make -d -k 5.15.25_5.10.100: Use the default configuration. Specify multiple cores, use _ to connect.
  • sudo ./make -d -k 5.15.25_5.10.100 -a true: Use the default configuration. Specify multiple cores, use _ to connect. Auto update to the latest kernel of the same series.
  • sudo ./make -d -s 960 -k 5.10.100: Use the default configuration and set the partition size to 960 MiB, and only compile the openwrt firmware with the kernel version 5.10.100.

Use GitHub Actions to build

You can modify the configuration file in the router-config directory and .yml file, customize the OpenWrt firmware, and complete the packaging online through Actions, and complete all the compilation of OpenWrt firmware in github.com One-stop.

  1. Personalized plug-in configuration in router-config directory. Workflows configuration in .yml file.
  2. New compilation: Select Build OpenWrt on the Action page. Click the Run workflow button.
  3. Compile again: If there is an openwrt-armvirt-64-default-rootfs.tar.gz file in Releases, you do not need to compile it completely, you can directly use this file to build openwrt of different soc. Select Use Releases file to Packaging on the Actions page. Click the Run workflow button.
- name: Package Armvirt as OpenWrt
  uses: ophub/amlogic-s9xxx-openwrt@main
  with:
    openwrt_path: openwrt/bin/targets/*/*/*rootfs.tar.gz
    openwrt_soc: s905x3_s905x2_s905x_s905w_s905d_s922x_s912
    openwrt_kernel: 5.15.25_5.10.100
  • GitHub Actions Input parameter description

The relevant parameters correspond to the local packaging command, please refer to the above description.

Parameter Defaults Description
openwrt_path no Set the file path of openwrt-armvirt-64-default-rootfs.tar.gz , you can use a relative path such as openwrt/bin/targets/*/*/*rootfs.tar.gz or the network file download address. E.g https://github.com/*/releases/*/*rootfs.tar.gz
openwrt_soc s905d_s905x3 Set the SoC of the packaging box, function reference -b
openwrt_kernel 5.15.25_5.10.100 Set the kernel version,function reference -k
auto_kernel true Set whether to automatically adopt the latest version of the kernel of the same series. function reference -a
version_branch stable Specify the name of the kernel version branch, function reference -v
openwrt_size 960 Set the size of the firmware ROOTFS partition, function reference -s
  • GitHub Actions Output variable description

Parameter For example Description
${{ env.PACKAGED_OUTPUTPATH }} out OpenWrt firmware storage path
${{ env.PACKAGED_OUTPUTDATE }} 2021.04.13.1058 Packing date
${{ env.PACKAGED_STATUS }} success / failure Package status

Compile the kernel

For the compilation method of the kernel, see compile-kernel

- name: Compile the kernel for Amlogic s9xxx
  uses: ophub/amlogic-s9xxx-armbian@main
  with:
    build_target: kernel
    kernel_version: 5.15.25_5.10.100
    kernel_auto: true
    kernel_sign: -meson64-dev

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: router-config

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

Resource Description

When making an OpenWrt system, the kernel and u-boot files used are the same files used to make an Armbian system. In order to avoid repeated maintenance, the relevant content is classified and placed in the corresponding resource repository, and it will be automatically downloaded from the relevant repository when it is used.

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

Acknowledgments

License

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