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

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.

1 Like

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'

Hello guys. I’m back at trying to boot from SD card but am presumably stuck at rootfs mount.

  1. I’ve compiled latest OpenWRT master branch with 5.4 kernel.
  2. Enabled MTD_BLOCK2MTD, MMC_BLOCK and MTD_CMDLINE_PARTS.
  3. Applied patches to include &wmac node and to support MTD partitions. Basically I copied the chosen node from LEDE’s mt7622-bananapi-bpi-r64-sd.dts
  4. I took preloader, ATF, U-Boot from BPI’s repository. Created SD card with partition layout as described in BPI’s LEDE image.

Still I’m stuck at this. No further loading, no login prompt. Any help?

## Loading kernel from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM64 OpenWrt Linux-5.4.46
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x40080010
     Data Size:    3189096 Bytes = 3 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x41080000
     Entry Point:  0x41080000
     Hash algo:    crc32
     Hash value:   3745977a
     Hash algo:    sha1
     Hash value:   0fd3ca46fcdeaa571ed1d31f018dbf4639516d56
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  ARM64 OpenWrt bpi_bananapi-r64 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x4038aab8
     Data Size:    25382 Bytes = 24.8 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   489c39d3
     Hash algo:    sha1
     Hash value:   b97bdb8ab0b7bcb1ec9d4cbb23633a3ac78b0508
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x4038aab8
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 6bff6000, end 6bfff325 ... OK

Starting kernel ...

