็็How to build OpenWrt 18 with SATA support for BPI-R2

dtb-$(CONFIG_ARCH_MEDIATEK) += \
	mt2701-evb.dtb \
	mt6580-evbp1.dtb \
	mt6589-aquaris5.dtb \
	mt6592-evb.dtb \
#	mt7623a-rfb-emmc.dtb \
#	mt7623a-unielec-u7623-02-emmc-512m.dtb \
#	mt7623n-rfb-nand.dtb \
	mt7623n-bananapi-bpi-r2.dtb \
	mt8127-moose.dtb \
	mt8135-evbp1.dtb
dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb
dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \
	aspeed-bmc-opp-romulus.dtb \
	aspeed-ast2500-evb.dtb
endif

Still not makes. Eroor:

g  -o /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/image-mt7623n-bananapi-bpi-r2.dtb /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/image-mt7623n-bananapi-bpi-r2.dtb.tmp
Error: /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.167/arch/arm/boot/dts/mt7623.dtsi:389.25-26 syntax error
FATAL ERROR: Unable to parse input tree
make[5]: *** [Makefile:70: /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/image-mt7623a-unielec-u7623-02-emmc-512m.dtb] Error 1
make[5]: *** Waiting for unfinished jobs....
Error: /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.167/arch/arm/boot/dts/mt7623.dtsi:389.25-26 syntax error
FATAL ERROR: Unable to parse input tree
make[5]: *** [Makefile:70: /home/andrey/eMMC/banana-pi/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/image-mt7623n-bananapi-bpi-r2.dtb] Error 1
make[5]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux/mediatek/image'
make[4]: *** [Makefile:19: install] Error 2
make[4]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux/mediatek'
make[3]: *** [Makefile:13: install] Error 2
make[3]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux'
time: target/linux/install#111.63#40.04#107.67
make[2]: *** [target/Makefile:25: target/linux/install] Error 2
make[2]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt'
make[1]: *** [target/Makefile:19: /home/andrey/eMMC/banana-pi/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_install] Error 2
make[1]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt'
make: *** [/home/andrey/eMMC/banana-pi/openwrt/include/toplevel.mk:227: world] Ошибка 2

mhm

i guess you miss hdmi related constants (if your line 389 matches mine)…

so try disabling all hdmi related stuff with /* … */

i think it’s easier to use openwrts dts(i) and only replace pcie related stuff

Comment out all hdmi stuff and compiled succesfully. But cpu stall again.

[   22.468477] INFO: rcu_preempt detected stalls on CPUs/tasks:
[   22.474101]  2-...: (0 ticks this GP) idle=02a/140000000000000/0 softirq=37/37 fqs=1051 
[   22.482121]  (detected by 0, t=2102 jiffies, g=-281, c=-282, q=4)
[   22.488169] Sending NMI from CPU 0 to CPUs 2:
[   85.518475] INFO: rcu_preempt detected stalls on CPUs/tasks:
[   85.524092]  2-...: (0 ticks this GP) idle=02a/140000000000000/0 softirq=37/37 fqs=3673 
[   85.532112]  (detected by 0, t=8407 jiffies, g=-281, c=-282, q=4)
[   85.538156] Sending NMI from CPU 0 to CPUs 2:

Then any of openwrts changes causing cpu stall…afair i had not applied any special patches for pci,but i can look later when i’m at home…

Maybe try 4.19? have not yet found a way to enable this kernel… i see LINUX_4_19, but it has no available option to select via menuconfig, only platform depended “selected by”'s

