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.