[BPi-R3-Mini] Review and mainline ImmortalWrt firmware support

Using openwrt official image, had two issues so am asking if you can advice:

1- Impossible to use DFS channels, all the time log says radar detected, but in ImmortalWRT didn’t face this issue at all.

2- openwrt nand partition layout is different than what we have in ImmortalWRT, so if we flashing emmc with openwrt, cant use immortalwrt image on nand as backup.

In that case it could be better to do it the other way around: Keep ImmortalWRT or stock on the eMMC and use OpenWrt on the SPI-NAND. Installing to NAND is now also a bit easier because OpenWrt now generates a whole-flash image openwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-factory.bin which can be written directly to the whole-flash MTD device present in the stock firmware.

Maybe we need

diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-mini.dts b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-mini.dts
index 09a557c0cb..9fd64bb54b 100644
--- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-mini.dts
+++ b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3-mini.dts
@@ -582,6 +582,7 @@
        pinctrl-names = "default", "dbdc";
        pinctrl-0 = <&wf_2g_5g_pins>;
        pinctrl-1 = <&wf_dbdc_pins>;
+       mediatek,disable-radar-background;
        status = "okay";
 
        mediatek,eeprom-data = <0x86790200 0x000c4326 0x60000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000

rebuilt along with above patch, but still same error as follows:

Wed Feb 21 20:58:32 2024 daemon.notice hostapd: phy1-ap0: DFS-CAC-COMPLETED success=0 freq=5500 ht_enabled=0 chan_offset=0 chan_width=3 cf1=5530 cf2=0
Wed Feb 21 20:58:32 2024 daemon.notice hostapd: phy1-ap0: DFS-RADAR-DETECTED freq=5500 ht_enabled=0 chan_offset=0 chan_width=3 cf1=5530 cf2=0
Wed Feb 21 20:58:32 2024 daemon.notice hostapd: dfs_downgrade_bandwidth: no DFS channels left, waiting for NOP to finish
Wed Feb 21 20:58:32 2024 daemon.err hostapd: No valid channel available

Of course I did

