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

I stuck on a loading compiled OpenWRT files into the board. Reading threads this forum just don’t realize how to do it.

How to load kernel and squashfs rootfs files into the board?

What I have already done:

  1. cloned OpenWRT project (openmptcprouter),
  2. set parametres via “make menuconfig” Target System (MediaTek Ralink ARM) Subtarget (MT7622) Target Profile (Banana Pi R64)
  3. built project by (make)

So I have got files:

ls bin/targets/mediatek/mt7622/


ls build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/


Using instructions from this thread:

I have managed to load the kernel (file BPI-R64-kernel.bin from my previous post) into the emmc. Just loaded it by “SD card image” from the thread above. But now I get this error for a while loading my kernel:

[   17.223731] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[   17.231463] Please append a correct "root=" boot option; here are the available partitions:
[   17.240101] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   17.248622] SMP: stopping secondary CPUs
[   17.252661] Kernel Offset: disabled
[   17.256252] CPU features: 0x0,20002000
[   17.260111] Memory Limit: none
[   17.263255] Rebooting in 1 seconds..

So I guess the kernel need root file system that I have got it in file root.squashfs.

How can I do it? How the all build files OpenWRT’s project can be load into the emmc?

looks you have forgotten root= option in your kernels cmdline…as second line suggests…but i don’t know how to specify squashfs (and maybe underlying ro-rootfs)

Yes, @frank-w, you quite right! A “root” option has to be set. But I don’t understand what this “option” have to has and how to put into the board the thing the “option” will point. User @rainfall83 started the thread:

and leave there emmc image file link at Google Drive. As he said the file contains all components need to boot LEDE (OpenWRT) at bpi-r64 successfully: But I completely confused. I do not understand how to put together all compiled OpenWRT files into a single image that can be flashed to the emmc at the board…

We making first steps with emmc on r64 so please wait a bit for this and try sdcard instead. The root option needs to be set in uboot (buildin/uenv.txt) or kernel (force cmdline).

This depends on how openwrt-image for r64 is build (how rootfs is defined). Maybe other users can explain this because my knowledge about openwrt is very limited

I also have problem to burn OpenWRT (OpenMPTCProuter) kernel image into R64 EMMC.

I follow these steps:

  1. Use SD card downloader to write SD card image into SD card.
  2. Insert the written-image SD card into bpi-r64 board, and power on it.
  3. In U-Boot Menu, choose ‘ (2). System Load Linux Kernel then write to Flash via TFTP.’ to download openmptcprouter-**-mt7622-BPI-R64-initramfs-kernel.bin and write it to eMMC.
  4. In U-Boot Menu, choose ‘ 7. System Load Preloader then write to Flash via TFTP ’ to download eMMC preloader and write it to eMMC.
  5. After eMMC preloader is written to eMMC, power off bpi-r64 board, remove SD card, and power on it.

After do that, it have problem to boot, following errors:

mmc0 is current device
mmc0 operation
dev_num = 0

MMC read: dev # 0, block # 4096, count 1 ... 1 blocks read: OK
[do_read_image_blks] This is a FIT image,img_size = 0x1b6a3ec
mmc0 operation
dev_num = 0

MMC read: dev # 0, block # 4096, count 56146 ... 56146 blocks read: OK
bootm flag=0, states=70f
## Loading kernel from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM64 OpenWrt Linux-4.19.72
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x40080010
     Data Size:    28721781 Bytes = 27.4 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x41080000
     Entry Point:  0x41080000
     Hash algo:    crc32
     Hash value:   7c909f83
     Hash algo:    sha1
     Hash value:   2691ade7c88ca3c820c2cfae5a23ec58b131a9b1
   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-R64 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x41be43c0
     Data Size:    23070 Bytes = 22.5 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   6f50902d
     Hash algo:    sha1
     Hash value:   a45cf7ff90b8c1baa5e7680293643f6d156ddda2
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x41be43c0
   Uncompressing Kernel Image ... LZMA: uncompress or overwrite error 1 - must RESET board to recover
resetting ...
mtk_arch_reset at pre-loader!

