[BPI-R64] loading OpenWRT built files into the board

@bourne_hlm How did you build openmptcprouter image?? I see that there is no official support for R64. Can you share what need to be modify there?

BTW I do have exactly same issue when I build latest OpenWRT (with kernel 5.4) and load into eMMC. I remember that I build it few months ago and load with exactly same steps and there was no issue. It was definitely 4.19 but do not know more details.

Ok I maneged to load latest Openwrt into R64 and start from eMMC.

Steps that I did:

  1. clone OpenWRT,
  2. change kernel to 4.19 in openwrt/target/linux/mediatek/makefile
  3. set target in make menuconfig 4 make defconfig (im not sure if that is needed)
  4. do kernel config as @bourne_hlm
"Device Drivers"-->"Memory Technology Device (MTD) support"-->"Command line partition table parsing"
"Device Drivers"-->"Memory Technology Device (MTD) support""Self-contained MTD device drivers"-->"MTD using block device"
"Device Drivers"-->"MMC/SD/SDIO card suport"->"MMC block device driver"
  1. add attached patch into openwrt/target/linux/mediatek/patches-4.19 1000-R64_OpenWRT_4_19_eMMC.patch (2.9 KB), it is modified patch @nagi fromhttp://forum.banana-pi.org/t/bpi-r64-mt7622-mac80211-wifi-driver/10246
  2. build and then use openwrt-mediatek-mt7622-bpi_bananapi-r64-squashfs-sysupgrade.bin with option 2 in u-boot.

I try to do the same without changing kernel to 4.19 and this patch 1000-R64_OpenWRT_5_4_eMMC.patch (1.9 KB) , but it do not mount rootfs and stuck on :

6 cmdlinepart partitions found on MTD device eMMC<\r> Creating 6 MTD partitions on “eMMC”:<\r> 0x000000000000-0x0000000c0000 : “preloader”<\r> 0x0000000c0000-0x000000140000 : “uboot”<\r> 0x000000140000-0x0000001c0000 : “uboot-env”<\r> 0x0000001c0000-0x000000200000 : “Factory”<\r> 0x000000200000-0x000004200000 : “firmware”<\r> 2 fit-fw partitions found on MTD device firmware<\r> 0x000000200000-0x0000004f0000 : “kernel”<\r> 0x0000004e71ec-0x000004200000 : “rootfs”<\r> mtd: device 6 (rootfs) set to be root filesystem<\r> 1 squashfs-split partitions found on MTD device rootfs<\r> 0x000000d50000-0x000004200000 : “rootfs_data”<\r> 0x000004200000-0x000084200000 : “usrdata”<\r> block2mtd: mtd0: [eMMC] erase_size = 64KiB [65536]<\r>

kernel is not hanging as I can see logs when I disconnect ethernet cable. It just not going forward. I try to trace where it stuck and as far as I go is to

int vfs_get_tree(struct fs_context *fc)

in linux/fs/super.c whitch is call by

static int do_new_mount(struct path *path, const char *fstype, int sb_flags, int mnt_flags, const char *name, void *data)

from linux/fs/namespace.c

The omr 0.53 have problem to build into R64, but 0.54.7 can build into R64. It’s the same steps in this post.

But in OMR there are no config files for R64 only for R2, do I have to manually create them?

I am too try compile OpenWrt by yourse instruction but I get error during compilation:

        Applying /home/osboxes/openwrt/target/linux/mediatek/patches-4.19/1000-R64_OpenWRT_4_19_eMMC.patch using plaintext: 
patching file arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
Hunk #1 FAILED at 16.
1 out of 3 hunks FAILED -- saving rejects to file arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts.rej
patching file arch/arm64/boot/dts/mediatek/mt7622-lynx-rfb1.dts
Hunk #1 succeeded at 549 with fuzz 2.
patching file arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
Hunk #1 succeeded at 549 with fuzz 2.
Patch failed!  Please fix /home/osboxes/openwrt/target/linux/mediatek/patches-4.19/1000-R64_OpenWRT_4_19_eMMC.patch!
make[4]: *** [Makefile:28: /home/osboxes/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.19.108/.prepared_11e8f7ae2a19576aff9cc35fd671fae0] Error 1
make[4]: Leaving directory '/home/osboxes/openwrt/target/linux/mediatek'
make[3]: *** [Makefile:13: compile] Error 2
make[3]: Leaving directory '/home/osboxes/openwrt/target/linux'
time: target/linux/compile#7.71#5.48#11.62
make[2]: *** [target/Makefile:25: target/linux/compile] Error 2
make[2]: Leaving directory '/home/osboxes/openwrt'
make[1]: *** [target/Makefile:18: /home/osboxes/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.target_compile] Error 2
make[1]: Leaving directory '/home/osboxes/openwrt'
make: *** [/home/osboxes/openwrt/include/toplevel.mk:220: world] Error 2

