OpenWRT Boot Times Affected by WiFi: Difference between revisions

mNo edit summary
mNo edit summary
Line 90: Line 90:
</syntaxhighlight>See?  Now change it back to be legal.
</syntaxhighlight>See?  Now change it back to be legal.


=== Oh, One More Thing(s) ===
In /etc/config/wireless, under config wifi-device 'WhatEverRadio'<syntaxhighlight lang="text">
list hostapd_options 'he_6ghz_max_mpdu=0'
list hostapd_options 'he_6ghz_max_ampdu_len_exp=0'
list hostapd_options 'he_6ghz_rx_ant_pat=0'
list hostapd_options 'he_6ghz_tx_ant_pat=0'
</syntaxhighlight>


== ChatGPTs version of the same thing as above (just so you know a human wrote the above and a moron wrote the below) ==


== OpenWrt 25.12.5 USB WiFi and Bluetooth Notes ==
=== MediaTek MT7921AU 6 GHz / NO-IR Test ===
The MT7921AU worked on 2.4/5 GHz but all 6 GHz channels showed <code>(no IR)</code>. For testing, rebuild the regulatory database with NO-IR removed from the US 6 GHz rule.


=== MediaTek MT7921AU / USB ID 0e8d:7961 ===
Install the required build tools:<pre>
apk add make python3
</pre>Download/extract the same wireless-regdb version used by OpenWrt 25.12.5:<pre>wget https://www.kernel.org/pub/software/network/wireless-regdb/wireless-regdb-2026.05.30.tar.xz
tar -xf wireless-regdb-2026.05.30.tar.xz
cd wireless-regdb-2026.05.30</pre>Edit <code>db.txt</code>:<pre>
(5925 - 7125 @ 320), (12), NO-OUTDOOR, NO-IR
</pre>to:<pre>
(5925 - 7125 @ 320), (12), NO-OUTDOOR
</pre>Build and install:<pre>python3 ./db2fw.py regulatory.db db.txt
cp regulatory.db /lib/firmware/regulatory.db
reboot</pre>Verify:<pre>
iw reg get
iw phy phy1 info
</pre><code>regulatory.db</code> is binary; edit <code>db.txt</code>, not <code>regulatory.db</code>.


The adapter works with OpenWrt 25.12.5 using:
== ...shall we critique? ==
Hmmm, commands and general notes put into the same PRE sections, that's good (NOT!).  Un-abstracted the make process, just a different way to do it.  Didn't back up existing files.  Poor wording. Got a headache now.  Solution?  Minimize AI usage and just think.  Oh, and it left out a bunch of stuff too.


<pre> apk add kmod-mt7921u </pre>
Gave it a second shot where it was more vague on the db.txt stuff, commands were much better, plus it added in the stuff it forgot, but then it got chatty, as if it were being paid by the word.


This installs the required MT76 driver, USB support, common modules and firmware.
== Second Shot for ChatGPT ==


Working driver chain:
=== Regulatory database ===
Modify the US 6 GHz rule in ''db.txt'' to permit AP operation:<pre>
(5925 - 7125 @ 320), (12)
</pre>Build and install:<pre>
opkg update
opkg install make python3
ln -sf /usr/bin/python3 /usr/bin/python


<pre> mt7921u mt7921_common mt792x_usb mt792x_lib mt76_usb mt76_connac_lib mt76 </pre>
cd /usr/src/wireless-regdb-2026.05.30
make clean
make regulatory.db
cp -f regulatory.db /lib/firmware/regulatory.db
reboot
</pre>Verify:<pre>
iw reg get
</pre>


