Banana Pi BPI-R2 OPENWRT 19.07 Image

Rod, it´s not the problem to write the file to emmc, it´s the way to get the files. And it´s not the solution, to point to precompiled files at openwrt.org. I have my own compiled files on my hd, but it´s the initramfs and squashfs files only and I want to build proper img images.

ATM I´m comparing the make files between the lexa2 build and the official buildroot. Boring job…

Hey @gotthard.anger, well I was trying to give you the simplest path to make it work with master builds. Feel free to try other methods.

Of course you can always compile from source following the guides on Openwrt, they will produce roughly the same files available on snapshots directory, with the packages you choose on your build(on the make menuconfig step)

If you follow the scatter.txt instructions with the files compiled from source you should have the same results.

Rod, to clear the goal: I tried the official files already, but IMHO this image is readonly, e.g. if I add my alterations to the config, they are lost after reboot. Or did I something wrong? Thats why I want to build my own image

Hey @gotthard.anger, let me try to clear it up for you. Openwrt can use regular EXT4 fylesystem but the most common is an special filesystem called SquashFS. It basically works this way:

  • 1st part of the system is indeed readonly , on this part you are 100% correct, you cannot change or write files;
  • 2nd part is an overlay and it is writeable. That’s where all your configs and packages will be stored. These do not get lost after reboot, only if you flash the drive again.

Openwrt site has a wiki about parts of the OS, you should give it a try if you have the time.

Image formats are explained here: https://openwrt.org/docs/techref/image.format

Rod, as you suggested, I will give a new try with provided images from openwrt.org report will follow here

Here’s an example of changes to make RW filesystem on R64: [R64] Mainline OpenWRT image

finally I get my own version written to sdcard and booting from card. unfortunately network will not work, only predefined openvpn. for creating the proper sdcard images, I modified the script here: yoursunny´s script You just remove the download of the 18.06.4 images (lines 27/28) and point in line 22 and 23 to

build_dir/target-arm…eabi/linux-m…7623/tmp/openwrt…kernel.bin

build_dir/target-arm…eabi/linux-m…7623/tmp/openwrt…sysupgrade.bin

after running the script, just flash the image./bpi-r2-sd.bin to /dev/sdx

sudo if=bpi-r2-sd.bin of=/dev/sdb

How to get the network part working, so it will survive a reboot?

BTW: using the patch from frank-w Howto flash banana pi r2 leads to a make error.

@frank-w: your suggestions from july

ip link set eth0 up
ip addr add 192.168.1.1/24 dev br-lan
ip link set br-lan up

has no effect. Device remains offline at eth0 or br-lan. eth1 is working well (pppoe-device)

which kernel (5.4.58+)? have you added your port(s) to br-lan? any error in dmesg/while applying the commands? if you mean the trgmii-patch than it can be included already in your kernelversion so patch cannot be applied again

i wonder why eth1 should work…it is not connected in mainline kernel

maybe a “ip a” and dmesg output may help

as I see ./target/linux/mediatek/Makefile says kernel 4.14 root@BananaPi:/# dmesg | tail [ 17.282486] mt7530 3.switch lan2: Link is Down [ 19.358091] br-lan: port 4(lan3) entered blocking state [ 19.363284] br-lan: port 4(lan3) entered forwarding state [ 19.369002] mt7530 3.switch lan3: Link is Up - 1Gbps/Full - flow control off [ 19.376205] mt7530 3.switch wan: Link is Up - 1Gbps/Full - flow control rx/tx [ 19.376327] mt7530 3.switch lan2: Link is Up - 1Gbps/Full - flow control rx/tx [ 19.384122] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready [ 19.397004] br-lan: port 3(lan2) entered blocking state [ 19.402246] br-lan: port 3(lan2) entered forwarding state [ 19.408059] IPv6: ADDRCONF(NETDEV_CHANGE): wan.7: link becomes ready and root@BananaPi:/# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000 link/ether 3a:e4:f5:29:9d:ff brd ff:ff:ff:ff:ff:ff inet6 fe80::38e4:f5ff:fe29:9dff/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000 link/ether 9a:de:54:ec:04:9a brd ff:ff:ff:ff:ff:ff inet6 fe80::98de:54ff:feec:49a/64 scope link valid_lft forever preferred_lft forever 4: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 9a:de:54:ec:04:9a brd ff:ff:ff:ff:ff:ff inet6 fe80::98de:54ff:feec:49a/64 scope link valid_lft forever preferred_lft forever 5: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000 link/ether 3a:e4:f5:29:9d:ff brd ff:ff:ff:ff:ff:ff 6: lan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000 link/ether 3a:e4:f5:29:9d:ff brd ff:ff:ff:ff:ff:ff 7: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000 link/ether 3a:e4:f5:29:9d:ff brd ff:ff:ff:ff:ff:ff 8: lan3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000 link/ether 3a:e4:f5:29:9d:ff brd ff:ff:ff:ff:ff:ff 9: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 0e:12:76:f3:b0:dd brd ff:ff:ff:ff:ff:ff inet 192.168.6.101/24 brd 192.168.6.255 scope global br-lan valid_lft forever preferred_lft forever inet6 fd84:72d7:dedd::1/60 scope global valid_lft forever preferred_lft forever inet6 fe80::c12:76ff:fef3:b0dd/64 scope link valid_lft forever preferred_lft forever 15: wan.7@wan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 9a:de:54:ec:04:9a brd ff:ff:ff:ff:ff:ff inet6 fe80::98de:54ff:feec:49a/64 scope link valid_lft forever preferred_lft forever 16: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN qlen 3