I am patching files manualy (in file target/linux/mediatek/files-4.19/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts) and its works.

it seems kernel 5.4 doesn’t have this option

"Device Drivers"-->"Memory Technology Device (MTD) support"-->"Command line partition table parsing"

Try make kernel_menuconfig,search for this option (/) and look at depencies…i guess there is one not set maybe it is renamed:

https://cateee.net/lkddb/web-lkddb/MTD_CMDLINE_PARTS.html

says 5.4+

looks like it is moved

  • <5.4 found in drivers/mtd/Kconfig
  • 5.4+ found in drivers/mtd/parsers/Kconfig

drivers/mtd/parsers is always included

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/mtd/Makefile?h=v5.4.32#n10

if CONFIG_MTD is set

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/Makefile?h=v5.4.32#n83

cmdline_parts depends only on mtd

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/mtd/parsers/Kconfig?h=v5.4.32#n23

looks similar on 4.19:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/mtd/Kconfig?h=v4.19.32#n75

Yep, it moved, it’s now located in

Symbol: MTD_CMDLINE_PARTS [=n]
Type : tristate
Prompt: Command line partition table parsing
Location: -> Device Drivers
-> Memory Technology Device (MTD) support (MTD [=y])
(1) -> Partition parsers

do you have it still in your config? strange that it does not apply

Yep, I had to re-enable it on my kernel 5.4 config, building now…

Here is a call log where kernel hangs, maybe it will help trace the problem:

[4.256655] 0x0000001c0000-0x000000200000 : "Factory"

[    4.262036] 0x000000200000-0x000004200000 : "firmware"

[    4.268648] 2 fit-fw partitions found on MTD device firmware

[    4.274334] 0x000000200000-0x0000004f0000 : "kernel"

[    4.279696] 0x0000004eb0b8-0x000004200000 : "rootfs"

[    4.285000] mtd: device 6 (rootfs) set to be root filesystem

[    4.290666] 1 squashfs-split partitions found on MTD device rootfs

[    4.296842] 0x000001850000-0x000004200000 : "rootfs_data"

[    4.302578] 0x000004200000-0x000084200000 : "usrdata"

[    4.307980] block2mtd: mtd0: [eMMC] erase_size = 64KiB [65536]

[    4.313844] rtc_mt7622 10212800.rtc: setting system clock to 2000-01-01T00:00:04 UTC (946684804)

[    4.781405] mt753x gsw@0: Port 1 Link is Up - 1Gbps/Full

[   62.481202] INFO: task swapper/0:1 blocked for more than 30 seconds.

[   62.481268] Bluetooth: hci0: Failed to load firmware file (-11)

[   62.487554]       Not tainted 5.4.33 #0

[   62.487556] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

[   62.505119] swapper/0       D    0     1      0 0x00000028

[   62.510600] Call trace:

[   62.513044]  __switch_to+0xbc/0x210

[   62.516532]  __schedule+0x26c/0x3c0

[   62.520018]  schedule+0x30/0xb0

[   62.523155]  io_schedule+0x18/0x38

[   62.526556]  do_read_cache_page+0x434/0x640

[   62.530736]  read_cache_page+0x10/0x18

[   62.534482]  block2mtd_read+0x80/0x150

[   62.538228]  part_read+0x34/0x80

[   62.541451]  mtd_read_oob+0xa0/0xb8

[   62.544929]  mtd_read+0x30/0x48

[   62.548067]  mtdblock_readsect+0x14c/0x160

[   62.552159]  mtd_queue_rq+0x318/0x4d0

[   62.555821]  __blk_mq_try_issue_directly+0x120/0x1a0

[   62.560781]  blk_mq_try_issue_directly+0x40/0xd0

[   62.565395]  blk_mq_make_request+0x390/0x3c0

[   62.569663]  generic_make_request+0x94/0x2b8

[   62.573929]  submit_bio+0x40/0x158

[   62.577328]  submit_bh_wbc+0x184/0x1d0

[   62.581066]  ll_rw_block+0x108/0x110

[   62.584641]  squashfs_read_data+0x280/0x558

[   62.588820]  squashfs_read_table+0xbc/0x150

