Configuring and Using OpenWrt Domestic Sources

Currently, the latest official firmware for OpenWrt is 23.05.5, which was updated on September 28. The entire community is still very active.

The official firmware image download link is: https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/

Here, 23.05.5 is the firmware version: targets is the archived image files, x86/64 indicates x86 architecture, 64-bit system. You can choose according to your hardware.

For some traditional routers, OpenWrt provides a firmware selector tool for selection. However, it is necessary to strictly follow the given firmware file for updates, such as the order of flashing, etc. However, this firmware only provides the most basic functions. If you need more plugins, you need to find them yourself.

I previously wrote an article on how to set up a testing environment in China, referring to setting up an OpenWrt learning environment under Windows 11. Today, I will talk about these firmwares and how to obtain these packages.

Firmware Classification

Here, I will briefly write the function of each firmware file provided by the official website:

Firmware File File Description
generic-ext4-combined-efi.img.gz ext4 file format, image with EFI boot, expandable disk format
generic-ext4-combined.img.gz ext4 file format, non-EFI boot image, expandable disk format
generic-ext4-rootfs.img.gz Rootfs image, without boot, can be defined to boot with grub or syslinux. Ext4 format
generic-kernel.bin Single kernel file
generic-squashfs-combined-efi.img.gz Squashfs format, image with EFI boot, can restore factory settings with one click
generic-squashfs-combined.img.gz Squashfs format, non-EFI boot image, restore factory settings
generic-squashfs-rootfs.img.gz Rootfs image, without boot, can be defined to boot with grub or syslinux. Squashfs format
rootfs.tar.gz Rootfs without boot

Different architectures may support different files, choose according to the actual situation.

In addition, here is an explanation of some of the terms that appear:

  • kernel: The Linux kernel with the simplest built-in file system, suitable for first-time installation or recovery
  • sysupgrade: Upgrade from a firmware that is already OpenWrt, or directly flash this format file on machines without flashing restrictions
  • factory: Used to flash the factory firmware of the device, then flash into breed or similar non-brick firmware
  • ext4: ext4 file system, can expand disk space size
  • squashfs: Can use the reset function (restore factory settings)
  • efi: EFI boot, non-BIOS boot (preferably use EFI firmware, switch to non-EFI firmware if unable to boot)
  • rootfs: Without boot, can be defined to boot with grub or syslinux
  • combined: Indicates with boot
  • .img: Image file format, img is generally used for physical machines

The above is the explanation of the official firmware. In addition, there are some firmwares compiled by enthusiasts themselves. These can be found on some forums, and everyone stores them in cloud storage, with detailed flashing steps. However, these firmwares are compiled by the authors according to their needs, and many may not be needed, causing additional resource waste.

How to choose these firmwares, I will share my thoughts:

  1. The simplest is to choose squashfs, one-click restore, which is very useful
  2. Whether to choose EFI depends on your firmware support.
  3. If you are familiar with some of the Linux boot, kernel, etc., then choose freely, you can tinker as you wish.

How to Speed Up Downloads in China

After finding the firmware, download it to your local machine and upgrade your hardware, which is what everyone does. However, the download speed from the OpenWrt official website is too slow, so we can choose domestic acceleration sites to download.

Domestic mirrors provided by Tencent, Alibaba, etc., can download the corresponding firmware. There are also some amusing ones, specific addresses are as follows: Tencent: https://mirrors.cloud.tencent.com/openwrt/ Alibaba: https://mirrors.aliyun.com/openwrt/releases/ Tsinghua Source: https://mirrors.tuna.tsinghua.edu.cn/openwrt Peking University Source: https://mirrors.pku.edu.cn/openwrt

I personally feel that using university sources is faster, but I don’t know if it’s due to my network or if the software source has limited speed.

opkg Software Package Domestic Source

Previously, I mentioned how to find OpenWrt firmware in China. After installation, various plugins and packages need to be installed, such as the Chinese language pack. OpenWrt uses opkg to manage various installation packages. On the login page, go to System — Software Packages to manage the page.

Configuring and Using OpenWrt Domestic Sources

By default, it downloads from the official website, but can be replaced with domestic sources. Click on configure opkg, where you can edit the corresponding configuration, among which opkg.conf is for global configuration – this is generally not modified, customfeeds.conf is for custom repositories – this can be modified when there is a custom need. Here we need to provide the OpenWrt corresponding version under the software packages as domestic sources. We can directly modify the /etc/opkg/distfeeds.conf part. For example, using Alibaba source, paste the following into the box. Note: The architecture and version need to match your router.

src/gz openwrt_core https://mirrors.aliyun.com/openwrt/releases/23.05.4/targets/x86/64/packages
src/gz openwrt_base https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/base
src/gz openwrt_luci https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/luci
src/gz openwrt_packages https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/packages
src/gz openwrt_routing https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/routing
src/gz openwrt_telephony https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/telephony

It is mainly divided into six parts: openwrt_core, openwrt_base, openwrt_luci, openwrt_packages, openwrt_routing, and openwrt_telephony. After replacing all parts, click the page Update List to see the available software and choose to install as needed.

Additionally, you can also use the command line. Refer to https://help.mirrors.cernet.edu.cn/openwrt/ (this is a summary of many domestic sources from universities, I usually use this source) method to directly replace by logging into the router and executing the replacement command, for example, replacing with Tsinghua source:

#Replace
sed -i 's_https\?://downloads.openwrt.org_https://mirrors.tuna.tsinghua.edu.cn/openwrt_' /etc/opkg/distfeeds.conf

# Update
opkg update

# Install a certain software package
opkg install xxx

Summary

Through the above methods, you can quickly download, configure, and use OpenWrt in China; however, there are some points to note:

  1. Packages provided by the official site may not be complete. For example, the msd_lite used in the previous IPTV integration (refer to OpenWrt application scenarios: Introduction to IPTV integration) is not available in the official repository.
  2. The software package is managed by opkg, and the opkg corresponding configuration file needs attention. Previously, when we deployed OMNP, we also used opkg to manage, but that opkg is different from here, and environment variables need to be replaced.
  3. OpenWrt is designed for routers, and much information is stored in memory. After each opkg update, the cached information cannot be seen after a power failure and needs to be updated again to see.

Leave a Comment

×