Ip address and several other stuff are predefined in ./files/etc/config if you´re wondering about the cruel ip. But so I have also the credentials for v-dsl on sd-card ready for boot link/ppp inet 87.176.255.65 peer 62.155.247.131/32 scope global pppoe-wan valid_lft forever preferred_lft forever inet6 2003:c1:e7ff:2867:569:2cc4:79f9:22d0/64 scope global dynamic valid_lft 14343sec preferred_lft 1743sec inet6 fe80::569:2cc4:79f9:22d0/10 scope link valid_lft forever preferred_lft forever

Btw: how can I format this readable? Bootlog is here

You use not master? Then it may be the old problem where gmac0 and 1 needs to be configured to same mode (rgmii)…can you check it? And it explains,why you can use gmac1 because of old second-gmac patches.

You can format code/logs by select the text and press <> button

You use not master?

I thougt it :thinking:

git branch reports

* (HEAD losgelöst bei v19.07.3)
master

How to check? I found ./build_dir/…/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts with marks from this thread: bpi-r2-adding-second-gmac-to-4-14

gmac0 mode=trgmii gmac1 mode=rgmii

may be, I missed to compile switch module for mt7630?

Strange,that your makefile points to 4.14

By default 5.4 is used. But if you want to keep 4.14,change trgmii to rgmii in the bpi-r2.dts (i hope i do not get overridden). Normally trgmii on gmac0 and rgmii on gmac1 is right,but driver in 4.14 is buggy and does not setup trgmii right so change to rgmii

If you see dsa-ports like wan and lanX you have switch-driver included.

put my repo in trash and clone new…

May be I have done “git checkout” instead of “git clone” some months ago.

Now I have kernel 5.4 and old problem: generated image not bootable, hangs on

[BLDR] jump to 0x81E00000
[BLDR] <0x81E00000>=0xEA0000B8
[BLDR] <0x81E00004>=0xE59FF014

I used build_dir/target…/tmp/openwrt-…img.gz, unzipped it and wrote to /dev/sdb

I’m not deep in openwrts build process,but afair this comes up if uboot is missing/not bootable

Found it: Bug in ./target/linux/mediatek/image/gen_mtk_mmc_img.sh, line 123/124:

> echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0   conv=notrunc`
> echo -en "${BRLYT}"      | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc`

writes the boot code as ASCII into the image file, including a leading “-en”. As I see, the option -en has no effect, because also the trailing 0x0a is written to $output.

I used okteta to convert it into binary code and voila, the image starts from sd.

BTW: Box is online, including eth0

1 Like

Thank you for the Update

@dwmw2 as author of the script can you please check/fix this? for me it looks right

echo -e should convert \xXX to the byte with hexvalue XX (-n for no newline at the end)

you see only eth0? you should see wan/lanX and need assign ip to these dsa-interfaces (not to eth0)

i tried with this simple script:

 1 #!/bin/bash
 2
 3 OUTPUT=test.img
 4
 5 dd if=/dev/zero of=${OUTPUT} bs=1M count=2;
 6
 7 SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
 8 EMMC_BOOT="EMMC_BOOT\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
 9 BRLYT="BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\
10 \x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\
11 \x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
12
13
14 echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0   conv=notrunc
15 echo -en "${BRLYT}"      | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
16

which results as it should:

00000000  53 44 4d 4d 43 5f 42 4f  4f 54 00 00 01 00 00 00  |SDMMC_BOOT......|
00000010  00 02 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  42 52 4c 59 54 00 00 00  01 00 00 00 00 08 00 00  |BRLYT...........|
00000210  00 08 00 00 42 42 42 42  08 00 01 00 00 08 00 00  |....BBBB........|
00000220  00 08 00 00 01 00 00 00  00 00 00 00 00 00 00 00  |................|
00000230  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00200000

Box is fully working including all interfaces (lan, wan and wan6). Openvpn is stopped. No further investigation ATM. Probably thursday.