[   62.592999]  squashfs_read_id_index_table+0x54/0x88

[   62.597873]  squashfs_fill_super+0x290/0x5b8

[   62.602141]  get_tree_bdev+0x17c/0x250

[   62.605886]  squashfs_get_tree+0x14/0x20

[   62.609805]  vfs_get_tree+0x24/0xb0

[   62.613292]  do_mount+0x50c/0x930

[   62.616597]  ksys_mount+0xdc/0xf8

[   62.619910]  do_mount_root+0x28/0x9c

[   62.623480]  mount_block_root+0x11c/0x280

[   62.627485]  mount_root+0xd8/0xe8

[   62.630796]  prepare_namespace+0x128/0x160

[   62.634887]  kernel_init_freeable+0x230/0x254

[   62.639240]  kernel_init+0x10/0xfc

[   62.642638]  ret_from_fork+0x10/0x18

[   62.646225] Kernel panic - not syncing: hung_task: blocked tasks

[   62.652223] SMP: stopping secondary CPUs

[   62.656136] Kernel Offset: disabled

[   62.659615] CPU features: 0x0002,20002000

[   62.663613] Memory Limit: none

[   62.666658] Rebooting in 1 seconds..

I did more tests. I put into emmc 5.4 image and then load initramfs with 4.19 intro RAM. With that I was able to

mount /dev/mtdblock6 /root2

But when I flash emmc with squashfs 4.19 and start intramfs from 5.4 build the same command hangs the same way as above.

That means that the issue is with kernel difference only not the image or process of openwrt image build.

OK, let me summarize information from this thread.

How to build OpenWRT for BPI-R64 and boot it from eMMC

Fetch latest OpenWRT sources:

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

Change kernel version in target/linux/mediatek/Makefile to 4.19 since eMMC is broken in 5.4:

KERNEL_PATCHVER:=4.19
KERNEL_TESTING_PATCHVER:=4.19

Add following lines to target/linux/mediatek/mt7622/config-4.19:

CONFIG_MMC_BLOCK=y
CONFIG_MTD_BLOCK2MTD=y
CONFIG_MTD_CMDLINE_PARTS=y

Copy 1000-add-factory-eeprom-and-emmc-mtd.patch (1.1 КБ) to target/linux/mediatek/patches-4.19 This patch:

  • Adds virtual MTD device (block2mtd) using cmdline which makes eMMC acting like MTD flashes, so OpenWRT can work correctly with eMMC
  • Specifies MTD partitions for block2mtd using cmdline (mtd0: mbr, mtd1: u-boot, mtd2: u-boot env, mtd3: calibration data, mtd4: openwrt firmware (up to 7GiB)
  • Enables wmac (internal WiFi) and tells driver to use mtd3 partition (mmcblk0p4 actually) as source for calibration data (make sure that it’s flashed there)

It’s assumed, that your /dev/mmcblk0p5 has size of 7G (7168 MiB) and it whole used as r/w rootfs (which maybe not a good idea). You can modify bootargs in patch “…7168M(firmware)”) for smaller rootfs size.

Configure OpenWRT

make menuconfig

At least, set following options:

Target System ---> MediaTek Ralink ARM
Subtarget ---> MT7622
Target Profile ---> Bpi Banana Pi R64

Build

make -j4

Result file: bin/targets/mediatek/mt7622/openwrt-mediatek-mt7622-bpi_bananapi-r64-squashfs-sysupgrade.bin, flash it using u-boot:

    2. System Load Linux Kernel then write to Flash via TFTP

Done.

Some time after boot OpenWRT will initialize root partition with JFFS2 filesystem:

root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.3M      3.3M         0 100% /rom
tmpfs                   499.2M    652.0K    498.6M   0% /tmp
tmpfs                   499.2M     52.0K    499.1M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock7            3.3G      9.0M      3.3G   0% /overlay
overlayfs:/overlay        3.3G      9.0M      3.3G   0% /

Dunno, why there is only 3.3G of 7G, maybe some limits of JFFS2 or OpenWRT

Maybe that will helps somebody.

2 Likes

Hi. I have followed this thread and in particular the useful summary posted by @Kosyak I have one question:

Do I need to do anything specific to “make sure that calibration data is flashed in mtd3 partition”?

I managed to compile and get running OpenWRT with 5.4 kernel following @kosyak’s instructions. As @DanielRiot mentioned MTD_CMDLINE_PARTS was moved in kernel 5.4.