[ATF][    22.329595]save kernel info
[ATF][    22.332797]Kernel_EL2
[ATF][    22.335553]Kernel is 64Bit
[ATF][    22.338741]pc=0x41080000, r0=0x6bff6000, r1=0x0
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel
INFO:    BL3-1: Next image address = 0x41080000
INFO:    BL3-1: Next image spsr = 0x3c9
[ATF][    22.357008]el3_exit
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.4.46 (parallels@ubuntu-18.04) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r13601-d93da0d016)) #0 SMP Sat Jun 20 11:03:39 2020
[    0.000000] Machine model: Bananapi BPI-R64
[    0.000000] earlycon: uart8250 at MMIO32 0x0000000011002000 (options '')
[    0.000000] printk: bootconsole [uart8250] enabled
[    0.000000] On node 0 totalpages: 262096
[    0.000000]   DMA32 zone: 4096 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 262096 pages, LIFO batch:63
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv0.2 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] percpu: Embedded 20 pages/cpu s43608 r8192 d30120 u81920
[    0.000000] pcpu-alloc: s43608 r8192 d30120 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258000
[    0.000000] Kernel command line: earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1          initrd=0x44000000,0x615E36 loglevel=8 androidboot.hardware=mt7622 swiotlb=512   earlyprintk block2
mtd.block2mtd=/dev/mmcblk1,65536,SD,5 mtdparts=SD:768k(mbr)ro,512k(uboot)ro,512k(Config)ro,256k(Factory)ro,32M(Kernel),32M(recovery),1024M(rootfs),2048M(usrdata),-(bmtpool) rootfstype=squashfs,ext4 
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1012308K/1048384K available (6526K kernel code, 356K rwdata, 1876K rodata, 448K init, 281K bss, 36076K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     CONFIG_RCU_FANOUT set to non-default value of 32.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set
[    0.000000] random: get_random_bytes called from start_kernel+0x2d4/0x430 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 12.50MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2e2049cda, max_idle_ns: 440795202628 ns
[    0.000003] sched_clock: 56 bits at 12MHz, resolution 80ns, wraps every 4398046511080ns
[    0.008489] Calibrating delay loop (skipped), value calculated using timer frequency.. 25.00 BogoMIPS (lpj=50000)
[    0.019127] pid_max: default: 32768 minimum: 301
[    0.023991] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.031662] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.040651] ASID allocator initialised with 65536 entries
[    0.046302] rcu: Hierarchical SRCU implementation.
[    0.051550] smp: Bringing up secondary CPUs ...
[    0.056572] Detected VIPT I-cache on CPU1
[    0.056607] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.056661] smp: Brought up 1 node, 2 CPUs
[    0.071815] SMP: Total of 2 processors activated.
[    0.076686] CPU features: detected: 32-bit EL0 Support
[    0.082008] CPU features: detected: CRC32 instructions
[    0.087425] CPU: All CPU(s) started at EL2
[    0.091672] alternatives: patching kernel code
[    0.099486] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.109602] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.116723] pinctrl core: initialized pinctrl subsystem
[    0.122630] NET: Registered protocol family 16
[    0.127449] DMA: preallocated 256 KiB pool for atomic allocations
[    0.144689] GPIO line 499 (asm_sel) hogged as output/high
[    0.162349] SCSI subsystem initialized
[    0.166415] libata version 3.00 loaded.
[    0.170538] usbcore: registered new interface driver usbfs
[    0.176361] usbcore: registered new interface driver hub
[    0.181900] usbcore: registered new device driver usb
[    0.187887] Bluetooth: Core ver 2.22
[    0.191622] NET: Registered protocol family 31
[    0.196223] Bluetooth: HCI device and connection manager initialized
[    0.202808] Bluetooth: HCI socket layer initialized
[    0.207858] Bluetooth: L2CAP socket layer initialized
[    0.213094] Bluetooth: SCO socket layer initialized
[    0.218703] clocksource: Switched to clocksource arch_sys_counter
[    0.225526] thermal_sys: Registered thermal governor 'fair_share'
[    0.225528] thermal_sys: Registered thermal governor 'bang_bang'
[    0.231858] thermal_sys: Registered thermal governor 'step_wise'
[    0.238081] thermal_sys: Registered thermal governor 'user_space'
[    0.244303] thermal_sys: Registered thermal governor 'power_allocator'
[    0.250869] NET: Registered protocol family 2
[    0.262404] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[    0.271074] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.279145] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.286729] TCP: Hash tables configured (established 8192 bind 8192)
[    0.293395] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.300266] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.307661] NET: Registered protocol family 1
[    0.312189] PCI: CLS 0 bytes, default 64
[    0.316376] Unpacking initramfs...
[    0.319948] Initramfs unpacking failed: invalid magic at start of compressed archive
[    0.330874] Freeing initrd memory: 6228K
[    0.335601] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[    0.345667] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.351735] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.373525] mtk-tphy 1a0c4000.usb-phy: failed to get ref_clk(id-1)
[    0.383154] mt-pmic-pwrap 10001000.pwrap: unexpected interrupt int=0x1
[    0.403974] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.411225] printk: console [ttyS0] disabled
[    0.436048] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 118, base_baud = 1562500) is a ST16650V2
[    0.445613] printk: console [ttyS0] enabled
[    0.445613] printk: console [ttyS0] enabled
[    0.453980] printk: bootconsole [uart8250] disabled
[    0.453980] printk: bootconsole [uart8250] disabled
[    0.484398] 11004000.serial: ttyS1 at MMIO 0x11004000 (irq = 119, base_baud = 1562500) is a ST16650V2
[    0.494085] 1100c000.serial: ttyS2 at MMIO 0x1100c000 (irq = 125, base_baud = 17499995) is a MediaTek BTIF
[    0.503822] serial serial0: tty port ttyS2 registered
[    0.509096] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.516664] libphy: Fixed MDIO Bus: probed
[    0.544024] libphy: mdio: probed
[    0.547449] mtk_soc_eth 1b100000.ethernet: generated random MAC address 72:09:6b:47:a0:76
[    0.555899] mtk_soc_eth 1b100000.ethernet eth0: mediatek frame engine at 0xffffffc011380000, irq 134
[    0.565053] mtk_soc_eth 1b100000.ethernet: generated random MAC address fe:7a:a7:d0:3b:09
[    0.573428] mtk_soc_eth 1b100000.ethernet eth1: mediatek frame engine at 0xffffffc011380000, irq 134
[    0.583504] rtc_mt7622 10212800.rtc: registered as rtc0
[    0.589018] mtk-thermal 1100b000.thermal: Device not calibrated, using default calibration values
[    0.598219] mtk-wdt 10212000.watchdog: Watchdog enabled (timeout=31 sec, nowayout=0)
[    0.606057] Bluetooth: HCI UART driver ver 2.3
[    0.610501] Bluetooth: HCI UART protocol H4 registered
[    0.615634] Bluetooth: HCI UART protocol BCSP registered
[    0.621002] Bluetooth: HCI UART protocol Broadcom registered
[    0.626673] Bluetooth: HCI UART protocol QCA registered
[    0.658764] mtk-msdc 11240000.mmc: Got CD GPIO
[    0.688758] NET: Registered protocol family 10
[    0.693813] Segment Routing with IPv6
[    0.697525] NET: Registered protocol family 17
[    0.702049] 8021q: 802.1Q VLAN Support v1.8
[    0.717492] mtk-pcie 1a143000.pcie: host bridge /pcie@1a143000 ranges:
[    0.724064] mtk-pcie 1a143000.pcie: Parsing ranges property...
[    0.729907] mtk-pcie 1a143000.pcie:   MEM 0x20000000..0x27ffffff -> 0x20000000
[    0.755299] mtk-msdc 11230000.mmc: phase: [map:1fffffff] [maxlen:29] [final:9]
[    0.761571] mtk-pcie 1a143000.pcie: PCI host bridge to bus 0000:00
[    0.768725] mmc1: host does not support reading read-only switch, assuming write-enable
[    0.776762] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.782258] mmc0: new HS200 MMC card at address 0001
[    0.782261] pci_bus 0000:00: root bus resource [mem 0x20000000-0x27ffffff]
[    0.782265] pci_bus 0000:00: scanning bus
[    0.788411] mmcblk0: mmc0:0001 008G30 7.28 GiB 
[    0.794190] pci 0000:00:00.0: [14c3:3258] type 01 class 0x060400
[    0.799001] mmcblk0boot0: mmc0:0001 008G30 partition 1 4.00 MiB
[    0.802785] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.809519] mmcblk0boot1: mmc0:0001 008G30 partition 2 4.00 MiB
[    0.816482] pci_bus 0000:00: fixups for bus
[    0.821885] mmcblk0rpmb: mmc0:0001 008G30 partition 3 4.00 MiB, chardev (250:0)
[    0.827760] pci 0000:00:00.0: scanning [bus 00-00] behind bridge, pass 0
[    0.832119] mmc1: new high speed SDHC card at address aaaa
[    0.839233] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.839259] pci 0000:00:00.0: scanning [bus 00-00] behind bridge, pass 1
[    0.847290] mmcblk1: mmc1:aaaa SL16G 14.8 GiB 
[    0.851601] pci_bus 0000:01: scanning bus
[    0.874742] pci 0000:01:00.0: [14c3:7615] type 00 class 0x000280
[    0.880981] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[    0.888707] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:00.0 (capable of 4.000 Gb/s with 5 GT/s x1 link)
[    0.904011] pci_bus 0000:01: fixups for bus
[    0.908194] pci_bus 0000:01: bus scan returning with max=01
[    0.913765] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.920390] pci_bus 0000:00: bus scan returning with max=01
[    0.925975] pci 0000:00:00.0: BAR 0: no space for [mem size 0x200000000 64bit pref]
[    0.933628] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x200000000 64bit pref]
[    0.941629] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.948417] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.955811] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.960788] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.967823] mtk-pcie 1a145000.pcie: host bridge /pcie@1a145000 ranges:
[    0.974354] mtk-pcie 1a145000.pcie: Parsing ranges property...
[    0.980190] mtk-pcie 1a145000.pcie:   MEM 0x28000000..0x2fffffff -> 0x28000000
[    0.987698]  mmcblk0: p1 p2
[    0.993355] GPT:Primary header thinks Alt. header is not at the end of the disk.
[    1.000762] GPT:1 != 31116287
[    1.003725] GPT:Alternate GPT header not at the end of the disk.
[    1.009726] GPT:1 != 31116287
[    1.012687] GPT: Use GNU Parted to correct GPT errors.
[    1.017844]  mmcblk1: p1 p2 p3 p4 p5 p6
[    1.087560] mtk-pcie 1a145000.pcie: Port1 link down
[    1.092568] mtk-pcie 1a145000.pcie: PCI host bridge to bus 0001:00
[    1.098752] pci_bus 0001:00: root bus resource [bus 00-ff]
[    1.104237] pci_bus 0001:00: root bus resource [mem 0x28000000-0x2fffffff]
[    1.111109] pci_bus 0001:00: scanning bus
[    1.116458] pci_bus 0001:00: fixups for bus
[    1.120641] pci_bus 0001:00: bus scan returning with max=00
[    1.126373] mtk_hsdma 1b007000.dma-controller: Using 3 as missing dma-requests property
[    1.134579] mtk_hsdma 1b007000.dma-controller: MediaTek HSDMA driver registered
[    1.179177] libphy: dsa slave smi: probed
[    1.184611] mt7530 mdio-bus:00 wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    1.194546] mt7530 mdio-bus:00 lan0 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    1.204551] mt7530 mdio-bus:00 lan1 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    1.214524] mt7530 mdio-bus:00 lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    1.224473] mt7530 mdio-bus:00 lan3 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[    1.233694] mt7530 mdio-bus:00: configuring for fixed/2500base-x link mode
[    1.247583] mt7530 mdio-bus:00: Link is Up - 2.5Gbps/Full - flow control rx/tx
[    1.248514] DSA: tree 0 setup
[    1.258250] xhci-mtk 1a0c0000.usb: xHCI Host Controller
[    1.263487] xhci-mtk 1a0c0000.usb: new USB bus registered, assigned bus number 1
[    1.272554] xhci-mtk 1a0c0000.usb: hcc params 0x01403198 hci version 0x96 quirks 0x0000000000210010
[    1.281632] xhci-mtk 1a0c0000.usb: irq 130, io mem 0x1a0c0000
[    1.287806] hub 1-0:1.0: USB hub found
[    1.291574] hub 1-0:1.0: 2 ports detected
[    1.295806] xhci-mtk 1a0c0000.usb: xHCI Host Controller
[    1.301037] xhci-mtk 1a0c0000.usb: new USB bus registered, assigned bus number 2
[    1.308435] xhci-mtk 1a0c0000.usb: Host supports USB 3.0 SuperSpeed
[    1.314731] usb usb2: We don t know the algorithms for LPM for this host, disabling LPM.
[    1.323055] hub 2-0:1.0: USB hub found
[    1.326816] hub 2-0:1.0: 1 port detected
[    1.331120] 9 cmdlinepart partitions found on MTD device SD
[    1.336691] Creating 9 MTD partitions on "SD":
[    1.341134] 0x000000000000-0x0000000c0000 : "mbr"
[    1.346288] 0x0000000c0000-0x000000140000 : "uboot"
[    1.351519] 0x000000140000-0x0000001c0000 : "Config"
[    1.356844] 0x0000001c0000-0x000000200000 : "Factory"
[    1.362239] 0x000000200000-0x000002200000 : "Kernel"
[    1.367550] 0x000002200000-0x000004200000 : "recovery"
[    1.373048] 0x000004200000-0x000044200000 : "rootfs"
[    1.378391] mtd: device 6 (rootfs) set to be root filesystem
[    1.388563] 1 squashfs-split partitions found on MTD device rootfs
[    1.394846] 0x000004530000-0x000044200000 : "rootfs_data"
[    1.400671] 0x000044200000-0x0000c4200000 : "usrdata"
[    1.406091] 0x0000c4200000-0x0003b5980000 : "bmtpool"
[    1.411494] block2mtd: mtd0: [SD] erase_size = 64KiB [65536]
[    1.417184] rtc_mt7622 10212800.rtc: setting system clock to 2000-01-01T00:00:01 UTC (946684801)

Openwrt has problems with kernel 5.4 on mounting mtd rootfs…there is no solution yet

That output means that I don’t get rootfs mounted?

In any thread the problem was found without clear error-message…you can try to copy data from rootfs to another media (without mtd,e.g. simple ext4 partition) and change cmdline (root=/dev/xxx) pointing to it