Here is printenv

    MT7622> printenv
    boot0=download_setting kernel;tftpboot ${loadaddr} ${kernel_filename}; bootm
    boot1=download_setting kernel;tftpboot ${loadaddr} ${kernel_filename};run boot_wr_img;run boot_rd_img;bootm
    boot10=download_setting flashimage;tftpboot ${loadaddr} ${flashimage_filename};run wr_flashimage;invaild_env
    boot11=download_setting gpt;tftpboot ${loadaddr} ${gpt_filename};run wr_gpt
    boot2=run boot_rd_img;bootm
    boot3=download_setting uboot;tftpboot ${loadaddr} ${uboot_filename};run wr_uboot;invaild_env
    boot4=loadb;run wr_uboot;invaild_env
    boot5=download_setting atf;tftpboot ${loadaddr} ${atf_filename};run wr_atf
    boot6=download_setting preloader;tftpboot ${loadaddr} ${preloader_filename};run wr_pl
    boot7=download_setting hdr;tftpboot ${loadaddr} ${hdr_filename};run wr_rom_hdr
    boot8=download_setting ctp;tftpboot ${loadaddr} ${ctp_filename};run wr_ctp
    boot9=run boot_rd_ctp;boot_to_ctp
    boot_rd_ctp=mmc device 0;mmc read ${loadaddr} 0x1000 0xa000
    boot_rd_img=mmc device 0;mmc read ${loadaddr} 0x1000 1;image_blks 512;mmc read ${loadaddr} 0x1000 ${img_blks}
    boot_wr_img=filesize_check 0x1E00000;if test ${filesize_result} = good; then image_blks 512  ${filesize};mmc device 0;mmc write ${loadaddr} 0x1000 0x18000;fi
    bootmenu_0=1. System Load Linux to SDRAM via TFTP.=run boot0
    bootmenu_1=2. System Load Linux Kernel then write to Flash via TFTP.=run boot1
    bootmenu_10=b. System Load flashimage then write to Flash via TFTP.=run boot10
    bootmenu_11=c. System Load partition table then write to Flash via TFTP.=run boot11
    bootmenu_2=3. Boot system code via Flash.=run boot2
    bootmenu_3=4. System Load U-Boot then write to Flash via TFTP.=run boot3
    bootmenu_4=5. System Load U-Boot then write to Flash via Serial.=run boot4
    bootmenu_5=6. System Load ATF then write to Flash via TFTP.=run boot5
    bootmenu_6=7. System Load Preloader then write to Flash via TFTP.=run boot6
    bootmenu_7=8. System Load ROM header then write to Flash via TFTP.=run boot7
    bootmenu_8=9. System Load CTP then write to Flash via TFTP.=run boot8
    bootmenu_9=a. System Load CTP then Boot to CTP (via Flash).=run boot9
    wr_atf=filesize_check 0x40000;if test ${filesize_result} = good; then mmc device 0;mmc write ${loadaddr} 0x400 0x200;fi
    wr_ctp=filesize_check 0x1400000;if test ${filesize_result} = good; then ctp_check;if test ${ctp_result} = good; then mmc device 0;mmc write ${loadaddr} 0x1000 0xa000;reset; fi;fi
    wr_flashimage=filesize_check 0x1400000;if test ${filesize_result} = good; then mmc device 0;mmc write ${loadaddr} 0x0 0xa000;fi
    wr_gpt=filesize_check 0x4400;if test ${filesize_result} = good; then mmc device 0;mmc write ${loadaddr} 0x0 0x22;fi
    wr_pl=filesize_check 0x40000;if test ${filesize_result} = good; then mmc device 0; mmc write ${loadaddr} 0x0 0x200 emmc_preloader;fi
    wr_rom_hdr=filesize_check 0xA000;if test ${filesize_result} = good; then mmc device 0;mmc write ${loadaddr} 0x0 0x50;fi
    wr_uboot=filesize_check 0x80000;if test ${filesize_result} = good; then mmc device 0;mmc write ${loadaddr} 0x600 0x400;fi
Environment size: 3699/4092 bytes

BTW, It’s ok for download and boot the openwrt kernel bin build from the master of openwrt github.

@bourne_hlm, I encountered the same. I guess something wrong with imagebuilder. If you try to load ONLY kernel without initramfs/squashfs it starts loading, faces the empty of the root fs and goes reboot. Kernel file: bin/targets/mediatek/mt7622/BPI-R64-kernel.bin

I think the problem is the kernel mtd partition too small to fit the initramfs/squashfs. OMR R64 build initramfs/squashfs is huge, 28MB. If i reduce to 9MB, it’s working. I’m trying to modify the kernel mtd partition size now.

@bourne_hlm, could you please tell how you build OMR? Step by step.