However I’m struggling to solve these issues:

  1. How to get an RW filesystem and make changes to survive reboot. My df output is as follows, no eMMC storage is mounted:
root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   497.8M     68.0K    497.7M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
  1. How to get 5GHz WiFi module MT7615 working. I compiled the kernel with kmod-mt7615e module. However (a) kernel boot log ends with this output.
[   31.769783] mt7615e 0000:01:00.0: Message -4294967280 (seq 1) timeout
[   31.776237] mt7615e 0000:01:00.0: Failed to get patch semaphore

(b) iw phy command shows that I have two WiFi cards installed

root@OpenWrt:# iw phy
Wiphy phy1
    max # scan SSIDs: 4
    max scan IEs length: 2304 bytes
    max # sched scan SSIDs: 0
    max # match sets: 0
    max # scan plans: 1
    max scan plan interval: 0
    max scan plan iterations: 0
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports T-DLS.
    Available Antennas: TX 0xf RX 0xf
    Configured Antennas: TX 0xf RX 0xf
    Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
             * mesh point
    Band 1:
            Capabilities: 0x1ff
                    RX LDPC
                    HT20/HT40
                    SM Power Save disabled
                    RX Greenfield
                    RX HT20 SGI
                    RX HT40 SGI
                    TX STBC
                    RX STBC 1-stream
                    Max AMSDU length: 3839 bytes
                    No DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: No restriction (0x00)
            HT TX/RX MCS rate indexes supported: 0-31
            Frequencies:
                    * 2412 MHz [1] (6.0 dBm)
                    * 2417 MHz [2] (6.0 dBm)
                    * 2422 MHz [3] (6.0 dBm)
                    * 2427 MHz [4] (6.0 dBm)
                    * 2432 MHz [5] (6.0 dBm)
                    * 2437 MHz [6] (6.0 dBm)
                    * 2442 MHz [7] (6.0 dBm)
                    * 2447 MHz [8] (6.0 dBm)
                    * 2452 MHz [9] (6.0 dBm)
                    * 2457 MHz [10] (6.0 dBm)
                    * 2462 MHz [11] (6.0 dBm)
                    * 2467 MHz [12] (6.0 dBm) (no IR)
                    * 2472 MHz [13] (6.0 dBm) (no IR)
                    * 2484 MHz [14] (6.0 dBm) (no IR)
    valid interface combinations:
             * #{ IBSS } <= 1, #{ managed, AP, mesh point } <= 4,
               total <= 4, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 }

    HT Capability overrides:
             * MCS: ff ff ff ff ff ff ff ff ff ff
             * maximum A-MSDU length
             * supported channel width
             * short GI for 40 MHz
             * max A-MPDU length exponent
             * min MPDU start spacing
    Supported extended features:
            * [ VHT_IBSS ]: VHT-IBSS
            * [ RRM ]: RRM
            * [ SET_SCAN_DWELL ]: scan dwell setting
            * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
            * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
            * [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
            * [ AIRTIME_FAIRNESS ]: airtime fairness scheduling
Wiphy phy0
    max # scan SSIDs: 4
    max scan IEs length: 539 bytes
    max # sched scan SSIDs: 10
    max # match sets: 16
    max # scan plans: 1
    max scan plan interval: 10
    max scan plan iterations: 0
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports T-DLS.
    Available Antennas: TX 0xf RX 0xf
    Configured Antennas: TX 0xf RX 0xf
    Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
             * mesh point
    Band 1:
            Capabilities: 0x1ff
                    RX LDPC
                    HT20/HT40
                    SM Power Save disabled
                    RX Greenfield
                    RX HT20 SGI
                    RX HT40 SGI
                    TX STBC
                    RX STBC 1-stream
                    Max AMSDU length: 3839 bytes
                    No DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: No restriction (0x00)
            HT TX/RX MCS rate indexes supported: 0-31
            Frequencies:
                    * 2412 MHz [1] (6.0 dBm)
                    * 2417 MHz [2] (6.0 dBm)
                    * 2422 MHz [3] (6.0 dBm)
                    * 2427 MHz [4] (6.0 dBm)
                    * 2432 MHz [5] (6.0 dBm)
                    * 2437 MHz [6] (6.0 dBm)
                    * 2442 MHz [7] (6.0 dBm)
                    * 2447 MHz [8] (6.0 dBm)
                    * 2452 MHz [9] (6.0 dBm)
                    * 2457 MHz [10] (6.0 dBm)
                    * 2462 MHz [11] (6.0 dBm)
                    * 2467 MHz [12] (6.0 dBm) (no IR)
                    * 2472 MHz [13] (6.0 dBm) (no IR)
                    * 2484 MHz [14] (6.0 dBm) (no IR)
    Band 2:
            Capabilities: 0x1ff
                    RX LDPC
                    HT20/HT40
                    SM Power Save disabled
                    RX Greenfield
                    RX HT20 SGI
                    RX HT40 SGI
                    TX STBC
                    RX STBC 1-stream
                    Max AMSDU length: 3839 bytes
                    No DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: No restriction (0x00)
            HT TX/RX MCS rate indexes supported: 0-31
            VHT Capabilities (0x338001fa):
                    Max MPDU length: 11454
                    Supported Channel Width: 160 MHz, 80+80 MHz
                    RX LDPC
                    short GI (80 MHz)
                    short GI (160/80+80 MHz)
                    TX STBC
                    RX antenna pattern consistency
                    TX antenna pattern consistency
            VHT RX MCS set:
                    1 streams: MCS 0-9
                    2 streams: MCS 0-9
                    3 streams: MCS 0-9
                    4 streams: MCS 0-9
                    5 streams: not supported
                    6 streams: not supported
                    7 streams: not supported
                    8 streams: not supported
            VHT RX highest supported: 0 Mbps
            VHT TX MCS set:
                    1 streams: MCS 0-9
                    2 streams: MCS 0-9
                    3 streams: MCS 0-9
                    4 streams: MCS 0-9
                    5 streams: not supported
                    6 streams: not supported
                    7 streams: not supported
                    8 streams: not supported
            VHT TX highest supported: 0 Mbps
            Frequencies:
                    * 5180 MHz [36] (6.0 dBm)
                    * 5200 MHz [40] (6.0 dBm)
                    * 5220 MHz [44] (6.0 dBm)
                    * 5240 MHz [48] (6.0 dBm)
                    * 5260 MHz [52] (6.0 dBm) (no IR, radar detection)
                    * 5280 MHz [56] (6.0 dBm) (no IR, radar detection)
                    * 5300 MHz [60] (6.0 dBm) (no IR, radar detection)
                    * 5320 MHz [64] (6.0 dBm) (no IR, radar detection)
                    * 5500 MHz [100] (6.0 dBm) (no IR, radar detection)
                    * 5520 MHz [104] (6.0 dBm) (no IR, radar detection)
                    * 5540 MHz [108] (6.0 dBm) (no IR, radar detection)
                    * 5560 MHz [112] (6.0 dBm) (no IR, radar detection)
                    * 5580 MHz [116] (6.0 dBm) (no IR, radar detection)
                    * 5600 MHz [120] (6.0 dBm) (no IR, radar detection)
                    * 5620 MHz [124] (6.0 dBm) (no IR, radar detection)
                    * 5640 MHz [128] (6.0 dBm) (no IR, radar detection)
                    * 5660 MHz [132] (6.0 dBm) (no IR, radar detection)
                    * 5680 MHz [136] (6.0 dBm) (no IR, radar detection)
                    * 5700 MHz [140] (6.0 dBm) (no IR, radar detection)
                    * 5745 MHz [149] (6.0 dBm) (no IR)
                    * 5765 MHz [153] (6.0 dBm) (no IR)
                    * 5785 MHz [157] (6.0 dBm) (no IR)
                    * 5805 MHz [161] (6.0 dBm) (no IR)
                    * 5825 MHz [165] (6.0 dBm) (no IR)
    valid interface combinations:
             * #{ IBSS } <= 1, #{ managed, AP, mesh point } <= 4,
               total <= 4, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 }

    HT Capability overrides:
             * MCS: ff ff ff ff ff ff ff ff ff ff
             * maximum A-MSDU length
             * supported channel width
             * short GI for 40 MHz
             * max A-MPDU length exponent
             * min MPDU start spacing
    Supported extended features:
            * [ VHT_IBSS ]: VHT-IBSS
            * [ RRM ]: RRM
            * [ SET_SCAN_DWELL ]: scan dwell setting
            * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
            * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
            * [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
            * [ AIRTIME_FAIRNESS ]: airtime fairness scheduling

iw dev also shows two wireless devices present:

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 5
                wdev 0x100000001
                addr 32:77:40:57:eb:91
                type managed
                txpower 6.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0
phy#0
        Interface wlan0
                ifindex 4
                wdev 0x1
                addr 76:1d:f7:5a:e5:75
                type managed
                txpower 6.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0

But iw scan works only for embedded 2.4GHz WiFi module and not for 5GHz PCI card.

root@OpenWrt:/# iw dev wlan0 scan
command failed: Network is down (-100)

root@OpenWrt:/# iw dev wlan1 scan
BSS 78:81:02:f5:1d:3a(on wlan1)
        TSF: 3303131239365 usec (38d, 05:32:11)
        freq: 2412
        beacon interval: 100 TUs
        capability: ESS (0x0411)
        signal: -80.00 dBm
        last seen: 1036 ms ago
        SSID: MGTS_GPON_6241
        RSN:     * Version: 1
                 * Group cipher: CCMP
                 * Pairwise ciphers: CCMP
                 * Authentication suites: PSK
                 * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
        HT capabilities:
                Capabilities: 0x8bc
                        HT20
                        SM Power Save disabled
                        RX Greenfield
                        RX HT20 SGI
                        TX STBC
                        No RX STBC
                        Max AMSDU length: 7935 bytes
                        No DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 8 usec (0x06)
                HT RX MCS rate indexes supported: 0-15
                HT TX MCS rate indexes are undefined
        HT operation:
                 * primary channel: 1
                 * secondary channel offset: no secondary
                 * STA channel width: 20 MHz

Could you try mounting emmc manually? We experiencing issues with bpi-r64 emmc (if uboot also supports emmc)

If I’m doing this right, I can’t.

root@OpenWrt:/# /dev/mmcblk
mmcblk0       mmcblk0p2     mmcblk0rpmb   mmcblk1p3
mmcblk0boot0  mmcblk0p3     mmcblk1       mmcblk1p4
mmcblk0boot1  mmcblk0p4     mmcblk1p1     mmcblk1p5
mmcblk0p1     mmcblk0p5     mmcblk1p2     mmcblk1p6

root@OpenWrt:/# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 000c0000 00010000 "preloader"
mtd1: 00080000 00010000 "uboot"
mtd2: 00080000 00010000 "uboot-env"
mtd3: 00040000 00010000 "Factory"
mtd4: 04000000 00010000 "firmware"
mtd5: 80000000 00010000 "usrdata"

root@OpenWrt:/# mount /dev/mmcblk0p5 /mnt
[ 6389.584073] /dev/mmcblk0p5: Can't open blockdev
mount: mounting /dev/mmcblk0p5 on /mnt failed: Resource busy

It appears that I flashed openwrt-mediatek-mt7622-bpi_bananapi-r64-initramfs-kernel.bin instead of openwrt-mediatek-mt7622-bpi_bananapi-r64-squashfs-sysupgrade.bin.

But now after flashing squashfs-sysupgrade image I get a kernel panic on boot:

[    4.267963] 6 cmdlinepart partitions found on MTD device eMMC
[    4.273710] Creating 6 MTD partitions on "eMMC":
[    4.278326] 0x000000000000-0x0000000c0000 : "preloader"
[    4.283966] 0x0000000c0000-0x000000140000 : "uboot"
[    4.289183] 0x000000140000-0x0000001c0000 : "uboot-env"
[    4.294741] 0x0000001c0000-0x000000200000 : "Factory"
[    4.300109] 0x000000200000-0x000004200000 : "firmware"
[    4.315795] random: fast init done
[    4.479770] no rootfs found after FIT image in "firmware"
[    4.485203] 0x000004200000-0x000084200000 : "usrdata"
[    4.490765] block2mtd: mtd0: [eMMC] erase_size = 64KiB [65536]
[    4.496633] rtc_mt7622 10212800.rtc: setting system clock to 2000-01-01T00:03:13 UTC (946684993)
[    4.506224] /dev/root: Can't open blockdev
[    4.510450] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    4.518705] SMP: stopping secondary CPUs
[    4.522619] Kernel Offset: disabled
[    4.526098] CPU features: 0x0002,20002000
[    4.530096] Memory Limit: none
[    4.533143] Rebooting in 1 seconds..

How should I create rootfs after firmware?

try and change your uBoot variables ( if your Kernel/ rootfs is too big, not everything is written ) allow a larger kernel/rootfs image : ie, run this in your uboor console and then ‘saveenv’

setenv boot_wr_img 'filesize_check 0x20000000;if test ${filesize_result} = good; then image_blks 512 ${filesize};mmc device 0;mmc write ${loadaddr} 0x1000 ${filesize};fi'

The default setting is only 25MB i think( 0x1900000 ) boot_wr_img=filesize_check .... mmc write ${loadaddr} 0x1000 0x1900000 ;fi'