Porting openwrt(kernel 5.4) for bpi-r2 status report

You can use my repo where i have included patches from smaller09…i have not found any way to create an image from it for r2/r64,but you can create the rootfs tar.gz and kernel/modules

@smaller09 is there any way to define defconfig based on my current selections (mediatek arm,mt7623,bpi-r2) so that i can define that wifi-driver will be included and maybe hdmi if you have ported it

IMG is not working at this time. it meeds patches form @abbradar that did not include right now. I just put it to the last. because using tar.gz is mush easier to do testing.

@frank-w I did not try to use the defconfig to build the target. I will try it later.

Right now what we need to do is to make bluetooth working, and then lima. hdmi seem to work.

and next to do is to make wifi works in the luci. currently every reboot will brings two new adapters in the config ui. the problem my be in the mac80211.sh, the openwrt script need to get the wifi mac addree from the /sys/class/ieee80211/$phy/macaddresse that unpresence on bpi-r2’s internal wifi. but edit the script would broken other addon wifi cards.

For wifi,you maybe can set mac in your wifi.sh after creating ap0 interface using ip link command

How can i test bluetooth in my kernel to check for problem you have with it? I can pair my smartphone…have not tried any connection/data exchange because i don’t know how to do with blutoothctl

Building images needs also creating partitions and complete bootheaders including uboot…i guess it’s more work

I have forked the main OpenWRT trunk git repository, applied a series of patches and built an image with ext4 and sysupgrade support running 5.4 kernel. OpenWRT fork repo is available here:

I prepared also a binary image which can be written to an SD-card ( rootfs size 256MB )

This image has the HW-NAT commits included. I did some tests with it disabled and enabled but I did not noticed any difference. Also I observed speed decreasing compared to another images I ran (got around 200 Mbps out of 500MBps). Maybe i’m missing some patches or I did not configured something properly.

If someone wants to test HW-NAT feature feel free and download the image or clone the repository and compile a new image.

This image does not include integrated WLAN mt6625l and bluetooth patches.

4 Likes

Could you include wifi and other patches ported by @smaller09? And maybe some other patches from my 5.4-tree

I could try and add the other patches but I’m not very experienced with this If i need to do debugging. Can you summarize which patches from your 5.4 tree should I add ?

Smaller09 has most complex patches already included…i guess only copy is enough.

Just to have one actual openwrt repo containing all needed patches.

Then i look whats missing…

does your image allows installing of Packages (opkg) and luci web frontend? afair these are common requested features :slight_smile:

Ill try this tomorrow. Nice work.

Thanks for keeping this device updated with openwrt img.

Update: Is the WIFI and AP working on this image? If not I see @sinovoip have posted something today

Maybe @sinovoip can help in getting the wifi to work on openwrt?

UPDATE 2: Tried the image and I am amazed with the 2020 UI and the board support specifically with the LED customisation which I tested. DHCP worked. Good to see adblocker pre-installed. Only thing missing is WIFI AP. I will do further testing tomorrow as currently I only have 1 Lan cable.

Question:

  1. Can I jump the power switch ? Does this kernel ignores the power switch jumped?
  2. Flashing the img directly to the emmc should power on the device directly to OpenWRT right?

Keep up the good work :smiley:

You mean r2 internal wifi? It’s mt6625l and not mt7615 like sinovoip posted…but smaller09 ported patches to openwrt 5.4 kernel,which needs to be included into this repo

I added most of the patches from @smaller09 git repo into my OpenWRT fork except wireless and bluetooth and successfully compiled a new image today.

Then I added also mt6625l wireless and bluetooth patches but for now I have some compilation errors.

I’m not quite sure what are the required config menu options to be enabled in order for WiFi and bluetooth to work properly.

This is the last error from the compile log

ERROR: module '/data/MKV/openwrt_bpir2/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/mt6625l-wlan-gen2-2019-09-01-
5a8fafb8/wlan_gen2.ko' is missing.
1 Like

Yes I tagged that link as Sinovoip mentioned R2 and even I was confused so I exactly checked the model of the chip on the hardware itself. :rofl: My bad.

Ill wait up test the one with wifi support. What about power switch jump support?

There is no such module…strange where this reference came from

try builtin wifi and bluetooth module

are patches applied without errors?

@spikerguy what do you mean with power jump support? You need to press powerbutton 10s…this is a hardware-limitation and cannot be fixed by software…only with soldering a bridge over power switch or 5v on otg port

Yes I mean if I solder the bridge over power switch but will the kernel power off the device?

I have not soldered pins so i cannot test this.

But mainline 5.4 misses some Patches (last 7 of my series of 13) for mt6323 poweroff so it will not work independed from soldered pins

