Site Tools


Sidebar

Work

Projects Travel Singapore Socials (External)

projects:software:openwrt_custom_wireless-regdb

OpenWrt Custom wireless-regdb

Note: Do not use the patch below if you are in Singapore, as wireless-regdb is now maintained once again and updated Singapore regulatory rules have been released.

This information is just provided for reference in case one needs to test changes to wireless-regdb on an OpenWrt wireless AP.

Motivation

As wireless-regdb hadno maintainer it was unlikely that my Wi-Fi 6E regulatory updates for Singapore would propagate to Linux distributions anytime soon (as of the September 2023 IMDA TS SRD release).

Thankfully, it is pretty straightforward to set up a functional Wi-Fi 6E network, as only the Access Point requires a regulatory update, while stations (clients) do not. This is because the regulatory framework restricts the initiation of radiation (beacons), while clients are free to connect to any frequency the hardware is able to receive beacons on (even if it cannot initiate radiation on that frequency).

I Am Lazy and Trusting

Running OpenWrt 23.05.2? Here is my prebuilt package using the steps below (Option B): wireless-regdb_2023-09-03-ab7ed562-1_all.ipk

  1. ssh root@YOUR_ROUTER_IP
  2. opkg install http://ndoo.sg/_media/projects:software:wireless-regdb_2023-09-03-ab7ed562-1_all.ipk
  3. reboot

Building a Custom wireless-regdb Package

