Which kernel should i use to have all hardware feature available in BPI-R2.
I will use my BPI-R2 as my main switch, router, wifi AP and nas.
I can’t use 4.4 as my ISP require a vlan on the WAN to run pppoe over fiber.
As it is my main gateway, i would rather take advantage of the hardware nat.
kernel 4.9 have hwnat, second gmac, port-separation and vlan, but no hdmi
i have created a 4.9-patched branch in my github-repo (4.14) with the patches from bpi-r2-lede…
compile that and you should have above features (need to copy config and build-script from main branch)
i had created the branch to understand how the patches work in the target-files (hard to read patches alone) for porting them to 4.14
Some warnings
To be fare i’m good with any LTS kernel as long as i have all feature. Latest better. Let see with 4.9
LD drivers/misc/mediatek/connectivity/common/built-in.o
drivers/misc/mediatek/connectivity/wlan/Makefile:6: include gen2
drivers/misc/mediatek/connectivity/wlan/gen2/Makefile:220: y
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/dump.o
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/wlan_lib.o
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/wlan_oid.o
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/wlan_bow.o
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/debug.o
CC drivers/misc/mediatek/connectivity/wlan/gen2/common/wlan_p2p.o
and
CC drivers/net/ethernet/mediatek/mtk_eth_soc.o
drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_start_xmit':
drivers/net/ethernet/mediatek/mtk_eth_soc.c:677:9: warning: 'fport' may be used uninitialized in this function [-Wmaybe-uninitialized]
fport |= 0x4 << TX_DMA_FPORT_SHIFT;
drivers/net/ethernet/mediatek/mtk_eth_soc.c:668:26: note: 'fport' was declared here
u32 txd3 = 0, txd4 = 0, fport;
^~~~~
LD drivers/net/ethernet/mediatek/built-in.o
LD drivers/net/ethernet/mediatek/mtk_hnat/built-in.o
CC [M] drivers/net/ethernet/mediatek/mtk_hnat/hnat.o
CC [M] drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.o
CC [M] drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.o
LD [M] drivers/net/ethernet/mediatek/mtk_hnat/mtkhnat.o
BTW when i boot on 4.4 i have the following boot line. seem like there a audio and video support.
Not critical at the moment, the ultimate goal is to output audio via a bt speaker.
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_tx':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:155: undefined reference to `mtk_wcn_btif_write'
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:170: undefined reference to `mtk_wcn_btif_write'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_open':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:81: undefined reference to `mtk_wcn_btif_open'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_close':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:101: undefined reference to `mtk_wcn_btif_close'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_rx_cb_register':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:121: undefined reference to `mtk_wcn_btif_rx_cb_register'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_wakeup':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:204: undefined reference to `mtk_wcn_btif_wakeup_consys'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_dpidle_ctrl':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:224: undefined reference to `mtk_wcn_btif_dpidle_ctrl'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_lpbk_ctrl':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:239: undefined reference to `mtk_wcn_btif_loopback_ctrl'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_logger_ctrl':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:259: undefined reference to `mtk_wcn_btif_dbg_ctrl'
drivers/built-in.o: In function `mtk_wcn_consys_stp_btif_parser_wmt_evt':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_btif.c:277: undefined reference to `mtk_wcn_btif_parser_wmt_evt'
drivers/built-in.o: In function `is_btif_rxd_be_blocked':
/home/xbgmsharp/BPI-R2-4.14/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_dbg.c:489: undefined reference to `mtk_btif_rxd_be_blocked_flag_get'
Makefile:972: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
Wifi-driver is modified by me to do not run in issues like the mtk-btif…wifi-driver needs it so i set it by default. The original repos set btif in config…
First ignore this warnings,compile and look for errors…i don’t want to change 4.9 because some patches (also 2gmac) will be ported to 4.14
I was able to compile the kernel 4.9, i used the config of kernel 4.14.
Before the kernel crash i was able to see the 2gmac. the kernel crash on CPU detection.
Not sure where to go from here. Maybe a DTC error?
DTC arch/arm/boot/dts/mt7623-evb.dtb
Warning (reg_format): "reg" property in /mt7530@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
DTC arch/arm/boot/dts/mt7623-eMMC.dtb
Warning (reg_format): "reg" property in /switch has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
DTC arch/arm/boot/dts/mt7623-NAND.dtb
DTC arch/arm/boot/dts/mt7623-NAND-ePHY.dtb
DTC arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dtb
Warning (reg_format): "reg" property in /mt7530@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
Warning (reg_format): "reg" property in /switch has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
DTC arch/arm/boot/dts/mt8127-moose.dtb
DTC arch/arm/boot/dts/mt8135-evbp1.dtb
drivers/misc/mediatek/connectivity/wlan/Makefile:6: include gen2
drivers/misc/mediatek/connectivity/wlan/gen2/Makefile:220: y
[ 1.068767] libphy: mdio: probed
[ 1.072009] mtk_soc_eth 1b100000.ethernet: generated random MAC address ba:65:9c:31:1c:38
[ 1.080683] mtk_soc_eth 1b100000.ethernet: connected mac 0 to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
[ 1.091571] mtk_soc_eth 1b100000.ethernet eth0: mediatek frame engine at 0xe1120000, irq 211
[ 1.100008] mtk_soc_eth 1b100000.ethernet: generated random MAC address 56:a0:66:87:77:cf
[ 1.108477] mtk_soc_eth 1b100000.ethernet: connected mac 1 to PHY at fixed-0:01 [uid=00000000, driver=Generic PHY]
[ 1.119307] mtk_soc_eth 1b100000.ethernet eth1: mediatek frame engine at 0xe1120000, irq 211
CPU crash
[ 1.403586] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 1.403591] pgd = c0004000
[ 1.403596] [00000000] *pgd=00000000
[ 1.403606] Internal error: Oops: 5 [#1] SMP ARM
[ 1.403612] Modules linked in:
[ 1.403620] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.9.44-4.9_patched-00010-g4cfbf51244aa-dirty #15
[ 1.403622] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1.403626] task: de8e8000 task.stack: de8e2000
[ 1.403638] PC is at clk_hw_round_rate+0x28/0x54
[ 1.403644] LR is at divider_round_rate+0x1b4/0x550
[ 1.403650] pc : [<c0412da4>] lr : [<c0418c1c>] psr: 60000013
[ 1.403650] sp : de8e3a68 ip : de8e3a98 fp : de8e3a94
[ 1.403653] r10: 00000000 r9 : de83c380 r8 : 00000000
[ 1.403656] r7 : 00000100 r6 : 02ee0000 r5 : 02ee0000 r4 : 00000000
[ 1.403660] r3 : de883d80 r2 : de8e3a74 r1 : de8e3a70 r0 : 00000000
[ 1.403665] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 1.403669] Control: 10c5387d Table: 8000406a DAC: 00000051
[ 1.403673] Process swapper/0 (pid: 1, stack limit = 0xde8e2218)
[ 1.403676] Stack: (0xde8e3a68 to 0xde8e4000)
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/conn_drv_init.o
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/common_drv_init.o
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/bluetooth_drv_init.o
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/gps_drv_init.o
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/fm_drv_init.o
CC drivers/misc/mediatek/connectivity/common/common_detect/drv_init/wlan_drv_init.o
LD drivers/misc/mediatek/connectivity/common/common_detect/drv_init/built-in.o
LD drivers/misc/mediatek/connectivity/common/common_detect/built-in.o
scripts/Makefile.build:44: drivers/misc/mediatek/connectivity/common/conn_soc/Makefile: No such file or directory
make[6]: *** No rule to make target 'drivers/misc/mediatek/connectivity/common/conn_soc/Makefile'. Stop.
scripts/Makefile.build:544: recipe for target 'drivers/misc/mediatek/connectivity/common/conn_soc' failed
make[5]: *** [drivers/misc/mediatek/connectivity/common/conn_soc] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/misc/mediatek/connectivity/common' failed
scripts/Makefile.build:544: recipe for target 'drivers/misc/mediatek/connectivity' failed
scripts/Makefile.build:544: recipe for target 'drivers/misc/mediatek' failed
scripts/Makefile.build:544: recipe for target 'drivers/misc' failed
Makefile:991: recipe for target 'drivers' failed
make[4]: *** [drivers/misc/mediatek/connectivity/common] Error 2
make[3]: *** [drivers/misc/mediatek/connectivity] Error 2
make[2]: *** [drivers/misc/mediatek] Error 2
make[1]: *** [drivers/misc] Error 2
make: *** [drivers] Error 2
Check file not present
$ ll drivers/misc/mediatek/connectivity/common/conn_soc/
total 16
drwxr-xr-x 3 francois francois 4096 Mar 9 21:12 core
drwxr-xr-x 2 francois francois 4096 Mar 9 16:56 include
drwxr-xr-x 5 francois francois 4096 Mar 9 21:12 linux
drwxr-xr-x 3 francois francois 4096 Mar 9 21:12 mt7623
Check file not present
$ ll drivers/misc/mediatek/connectivity/common/conn_soc/Makefile
ls: cannot access 'drivers/misc/mediatek/connectivity/common/conn_soc/Makefile': No such file or directory
Same boot issue on CPU detection, i do believe it is coming from the dtb.
I was able to compile with the warning mention the kernel 4.9 but i can’t boot on kernel 4.9.
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
DTC arch/arm/boot/dts/mt2701-evb.dtb
DTC arch/arm/boot/dts/mt6580-evbp1.dtb
DTC arch/arm/boot/dts/mt6589-aquaris5.dtb
DTC arch/arm/boot/dts/mt6592-evb.dtb
DTC arch/arm/boot/dts/mt7623-evb.dtb
Warning (reg_format): DTC arch/arm/boot/dts/mt7623-eMMC.dtb
"reg" property in /mt7530@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
Warning (reg_format): "reg" property in /switch has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
DTC arch/arm/boot/dts/mt7623-NAND.dtb
DTC arch/arm/boot/dts/mt7623-NAND-ePHY.dtb
DTC arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dtb
Warning (reg_format): "reg" property in /mt7530@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
Warning (reg_format): "reg" property in /switch has invalid length (4 bytes) (#address-cells == 2, #size-cells == 2)
DTC arch/arm/boot/dts/mt8127-moose.dtb
DTC arch/arm/boot/dts/mt8135-evbp1.dtb
drivers/misc/mediatek/connectivity/wlan/Makefile:6: include gen2
drivers/misc/mediatek/connectivity/wlan/gen2/Makefile:220: y
Building modules, stage 2.
MODPOST 181 modules
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'