I managed to add wifi and bluetooth driver and compile with success by adding the 5.4 kernel config file from @smaller09 openwrt repo, but when I boot the image it goes into a reboot loop and I cannot see any kernel messages although I enabled earlyprintk and debug.

His 5.4 config has a lots of debug options and every time I compile it asks me a lot of questions for configs to be enabled which I need to answer them manually.

I will revert the configs back and try to check manually and adding options from his config to the openwrt one.

Have you soldered power-switch?

No I do not have it soldered. I need to press 10 seconds the power button to turn it on.

I compiled again the image with mt6625l wifi and bt included and the same reboot loop happens. Below is partial output from the boot log with the kernel panic

[    1.405488] loop: module loaded
[    1.408712] [WMT-DETECT][I]wmt_detect_driver_init:driver(major 154) installed success
[    1.416670] [SDIO-DETECT][I]sdio_detect_init:sdio_register_driver() ret=0
[    1.423992] 8<--- cut here ---
[    1.427047] Unable to handle kernel NULL pointer dereference at virtual address 0000015c
[    1.435176] pgd = 5fd88c49
[    1.437877] [0000015c] *pgd=00000000
[    1.441470] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[    1.446773] Modules linked in:
[    1.449826] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.4.31 #0
[    1.455735] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    1.461304] PC is at dma_alloc_attrs+0x8/0xf0
[    1.465658] LR is at _btif_vfifo_init.constprop.39+0x58/0x164
[    1.471395] pc : [<c0188e88>]    lr : [<c0569eb0>]    psr: 60000013
[    1.477652] sp : df03de94  ip : 00000170  fp : de5e0000
[    1.482867] r10: c0d28530  r9 : 00000000  r8 : c0d28540
[    1.488083] r7 : 00000000  r6 : 00000000  r5 : c0dd8798  r4 : c0d28658
[    1.494601] r3 : 00000005  r2 : c0d2865c  r1 : 00002000  r0 : 00000000
[    1.501120] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    1.508246] Control: 10c5387d  Table: 8000406a  DAC: 00000051
[    1.513984] Process swapper/0 (pid: 1, stack limit = 0x590d8455)
[    1.519982] Stack: (0xdf03de94 to 0xdf03e000)
[    1.524333] de80:                                              c0d28658 c0dd8798 00000000
[    1.532504] dea0: 00000000 c0d28540 00000000 c0569eb0 00000000 00000008 c0dd8798 c0dd8798
[    1.540675] dec0: de5c0000 c0d28314 de5d0000 c056c834 00000000 c0c1aa64 c0a8b5e4 c0d03e48
[    1.548846] dee0: c0d5f894 ffffe000 c056c68c 00000000 c0c28834 00000007 e07fcc80 c0102880
[    1.557016] df00: c0b5ac80 00000065 00000000 c0144700 c0c28838 00000000 00000000 00000006
[    1.565187] df20: 00000006 c0ab0f44 c09e5df0 00000000 c09f1644 c09e5ea8 e07fcd25 e07fcd2f
[    1.573358] df40: 00000000 00000006 c0c004a8 7cd0c948 c0c3593c c0c004a8 c0d5f8a8 c0d5f890
[    1.581528] df60: c0c28854 c0c00eec 00000006 00000006 00000000 c0c004a8 00000000 000000be
[    1.589698] df80: 00000000 00000000 c08da6c8 00000000 00000000 00000000 00000000 00000000
[    1.597869] dfa0: 00000000 c08da6d0 00000000 c01010e8 00000000 00000000 00000000 00000000
[    1.606038] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.614208] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    1.622390] [<c0188e88>] (dma_alloc_attrs) from [<de5c0000>] (0xde5c0000)
[    1.629175] Code: e1a00003 e12fff1e e92d43f0 e280ce17 (e590415c) 
[    1.635302] ---[ end trace 2fd7a7f8024e14b2 ]---
[    1.639930] Kernel panic - not syncing: Fatal exception
[    1.645152] CPU0: stopping
[    1.647856] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D           5.4.31 #0
[    1.655153] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    1.660728] [<c010ff40>] (unwind_backtrace) from [<c010b980>] (show_stack+0x10/0x14)
[    1.668469] [<c010b980>] (show_stack) from [<c08c46a8>] (dump_stack+0x94/0xa8)
[    1.675689] [<c08c46a8>] (dump_stack) from [<c010ea7c>] (handle_IPI+0x160/0x18c)
[    1.683084] [<c010ea7c>] (handle_IPI) from [<c043f4cc>] (gic_handle_irq+0x74/0x78)
[    1.690651] [<c043f4cc>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0xa8)
[    1.698124] Exception stack(0xc0d01f28 to 0xc0d01f70)
[    1.703170] 1f20:                   00000000 000004d0 df5ab7b4 c0117940 ffffe000 c0d03e68
[    1.711341] 1f40: c0d03ea8 00000001 00000000 c0c3c3a8 c0d0dae4 00000000 c0d03f20 c0d01f78
[    1.719509] 1f60: c0108ef8 c0108efc 60000013 ffffffff
[    1.724559] [<c0101a8c>] (__irq_svc) from [<c0108efc>] (arch_cpu_idle+0x38/0x3c)
[    1.731955] [<c0108efc>] (arch_cpu_idle) from [<c0151b64>] (do_idle+0x1b8/0x25c)
[    1.739347] [<c0151b64>] (do_idle) from [<c0151ed0>] (cpu_startup_entry+0x18/0x1c)
[    1.746911] [<c0151ed0>] (cpu_startup_entry) from [<c0c00d24>] (start_kernel+0x3e4/0x3f0)
[    1.755082] [<c0c00d24>] (start_kernel) from [<00000000>] (0x0)
[    1.760994] CPU2: stopping
[    1.763700] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D           5.4.31 #0
[    1.770997] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    1.776569] [<c010ff40>] (unwind_backtrace) from [<c010b980>] (show_stack+0x10/0x14)
[    1.784308] [<c010b980>] (show_stack) from [<c08c46a8>] (dump_stack+0x94/0xa8)
[    1.791526] [<c08c46a8>] (dump_stack) from [<c010ea7c>] (handle_IPI+0x160/0x18c)
[    1.798918] [<c010ea7c>] (handle_IPI) from [<c043f4cc>] (gic_handle_irq+0x74/0x78)
[    1.806483] [<c043f4cc>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0xa8)
[    1.813956] Exception stack(0xdf075f60 to 0xdf075fa8)
[    1.819003] 5f60: 00000000 00000390 df5c97b4 c0117940 ffffe000 c0d03e68 c0d03ea8 00000004
[    1.827174] 5f80: 00000000 c0c3c3a8 c0d0dae4 00000000 00000000 df075fb0 c0108ef8 c0108efc
[    1.835340] 5fa0: 60000013 ffffffff
[    1.838828] [<c0101a8c>] (__irq_svc) from [<c0108efc>] (arch_cpu_idle+0x38/0x3c)
[    1.846221] [<c0108efc>] (arch_cpu_idle) from [<c0151b64>] (do_idle+0x1b8/0x25c)
[    1.853612] [<c0151b64>] (do_idle) from [<c0151ed0>] (cpu_startup_entry+0x18/0x1c)
[    1.861174] [<c0151ed0>] (cpu_startup_entry) from [<8010250c>] (0x8010250c)
[    1.868128] CPU1: stopping
[    1.870833] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D           5.4.31 #0
[    1.878132] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    1.883702] [<c010ff40>] (unwind_backtrace) from [<c010b980>] (show_stack+0x10/0x14)
[    1.891441] [<c010b980>] (show_stack) from [<c08c46a8>] (dump_stack+0x94/0xa8)
[    1.898659] [<c08c46a8>] (dump_stack) from [<c010ea7c>] (handle_IPI+0x160/0x18c)
[    1.906051] [<c010ea7c>] (handle_IPI) from [<c043f4cc>] (gic_handle_irq+0x74/0x78)
[    1.913615] [<c043f4cc>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0xa8)
[    1.921088] Exception stack(0xdf073f60 to 0xdf073fa8)
[    1.926135] 3f60: 00000000 000003d0 df5ba7b4 c0117940 ffffe000 c0d03e68 c0d03ea8 00000002
[    1.934305] 3f80: 00000000 c0c3c3a8 c0d0dae4 00000000 00000001 df073fb0 c0108ef8 c0108efc
[    1.942472] 3fa0: 60000013 ffffffff
[    1.945959] [<c0101a8c>] (__irq_svc) from [<c0108efc>] (arch_cpu_idle+0x38/0x3c)
[    1.953352] [<c0108efc>] (arch_cpu_idle) from [<c0151b64>] (do_idle+0x1b8/0x25c)
[    1.960743] [<c0151b64>] (do_idle) from [<c0151ed0>] (cpu_startup_entry+0x18/0x1c)
[    1.968305] [<c0151ed0>] (cpu_startup_entry) from [<8010250c>] (0x8010250c)
[    1.975263] Rebooting in 1 seconds..
[    3.978788] Reboot failed -- System halted

have you added the config and firmware-files? afair kernel crashes if these files are missing

It seems the firmware is automatically pulled during compilation. I see it is there in the firmware folder

BPI-R2> ls mmc 1:2 /etc/firmware        
<DIR>       4096 .
<DIR>       4096 ..
          113080 ROMv2_lm_patch_1_0_hdr.bin
           50296 ROMv2_lm_patch_1_1_hdr.bin
          225840 WIFI_RAM_CODE_7623
<DIR>       4096 nvram