Firmware files:
=== 6 GHz radio ===
Use a fixed 6 GHz Preferred Scanning Channel (PSC); channel 5 worked.  Do not use ''auto''.<pre>
uci set wireless.radio1.band='6g'
uci set wireless.radio1.channel='5'
uci set wireless.radio1.country='US'
uci set wireless.radio1.htmode='HE80'
</pre>The MT7921U driver rejected hostapd's default HE 6 GHz capabilities.  These four overrides were required:<pre>uci add_list wireless.radio1.hostapd_options='he_6ghz_max_mpdu=0'
uci add_list wireless.radio1.hostapd_options='he_6ghz_max_ampdu_len_exp=0'
uci add_list wireless.radio1.hostapd_options='he_6ghz_rx_ant_pat=0'
uci add_list wireless.radio1.hostapd_options='he_6ghz_tx_ant_pat=0'
uci commit wireless
wifi reload</pre>Without those overrides hostapd failed with:<pre>
The driver does not support the configured HE 6 GHz Max MPDU length
</pre>Use normal '''AP''' mode rather than WDS.  After changing WDS settings, reboot if ''/var/run/hostapd-phy1.conf'' retains stale ''wds_sta=1''.


<pre> /lib/firmware/mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin /lib/firmware/mediatek/WIFI_RAM_CODE_MT7961_1.bin </pre>
Verify operation:<pre>
 
ubus list 'hostapd.*'
Successful initialization looks similar to:
iw dev
 
</pre>Working state showed ''hostapd.phy1-ap0'' and 6 GHz channel 5 (5975 MHz).
<pre> mt7921u 1-1.4:1.0: HW/SW Version: 0x8a108a10 mt7921u 1-1.4:1.0: WM Firmware Version: ____010000 </pre>
 
The adapter works as an 802.11ax Access Point on both 2.4 GHz and 5 GHz.
 
=== 6 GHz / NO-IR Problem ===
 
The MT7921AU reports 6 GHz AP capability, but all 6 GHz channels are marked:
 
<pre> (no IR) </pre>
 
NO-IR means ''No Initiating Radiation''. This prevents the radio from starting an Access Point on those channels.
 
For the United States regulatory domain, OpenWrt's regulatory database contains:
 
<pre> (5925 - 7125 @ 320), (12), NO-OUTDOOR, NO-IR </pre>
 
This can be tested by building a modified regulatory database with only NO-IR removed:
 
<pre> (5925 - 7125 @ 320), (12), NO-OUTDOOR </pre>
 
Use the same regulatory database version installed by OpenWrt. For OpenWrt 25.12.5 tested here:
 
<pre> wireless-regdb-2026.05.30 </pre>
 
Edit the human-readable source:
 
<pre> nano db.txt </pre>
 
Then build the binary database:
 
<pre> python3 ./db2fw.py regulatory.db db.txt </pre>
 
''regulatory.db is a compiled binary and should not be edited directly.''
 
Copy the resulting file to:
 
<pre> /lib/firmware/regulatory.db </pre>
 
A fixed 6 GHz channel should be used while testing rather than Auto.
 
=== Realtek Bluetooth / USB ID 0bda:8771 ===
 
The existing OpenWrt image already contained the required Bluetooth drivers:
 
<pre> btusb btrtl bluetooth </pre>
 
Only the RTL8761BU firmware was missing:
 
<pre> apk add rtl8761bu-firmware </pre>
 
After reboot, successful firmware loading was confirmed:
 
<pre> Bluetooth: hci0: RTL: loading rtl_bt/rtl8761bu_fw.bin Bluetooth: hci0: RTL: loading rtl_bt/rtl8761bu_config.bin Bluetooth: hci0: RTL: cfg_sz 6, total sz 30210 Bluetooth: hci0: RTL: fw version 0xdfc6d922 </pre>
 
Useful verification command:
 
<pre> dmesg | grep -iE 'hci0|rtl8761|btrtl' </pre>
 
=== Useful Hardware Identification Commands ===
 
<pre> lsusb lsusb -t lsmod | grep -E 'mt7921|mt792x|mt76|btusb|btrtl|bluetooth' iw dev iw phy iw reg get wifi status </pre>