Prerequisite - Prepare OpenWrt Build Environment

  1. Clone OpenWrt source (adjust branch as needed, depending on what you're running):
    git clone --depth=1 --branch v23.05.2 https://github.com/openwrt/openwrt.git
  2. Configure the build:
    make menuconfig
    1. Target system: x86 (or respective to the computer you are building on) to save CPU time by not having to cross-compile (the wireless-regdb package is noarch)
    2. Target profile: Generic x86 (this is the default)
    3. Firmware → wireless-regdb → <M>
    4. Exit and save
  3. Build tools and toolchain (this will take ~30 min, depending on your CPU performance):
    make -j$(getconf _NPROCESSORS_ONLN) tools/install
    make -j$(getconf _NPROCESSORS_ONLN) toolchain/install

Option A - Quick and Dirty - Using a Patch

This is quick and dirty because (1) it generates a package with the same version number (unless you update the Makefile metadata) and (2) it will break with a change in wireless-regdb releases that change db.txt or (3) the patch series that comes with OpenWrt.

This was only tested on OpenWrt=v23.05.2 and wireless-regdb=2023.09.01.

  1. Download the snippet below to your cloned OpenWrt repo (it goes in package/firmware/wireless-regdb/patches/):
    package/firmware/wireless-regdb/patches/999-SG-regd-2023-sep.patch
    Index: wireless-regdb-2023.09.01/db.txt
    ===================================================================
    --- wireless-regdb-2023.09.01.orig/db.txt
    +++ wireless-regdb-2023.09.01/db.txt
    @@ -1584,25 +1584,27 @@ country SE: DFS-ETSI
     	# 60 GHz band channels 1-4 (ETSI EN 302 567)
     	(57000 - 66000 @ 2160), (40)
     
    -# https://www.imda.gov.sg/-/media/Imda/Files/Regulation-Licensing-and-Consultations/ICT-Standards/Telecommunication-Standards/Radio-Comms/IMDATSSRD.pdf
    -# IMDA TS SRD, Issue 1 Revision 1, April 2019, subsequently "IMDA TS SRD"
    -# 2400 - 2483.5 MHz: IMDA TS SRD, Table 1 (25); ANSI C63.10-2013 and FCC Part 15 Section 15.247 or EN 300 328
    -# 5150 - 5350 MHz: IMDA TS SRD, Table 1 (29); FCC Part 15 Section 15.407 (1) 5.15-5.25 GHz (2) 5.25-5.35 GHz; EN 301 893
    -# 5470 - 5725 MHz: IMDA TS SRD, Table 1 (30); FCC Part 15 Section 15.407 (2) 5.47-5.725 GHz; EN 301 893
    -# 5725 - 5850 MHz: IMDA TS SRD, Table 1 (27); FCC Part 15 Section 15.247; FCC Part 15 Section 15.407 (3) 5.725-5.85 GHz
    -# 57000 - 66000 MHz: IMDA TS SRD, Table 1 (31); ETSI EN 302 567
    -# Note: 27dBm for 5470-5725MHz bands is 3dBm reduction per FCC Part 15 Section 15.407 (2) 5.47-5.725 GHz; EN 301 893 as referenced by IMDA TS SRD
    +# https://www.imda.gov.sg/-/media/imda/files/regulation-licensing-and-consultations/ict-standards/telecommunication-standards/radio-comms/imdatssrd.pdf
    +# IMDA TS SRD, Issue 1 Revision 3, Sep 2023, subsequently "IMDA TS SRD"
    +# 2400 - 2483.5 MHz: IMDA TS SRD, Table 1 Sub-band 32e
    +# 5150 - 5350 MHz: IMDA TS SRD, Table 1 Sub-band 33a
    +# 5470 - 5725 MHz: IMDA TS SRD, Table 1 Sub-band 34
    +# 5725 - 5850 MHz: IMDA TS SRD, Table 1 Sub-band 35
    +# 5945 - 6425 MHz: IMDA TS SRD, Table 1 Sub-band 45b
    +# 57000 - 66000 MHz: IMDA TS SRD, Table 1 Sub-band 40
    +# Note: 500mW for 5470-5725MHz bands per FCC Part 15 Section 15.407 (2) 5.47-5.725 GHz as referenced by IMDA TS SRD
     #  AU and BG regulatory domains use the same interpretation of cited FCC and ETSI standards
    -# Note: The transmit power for 5250-5350MHz bands can be raised by 3dBm when TPC is implemented: IMDA TS SRD Table 1 (29)
    -# Note: The transmit power for 5470-5725MHz bands can be raised by 3dBm when TPC is implemented: IMDA TS SRD Table 1 (30)
    +# Note: The transmit power for 5250-5350MHz bands can be raised by 3dBm when TPC is implemented: IMDA TS SRD, Table 1 Sub-band 33a
    +# Note: The transmit power for 5470-5725MHz bands can be raised by 3dBm when TPC is implemented: IMDA TS SRD Table 1 Sub-band 34
     
     country SG: DFS-FCC
    -	(2400 - 2483.5 @ 40), (23)
    -	(5150 - 5250 @ 80), (23), AUTO-BW
    -	(5250 - 5350 @ 80), (20), DFS, AUTO-BW
    -	(5470 - 5725 @ 160), (27), DFS
    -	(5725 - 5850 @ 80), (30)
    -	(57000 - 66000 @ 2160), (40)
    +	(2400 - 2483.5 @ 40), (200 mW)
    +	(5150 - 5250 @ 80), (200 mW), AUTO-BW
    +	(5250 - 5350 @ 80), (100 mW), DFS, AUTO-BW
    +	(5470 - 5725 @ 160), (500 mW), DFS, AUTO-BW
    +	(5725 - 5850 @ 80), (1000 mW), AUTO-BW
    +	(5945 - 6425 @ 320), (250 mW), NO-OUTDOOR
    +	(57000 - 66000 @ 2160), (10000 mW)
     
     # SI as part of EU/CEPT accepted decisions 2005/513/EC (5GHz RLAN, EN 301 893)
     # and 2006/771/EC (amended by 2008/432/EC, Short-Range Devices, EN 300 440)
  2. make package/firmware/wireless-regdb/{clean,compile} V=s
  3. Locate your freshly baked package:
    $ ls bin/packages/*/base/wireless-regdb*.ipk
    bin/packages/powerpc_8548/base/wireless-regdb_2023.09.01-1_all.ipk

Option B - Cleaner - Using Our Own wireless-regdb Repository

This is cleaner because the generated package version will track both the source commit ID and date, making it unambigious which package you have installed.

Make Changes to wireless-regdb's regulatory.txt

Building wireless-regdb Package from Our Custom Repo

The proper way to do this would be to create a new OpenWrt package with a different name, e.g. wireless-regdb-sg6e that provides wireless-regdb, but we just want quick and dirty hack for Wi-Fi 6E enablement while waiting for wireless-regdb's next release, we can just edit the existing wireless-regdb Makefile to pull from our Git repo with the changes we want.

  1. Download the snippet below to your cloned OpenWrt repo and run git apply wireless-regdb-sg.patch (or just patch it by hand):
    wireless-regdb-sg.patch
    diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile
    index dfff35f..2430532 100644
    --- a/package/firmware/wireless-regdb/Makefile
    +++ b/package/firmware/wireless-regdb/Makefile
    @@ -1,12 +1,13 @@
     include $(TOPDIR)/rules.mk
     
     PKG_NAME:=wireless-regdb
    -PKG_VERSION:=2023.09.01
     PKG_RELEASE:=1
     
    -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
    -PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/
    -PKG_HASH:=26d4c2a727cc59239b84735aad856b7c7d0b04e30aa5c235c4f7f47f5f053491
    +PKG_SOURCE_URL:=https://github.com/ndoo/wireless-regdb
    +PKG_SOURCE_PROTO:=git
    +PKG_SOURCE_DATE:=2023-09-03
    +PKG_SOURCE_VERSION:=ab7ed5625f21f9e9627eb71b213ea5098f25582a
    +PKG_MIRROR_HASH:=SKIP
     
     PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>


    (You may have to add/remove a newline if you are getting an error during apply, due to DokuWiki limitations)
    To use your own wireless-regdb repo, change the following variables:

    • PKG_SOURCE_URL - Git repo URL
    • PKG_SOURCE_VERSION - Git commit hash
    • PKG_SOURCE_DATE - Git commit date
  2. Download the custom wireless-regdb:
    make package/firmware/wireless-regdb/download V=s
  3. Fix the hash in the makefile:
    make package/firmware/wireless-regdb/check V=s FIXUP=1
  4. Build wireless-regdb:
    make package/firmware/wireless-regdb/compile
  5. Locate your freshly baked package:
    $ ls bin/packages/*/base/wireless-regdb*.ipk
    bin/packages/powerpc_8548/base/wireless-regdb_2023-09-03-ab7ed562-1_all.ipk

Installing your Custom wireless-regdb Package

  1. Copy the package to your AP:
    scp -O bin/packages/*/base/wireless-regdb*.ipk root@YOUR_ROUTER_IP:/tmp/
  2. Install the package on your AP:
    ssh root@YOUR_ROUTER_IP
    opkg install --force-downgrade /tmp/wireless-regdb*.ipk
  3. Reboot your AP:
    ssh root@YOUR_ROUTER_IP
    reboot
  4. Try out your updated regulatory rules!

Notes

  • I tested this with an AsiaRF AW7916-NPD, which is relatively well-supported in OpenWrt with packages kmod-mt7915e kmod-mt7916-firmware
projects/software/openwrt_custom_wireless-regdb.txt · Last modified: 2024/03/23 11:22 by 127.0.0.1