root@OpenWrt:~# iw reg get
global
country US: DFS-FCC
        (902 - 904 @ 2), (N/A, 30), (N/A)
        (904 - 920 @ 16), (N/A, 30), (N/A)
        (920 - 928 @ 8), (N/A, 30), (N/A)
        (2400 - 2472 @ 40), (N/A, 30), (N/A)
        (5150 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
        (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
        (5470 - 5730 @ 160), (N/A, 24), (0 ms), DFS
        (5730 - 5850 @ 80), (N/A, 30), (N/A), AUTO-BW
        (5850 - 5895 @ 40), (N/A, 27), (N/A), NO-OUTDOOR, AUTO-BW, PASSIVE-SCAN
        (5925 - 7125 @ 320), (N/A, 12), (N/A), NO-OUTDOOR, PASSIVE-SCAN
        (57240 - 71000 @ 2160), (N/A, 40), (N/A)

Now, both official openwrt & ImmortalWRT repositories has the same dts file along with same packages/drivers version. try to rebuilt a new immortalWRT image, works like a charm. have noticed that DFS CAC is not even kicked-in. Might be related to some applied hidden patches which disable DFS-CAC? below are the logs…

root@AP:~# ubus call system board
{
        "kernel": "6.1.78",
        "hostname": "AP",
        "system": "ARMv8 Processor rev 4",
        "model": "Bananapi BPi-R3 Mini",
        "board_name": "bananapi,bpi-r3-mini",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "ImmortalWrt",
                "version": "SNAPSHOT",
                "revision": "r29152-203fd30b57",
                "target": "mediatek/filogic",
                "description": "ImmortalWrt SNAPSHOT r29152-203fd30b57"
        }
}
root@AP:~# iw reg get
global
country US: DFS-FCC
        (902 - 904 @ 2), (N/A, 30), (N/A)
        (904 - 920 @ 16), (N/A, 30), (N/A)
        (920 - 928 @ 8), (N/A, 30), (N/A)
        (2400 - 2472 @ 40), (N/A, 30), (N/A)
        (5150 - 5350 @ 160), (N/A, 30), (N/A)
        (5470 - 5850 @ 160), (N/A, 30), (N/A)
        (5850 - 5895 @ 40), (N/A, 27), (N/A), NO-OUTDOOR, AUTO-BW, PASSIVE-SCAN
        (5925 - 7125 @ 320), (N/A, 12), (N/A), NO-OUTDOOR, PASSIVE-SCAN
        (57240 - 71000 @ 2160), (N/A, 40), (N/A)
root@AP:~# iw dev wlan1 station dump
Station 04:7b:cb:b2:2d:28 (on wlan1)
        inactive time:  0 ms
        rx bytes:       41097537
        rx packets:     116072
        tx bytes:       1210292544
        tx packets:     901876
        tx retries:     654
        tx failed:      654
        rx drop misc:   1
        signal:         -52 [-60, -55, -56] dBm
        signal avg:     -52 [-60, -55, -56] dBm
        tx bitrate:     2161.3 MBit/s 160MHz HE-MCS 10 HE-NSS 2 HE-GI 0 HE-DCM 0
        tx duration:    2136002928 us
        rx bitrate:     2401.9 MBit/s 160MHz HE-MCS 11 HE-NSS 2 HE-GI 0 HE-DCM 0
        rx duration:    14974725 us
        last ack signal:-40 dBm
        avg ack signal: -40 dBm
        airtime weight: 256
        authorized:     yes
        authenticated:  yes
        associated:     yes
        preamble:       long
        WMM/WME:        yes
        MFP:            yes
        TDLS peer:      no
        DTIM period:    2
        beacon interval:100
        short slot time:yes
        connected time: 36775 seconds
        associated at [boottime]:       60.615s
        associated at:  1708646319713 ms
        current time:   1708683094729 ms
root@AP:~# iwinfo
wlan1     ESSID: "Bebo5G"
          Access Point: C6:A3:DC:AE:E4:5A
          Mode: Master  Channel: 100 (5.500 GHz)  HT Mode: HE160
          Center Channel 1: 114 2: unknown
          Tx-Power: 27 dBm  Link Quality: 67/70
          Signal: -43 dBm  Noise: -92 dBm
          Bit Rate: 2041.4 MBit/s
          Encryption: WPA3 SAE (CCMP)
          Type: nl80211  HW Mode(s): 802.11ac/ax/n
          Hardware: embedded [MediaTek MT7986]
          TX power offset: none
          Frequency offset: none
          Supports VAPs: yes  PHY name: phy1
root@AP:~# logread -f | grep wlan1
Fri Feb 23 13:20:24 2024 daemon.notice hostapd: wlan1: interface state UNINITIALIZED->COUNTRY_UPDATE
Fri Feb 23 13:20:24 2024 daemon.notice hostapd: wlan1: interface state COUNTRY_UPDATE->HT_SCAN
Fri Feb 23 13:20:24 2024 kern.info kernel: [37325.807731] br-lan: port 2(wlan1) entered disabled state
Fri Feb 23 13:20:26 2024 kern.info kernel: [37327.203135] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
Fri Feb 23 13:20:26 2024 kern.info kernel: [37327.209655] br-lan: port 2(wlan1) entered blocking state
Fri Feb 23 13:20:26 2024 kern.info kernel: [37327.214967] br-lan: port 2(wlan1) entered forwarding state
Fri Feb 23 13:20:26 2024 daemon.notice netifd: Network device 'wlan1' link is up
Fri Feb 23 13:20:26 2024 daemon.notice hostapd: wlan1: interface state HT_SCAN->ENABLED
Fri Feb 23 13:20:26 2024 daemon.notice hostapd: wlan1: AP-ENABLED

Looks like ImmortalWrt is removing DFS entirely:

Good Catch, forget that mediatek has not an embedded regd in their firmware like other chipset vendors anyway, thanks

My 2 cents is that if there’s a real conflict with radar you’d better not use that channel…

1 Like

This is in no way specific to the chip vendor, but rather a difference between using the proprietary drivers with a built-in Wi-Fi stack (which will usually require using a specific, very old and heavily patched kernel and are unsuitable for inclusion in OpenWrt for various reasons, incl. legal) and Linux cfg80211 drivers which are open source and use Linux own regdomain infrastructure.

I got CME Error 10 when I used AT+CPIN? to check the status of the smi card. Tried both on immortalwrt and stock firmware, any idea about the issue?

Want to know the relationship between GitHub - hanwckf/immortalwrt-mt798x and GitHub - immortalwrt/immortalwrt: An opensource OpenWrt variant for mainland China users.. Which is more suitable for bpi-r3 mini?

CME Error 10 means the modem does not detect the SIM card, anyway double check the sim is installed properly, then try this command, AT+CFUN=1,1, will switch UE to full functionality then reset the modem. finally try AT+CPIN? and check the result.

never tried this repository, but from first look, its based an old version of openwrt (21). recommendation to use immoralert or openwrt images, both are stable images and works very good with R3 mini

im newbie here, just installed ImmortalWrt 23.05-SNAPSHOT on eMMC, but the disk size is so small, only 280mb, how to expand the disk? thanks

and how to manage the fan, its running so fast everytime, how to control like factory firmware?

need the following packages to be installed: cfdisk, resize2fs, tune2fs and e2fsprogs. Then do the following:

1- resize the partition 2 via cfdisk.

2- run the command of mount -o remount,ro /

3- tune2fs -O^resize_inode /dev/mmcblk1p2

4- fsck.ext4 /dev/mmcblk1p2 #Fix part, answer yes to remove GDT blocks remnants

5- reboot

6- resize2fs /dev/mmcblk1p2

For fan issue, recommend to install latest image image otherwise run the command of in startup echo 90 > /sys/class/hwmon/hwmon1/pwm1

1 Like
root@ImmortalWrt:~# fdisk -l
Disk /dev/mtdblock0: 1 MiB, 1048576 bytes, 2048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock1: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock2: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock3: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock4: 122.5 MiB, 128450560 bytes, 250880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
GPT PMBR size mismatch (745503 != 15269887) will be corrected by write.
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
The backup GPT table is not on the end of the device.


Disk /dev/mmcblk0: 7.28 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5452574F-2211-4433-5566-778899AABB00

Device            Start    End Sectors  Size Type
/dev/mmcblk0p1     8192   9215    1024  512K Linux filesystem
/dev/mmcblk0p2     9216  13311    4096    2M Linux filesystem
/dev/mmcblk0p3    13312  21503    8192    4M EFI System
/dev/mmcblk0p4    24576  90111   65536   32M EFI System
/dev/mmcblk0p5   131072 745471  614400  300M unknown
/dev/mmcblk0p128     34   8191    8158    4M BIOS boot

Partition table entries are not in disk order.


Disk /dev/ubiblock0_1: 43.84 MiB, 45965312 bytes, 89776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

im sorry sir, but in my case it showed /dev/mmcblk0p2, Is this true? or should I use mmcblk1

Sorry, Ignore last procedure I have shared with you, its used for different file system (ext4). in your case, boot from NAND, and resize the partition ``` /dev/mmcblk0p5

losetup -l #if no loop found then run

losetup /dev/loop0 /dev/mmcblk0p5

mount /dev/loop0 /mnt umount /dev/loop0

fsck.f2fs /dev/loop0

mount /dev/loop0 /mnt

umount /dev/loop0

resize.f2fs /dev/loop0

1 Like
root@OpenWrt:~# mount /dev/loop0 /mnt umount /dev/loop0
BusyBox v1.33.2 (2022-04-16 12:59:34 UTC) multi-call binary.

Usage: mount [OPTIONS] [-o OPT] DEVICE NODE

Mount a filesystem. Filesystem autodetection requires /proc.

        -a              Mount all filesystems in fstab
        -i              Don't run mount helper
        -r              Read-only mount
        -t FSTYPE[,...] Filesystem type(s)
        -O OPT          Mount only filesystems with option OPT (-a only)
-o OPT:
        loop            Ignored (loop devices are autodetected)
        [a]sync         Writes are [a]synchronous
        [no]atime       Disable/enable updates to inode access times
        [no]diratime    Disable/enable atime updates to directories
        [no]relatime    Disable/enable atime updates relative to modification time
        [no]dev         (Dis)allow use of special device files
        [no]exec        (Dis)allow use of executable files
        [no]suid        (Dis)allow set-user-id-root programs
        [r]shared       Convert [recursively] to a shared subtree
        [r]slave        Convert [recursively] to a slave subtree
        [r]private      Convert [recursively] to a private subtree
        [un]bindable    Make mount point [un]able to be bind mounted
        [r]bind         Bind a file or directory [recursively] to another location
        move            Relocate an existing mount point
        remount         Remount a mounted filesystem, changing flags
        ro              Same as -r

There are filesystem-specific -o flags.

im failed on step 3, btw thanks for your answers sir