i can enable if i select target=qemu virtual, but if i change back to mediatek arm it’s n again ;( @moore how can we select 4.19 as kernel for r2?

$ git log --oneline -- drivers/pci/host/pcie-mediatek.c
38ee346ac1fe PCI: mediatek: Fix mtk_pcie_find_port() endpoint/port matching logic
d84c246b7360 PCI: mediatek: Use PCI_NUM_INTX
43e6409db64d PCI: mediatek: Add MSI support for MT2712 and MT7622
db271747a04d PCI: mediatek: Use bus->sysdata to get host private data
b099631df160 PCI: mediatek: Add controller support for MT2712 and MT7622
1eacd7b84e04 PCI: mediatek: Switch to use platform_get_resource_byname()
c681c93067b8 PCI: mediatek: Add a structure to abstract the controller generations
4f6f0460448d PCI: mediatek: Rename port->index and mtk_pcie_parse_ports()
e10b7a184ccf PCI: mediatek: Use readl_poll_timeout() to wait for Gen2 training
608fcac7ce31 PCI: mediatek: Explicitly request exclusive reset control
637cfacae96f PCI: mediatek: Add MediaTek PCIe host controller support

$ git log --oneline -- drivers/phy/mediatek/phy-mtk-tphy.c
4290940dcb07 phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals
554a56fc83f6 phy: phy-mtk-tphy: fix NULL point of chip bank
cd4ec4b03dc1 phy: phy-mt65xx-usb3: add mediatek directory and rename file

Change from 4.14 to 4.19 in this Makefile.

1 Like

In armbain kernel 4.19not allow two gmac on switch and totally lose routing abilities (all 4ports bridget together with one MAC address). But everythin else works perfect. Lets try it on openwrt :slight_smile: Tonight i try to compile openwrt with 4.19 kernel and tomorrow check it onboard.

Cant ‘make kernel_menuconfig’

SHELL= flock /home/andrey/eMMC/banana-pi/openwrt/tmp/.linux-4.19.tar.xz.flock -c '  	/home/andrey/eMMC/banana-pi/openwrt/scripts/download.pl "/home/andrey/eMMC/banana-pi/openwrt/dl" "linux-4.19.tar.xz" "" "" "@KERNEL/linux/kernel/v4.x"    '
Cannot find appropriate hash command, ensure the provided hash is either a MD5 or SHA256 checksum.
make[2]: *** [Makefile:20: /home/andrey/eMMC/banana-pi/openwrt/dl/linux-4.19.tar.xz] Error 255
make[2]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux/mediatek'
make[1]: *** [Makefile:13: menuconfig] Error 2
make[1]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux'
make: *** [/home/andrey/eMMC/banana-pi/openwrt/include/toplevel.mk:161: kernel_menuconfig] Ошибка 2

Try make clean before…was working in my test

andrey@andrey-notebook:~/eMMC/banana-pi/openwrt$ make clean
 make[1] clean
andrey@andrey-notebook:~/eMMC/banana-pi/openwrt$ make kernel_menuconfig -j5 V=s
make[1]: Entering directory '/home/andrey/eMMC/banana-pi/openwrt/scripts/config'
make[1]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/scripts/config'
export MAKEFLAGS= ;make V=ss -C target/linux menuconfig
make[1]: Entering directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux'
make[2]: Entering directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux/mediatek'
mkdir -p /home/andrey/eMMC/banana-pi/openwrt/dl
SHELL= flock /home/andrey/eMMC/banana-pi/openwrt/tmp/.linux-4.19.tar.xz.flock -c '  	/home/andrey/eMMC/banana-pi/openwrt/scripts/download.pl "/home/andrey/eMMC/banana-pi/openwrt/dl" "linux-4.19.tar.xz" "" "" "@KERNEL/linux/kernel/v4.x"    '
Cannot find appropriate hash command, ensure the provided hash is either a MD5 or SHA256 checksum.
make[2]: *** [Makefile:20: /home/andrey/eMMC/banana-pi/openwrt/dl/linux-4.19.tar.xz] Error 255
make[2]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux/mediatek'
make[1]: *** [Makefile:13: menuconfig] Error 2
make[1]: Leaving directory '/home/andrey/eMMC/banana-pi/openwrt/target/linux'
make: *** [/home/andrey/eMMC/banana-pi/openwrt/include/toplevel.mk:161: kernel_menuconfig] Ошибка 2

You could try this

http://support.easycwmp.org/view.php?id=345

do you have additional packages included? md5sum/shaXsum available?

Maybe “make defconfig” works…found it somewhere

in busybox-coreutils both md5 and sha256 packets is enabled. defconfig i do in first try, its not helps.

i guess in your openwrt-folder something is cached and breaks kernel_menuconfig

for comparision my state:

$ git diff
diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile
index 28101a70d9..4d7df98520 100644
--- a/target/linux/mediatek/Makefile
+++ b/target/linux/mediatek/Makefile
@@ -9,7 +9,7 @@ SUBTARGETS:=mt7622 mt7623 mt7629
 FEATURES:=squashfs nand ramdisk fpu
 MAINTAINER:=John Crispin <[email protected]>
 
-KERNEL_PATCHVER:=4.14
+KERNEL_PATCHVER:=4.19
 
 include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \

this is shown when i run make kernel_menuconfig: openwrt_menuconfig.txt (65,7 KB)

seems like openwrt knows no “make mrproper” to clean really all…maybe try clone it again in new folder, make change to 4.19 and try again

Build successfully in new folder. Looks like pci must work but only one gmac have in dts file. mt7623n-bananapi-bpi-r2.dts (5.0 КБ) I reach board later and try to boot it with builded image. I guess it not be able to be a router with only one gmac. :frowning:

Just bump to kernel 4.19 and you can try it again, thanks.

My image not boot at all :frowning:

MMC read: dev # 1, block # 4096, count 24576 ... 24576 blocks read: OK
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   ARM OpenWrt Linux-4.19.98
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2920073 Bytes = 2.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

You mean i can git clone to new folder, make menuconfig to select my needed packages, kernel_menuconfig my bootargs, and it simple be working? Like normal openwrt-ready router?

Looks like wron console cmdline…of there is ttyS0 uart2 needs to be first in mt7623.dtsi

Easiest way should be dropping ttyS0 from cmdline…then the alias/choosen for stdout should be used

Im already delete image and build folder. Now i trying to git clone new iteration. @Moore say now it with 4.19 kernel already. And yes, new kernel uses other tty pins. And for 4.19 bootargs for SD booting will be earlyprintk console=ttyS2,115200n8 vmalloc=496M block2mtd.block2mtd=/dev/mmcblk1,65536,RootFs,5 mtdparts=RootFs:512k(mbr)ro,512k(uboot)ro,512k(config)ro,512k(factory)ro,32M(kernel),32M(recovery),1024M(rootfs),2048M(usrdata),-(bmtpool) rootfstype=squashfs,jffs2

Yes, ethernet and pcie can wotk normally with kernel 4.19, thanks.

Ok,it’s set to uart2…