Howto build 19.07.3 openwrt image for bpi r2

Wondered about mount_root command…i guess root (ext4) is also mounted ro and mount_root mounts it rw ro allow changes temporarily.

I see any ext4 filesystem:

root@BananaPi:/# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/loop0 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
mountd(pid836) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=30,minproto=5,maxproto=5,indirect)

how to check? mtd -? gives output, but as I see, dangerous commands only :slight_smile:

Have not done anything with mtd, only have seen it in previous images and such with 5.4 had problem find rootfs.

Imho mtd partitions are defindes in dts and mounted via cmdline

howto edited again: adding correct build root and some formatting

requires root-permissions on standard system…better will be ./openwrt or ~/openwrt :slight_smile: or maybe a directory in /usr/src which does also require root-permissions for create and changing owner/group (to allow clone/build as normal user)

correct, I would prefer ~/openwrt. Reason for me were shortening pathnames, but the build system has it´s own long and deep path structure. It´s a battle you are in every case the loser.

On an ext[234] filesystem you can create a symlink to deeper directory if you need it multiple times (e.g. builddir with toolchain)

e.g.

ln -s build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/ builddir

works also with version 19.07.4

edited again:

  • removed mount_root (yes Frank, you are right!)

  • added some hints regarding burn into emmc

The flashing steps can be consolidated if you use a utility like Balena etcher which can flash compressed images. Also marking the ramdisk target is unnecessary.

I can also add that I did all of this via WSL2 on windows (Ubuntu 20.04) and worked great.

But otherwise, your steps are exactly the steps I followed.

Hi!

does this build support DSA (Distributed Switch Architecture) or is there a way to patch it?

check if you see it during boot:

dmesg | grep dsa

or if you see all 4 lan + 1 wan interfaces here:

ls -l /sys/class/net

If you use 5.4 you could get patches from my 5.4-main branch and add them to yout patches-5.4 dir

root@BananaPi:/# dmesg | grep dsa
[    1.544986] libphy: dsa slave smi: probed
[    1.549281] mt7530 mdio-bus:00 wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    1.558237] mt7530 mdio-bus:00 lan0 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    1.567234] mt7530 mdio-bus:00 lan1 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    1.576216] mt7530 mdio-bus:00 lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    1.585139] mt7530 mdio-bus:00 lan3 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
root@BananaPi:/#

I would like to provide switch functions. Which modules should I add before make?

my actual build uses version 5 uname -r reports 5.4.70

You have already dsa enabled so you don’t need to add these Patches

Thanks for testing, I will try to compile myself.

Meanwhile I found that the following location shows the related patches:

https://git.openwrt.org/?p=openwrt/openwrt.git;a=tree;f=target/linux/mediatek/patches-5.4

e.g. 0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch

For r2 you don’t need mt7531 patch…only for r64. Dsa driver for r2 is included in mainline 4.14+

This is a bit off-topic:

@frank-w: Your kernel looks also interesting and I do have some questions for build.conf:

my board says BPi-R64-V1.1, so I need to set boardversion=1.1, right?

in general: is boardversion=1.0 for R2 and boardversion=1.1 for R64?

Afair board-version was only used for r64 to choose switch driver (rtl8367 vs mt7531).