[BPI-R64] OpenWRT(Kernel 4.14.x) does not boot

I need to boot OpenWRT on a Kernel 4.14. I pull the last OpenWRT git files and only change “menu menuconfig” config like this:

  • Target System -> MediaTek Ralink ARM
  • Subtarget -> MT7622
  • Target Profile -> LeMaker Banana Pi R64

The project builds good and I get .bin files. But the boot progress stops at the “[ATF][ 23.608535]el3_exit” (see List 1 below). By the way if I change version to 4.19 (in target/linux/mediatek/Makefile) the image boots normal.

Whats wrong with 4.14?

List 1

MT7622> bootm
bootm flag=0, states=70f
## Loading kernel from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM64 OpenWrt Linux-4.14.156
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x40080014
     Data Size:    4478937 Bytes = 4.3 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x41080000
     Entry Point:  0x41080000
     Hash algo:    crc32
     Hash value:   d385e1ea
     Hash algo:    sha1
     Hash value:   2e026562f5260207241a2e873fce56a30b547e4a
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  ARM64 OpenWrt BPI-R64 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x404c5928
     Data Size:    22258 Bytes = 21.7 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   fb3ab39e
     Hash algo:    sha1
     Hash value:   905d9e9c593d3806699c23cd148b60a0f73f3a89
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x404c5928
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 6bff7000, end 6bfff6f1 ... OK

Starting kernel ...

[ATF][    23.582142]save kernel info
[ATF][    23.585079]Kernel_EL2
[ATF][    23.587749]Kernel is 64Bit
[ATF][    23.590837]pc=0x41080000, r0=0x6bff7000, r1=0x0
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel
INFO:    BL3-1: Next image address = 0x41080000
INFO:    BL3-1: Next image spsr = 0x3c9
[ATF][    23.608535]el3_exit

Maybe 4.14 does not contain init-code? 4.14 is 2 years old and first mt7622 patches are bit later in 2018 maybe other cause

Your kernel container (fit image) is aarch64 and after unpacking kernel there seem to be switch from 32 to 64bit (atf lines)…can you compare this part with 4.19?

The “quick start img” has Kernel 4.4 and it works:

Does it mean current 4.14 is older then current 4.4? And how can I realize the Kernel contains init-code or not?

List 2 contains boot log for 4.19. The start part looks like 4.14.

MT7622> bootm
bootm flag=0, states=70f
## Loading kernel from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  ARM64 OpenWrt Linux-4.19.86
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x40080010
     Data Size:    4769798 Bytes = 4.5 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x41080000
     Entry Point:  0x41080000
     Hash algo:    crc32
     Hash value:   e5fd6d53
     Hash algo:    sha1
     Hash value:   13a99c81f9f9f178a4143994585687bf57e25efd
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Loading fdt from FIT Image at 4007ff28 ...
   Using 'config@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  ARM64 OpenWrt BPI-R64 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x4050c950
     Data Size:    23070 Bytes = 22.5 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   6f50902d
     Hash algo:    sha1
     Hash value:   a45cf7ff90b8c1baa5e7680293643f6d156ddda2
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x4050c950
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 6bff7000, end 6bfffa1d ... OK

Starting kernel ...

[ATF][    29.840173]save kernel info
[ATF][    29.843109]Kernel_EL2
[ATF][    29.845779]Kernel is 64Bit
[ATF][    29.848867]pc=0x41080000, r0=0x6bff7000, r1=0x0
INFO:    BL3-1: Preparing for EL3 exit to normal world, Kernel
INFO:    BL3-1: Next image address = 0x41080000
INFO:    BL3-1: Next image spsr = 0x3c9
[ATF][    29.866565]el3_exit
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 4.19.86 (revyakin@lenovo) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r11625-a512123)) #0 SMP Thu Dec 5 14:29:46 2019
[    0.000000] Machine model: Bananapi BPI-R64
[    0.000000] On node 0 totalpages: 262096
[    0.000000]   DMA32 zone: 4096 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 262096 pages, LIFO batch:63
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv0.2 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x3ec with crng_init=0
[    0.000000] percpu: Embedded 20 pages/cpu s42712 r8192 d31016 u81920
[    0.000000] pcpu-alloc: s42712 r8192 d31016 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: kernel page table isolation disabled by kernel configuration
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258000
[    0.000000] Kernel command line: console=ttyS0,115200n1 rootfstype=squashfs earlyprintk block2mtd.block2mtd=/dev/mmcblk0,65536,eMMC,5 mtdparts=eMMC:768k(mbr)ro,512k(uboot),512k(Config),256k(Factory),64M(Kernel),2048M(usrdata)

4.4 is modified from sinovoip for r64 (imho MTK also works mainly on 4.4). 4.4 mainline does not contain mt7622/mt7623 code.

i don’t know which kernel-source was used for the quick start image…

you can search your 4.14 kernel-source if there is any mt7622 files (find . -iname ‘mt7622’)

Yes, there are 4.14 files for mt7622:

revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ ls -l target/linux/mediatek/
total 56
drwxrwxr-x 4 revyakin revyakin  4096 дек  9 11:20 base-files
drwxrwxr-x 3 revyakin revyakin  4096 дек  9 11:20 files-4.14
drwxrwxr-x 4 revyakin revyakin  4096 дек  9 11:20 files-4.19
drwxrwxr-x 2 revyakin revyakin  4096 дек  9 11:20 image
-rw-rw-r-- 1 revyakin revyakin   406 дек  9 11:20 Makefile
-rw-rw-r-- 1 revyakin revyakin  1377 дек  9 11:20 modules.mk
drwxrwxr-x 3 revyakin revyakin  4096 дек  9 11:20 mt7622
drwxrwxr-x 3 revyakin revyakin  4096 дек  9 11:20 mt7623
drwxrwxr-x 4 revyakin revyakin  4096 дек  9 11:20 mt7629
drwxrwxr-x 2 revyakin revyakin 16384 дек  9 11:20 patches-4.14
drwxrwxr-x 2 revyakin revyakin  4096 дек  9 11:20 patches-4.19
revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ ll target/linux/mediatek/files-4.14/arch/arm64/boot/dts/mediatek/
total 32
drwxrwxr-x 2 revyakin revyakin 4096 дек  9 11:20 ./
drwxrwxr-x 3 revyakin revyakin 4096 дек  9 11:20 ../
-rw-rw-r-- 1 revyakin revyakin 9520 дек  9 11:20 mt7622-bananapi-bpi-r64.dts
-rw-rw-r-- 1 revyakin revyakin 9481 дек  9 11:20 mt7622-lynx-rfb1.dts
revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ ll target/linux/mediatek/image/
total 28
drwxrwxr-x  2 revyakin revyakin 4096 дек  9 11:20 ./
drwxrwxr-x 11 revyakin revyakin 4096 дек  9 11:20 ../
-rwxrwxr-x  1 revyakin revyakin  541 дек  9 11:20 gen_mt7623_emmc_img.sh*
-rw-rw-r--  1 revyakin revyakin 1577 дек  9 11:20 Makefile
-rw-rw-r--  1 revyakin revyakin  863 дек  9 11:20 mt7622.mk
-rw-rw-r--  1 revyakin revyakin  681 дек  9 11:20 mt7623.mk
-rw-rw-r--  1 revyakin revyakin  225 дек  9 11:20 mt7629.mk
revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ ll target/linux/mediatek/mt7622
total 48
drwxrwxr-x  3 revyakin revyakin  4096 дек  9 11:20 ./
drwxrwxr-x 11 revyakin revyakin  4096 дек  9 11:20 ../
-rw-rw-r--  1 revyakin revyakin 12035 дек  9 11:20 config-4.14
-rw-rw-r--  1 revyakin revyakin 16917 дек  9 11:20 config-4.19
drwxrwxr-x  2 revyakin revyakin  4096 дек  9 13:13 profiles/
-rw-rw-r--  1 revyakin revyakin   189 дек  9 11:20 target.mk
revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ ll target/linux/mediatek/patches-4.14
total 1000
drwxrwxr-x  2 revyakin revyakin 16384 дек  9 11:20 ./
drwxrwxr-x 11 revyakin revyakin  4096 дек  9 11:20 ../
-rw-rw-r--  1 revyakin revyakin   969 дек  9 11:20 0006-reset-mediatek-mt2701-reset-driver.patch
-rw-rw-r--  1 revyakin revyakin   622 дек  9 11:20 0012-clk-dont-disable-unused-clocks.patch
-rw-rw-r--  1 revyakin revyakin  2874 дек  9 11:20 0027-net-next-mediatek-fix-DQL-support.patch
-rw-rw-r--  1 revyakin revyakin   869 дек  9 11:20 0032-net-dsa-mediatek-add-support-for-GMAC2-wired-to-ext-.patch
-rw-rw-r--  1 revyakin revyakin  7389 дек  9 11:20 0033-dsa-multi-cpu.patch
-rw-rw-r--  1 revyakin revyakin  1708 дек  9 11:20 0035-net-mediatek-disable-RX-VLan-offloading.patch
-rw-rw-r--  1 revyakin revyakin  1888 дек  9 11:20 0042-net-next-mediatek-honour-special-tag-bit-inside-RX-D.patch
-rw-rw-r--  1 revyakin revyakin  1509 дек  9 11:20 0043-net-next-mediatek-enable-special-tag-indication-for-.patch
------ cut -----

Patches are for r2…in the other folders there is only makefile and config…but i see no code. e.g. this files from 5.4 (don’t know yet where init-code is located):

./include/config/rtc/drv/mt7622.h
./include/config/common/clk/mt7622
./include/config/common/clk/mt7622.h
./include/config/mt7622.h
./include/config/pinctrl/mt7622.h
./include/dt-bindings/clock/mt7622-clk.h
./include/dt-bindings/power/mt7622-power.h
./include/dt-bindings/reset/mt7622-reset.h
./drivers/clk/mediatek/clk-mt7622-aud.c
./drivers/clk/mediatek/clk-mt7622-hif.c
./drivers/clk/mediatek/clk-mt7622.c
./drivers/clk/mediatek/clk-mt7622-eth.c
./drivers/rtc/rtc-mt7622.c
./drivers/pinctrl/mediatek/pinctrl-mt7622.c

The .c and .h files I have too:

revyakin@lenovo:~/Downloads/OPENWRT/openwrt$ find build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/ -name "*7622*"
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/Documentation/devicetree/bindings/rtc/rtc-mt7622.txt
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/pinctrl/mediatek/pinctrl-mt7622.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/pinctrl/mediatek/.pinctrl-mt7622.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/pinctrl/mediatek/pinctrl-mt7622.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/rtc/.rtc-mt7622.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/rtc/rtc-mt7622.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/rtc/rtc-mt7622.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/.clk-mt7622-eth.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-aud.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/.clk-mt7622.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-aud.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-eth.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/.clk-mt7622-aud.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/.clk-mt7622-hif.o.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-eth.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-hif.c
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/drivers/clk/mediatek/clk-mt7622-hif.o
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/config/pinctrl/mt7622.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/config/common/clk/mt7622.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/config/common/clk/mt7622
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/config/rtc/drv/mt7622.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/dt-bindings/power/mt7622-power.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/dt-bindings/clock/mt7622-clk.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/include/dt-bindings/reset/mt7622-reset.h
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/configs/mt7622_rfb1_defconfig
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/mt7622.dtsi
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/.mt7622-rfb1.dtb.d.pre.tmp
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/mt7622-lynx-rfb1.dts
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/.mt7622-rfb1.dtb.cmd
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/.mt7622-rfb1.dtb.dts.tmp
build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7622/linux-4.14.156/arch/arm64/boot/dts/mediatek/.mt7622-rfb1.dtb.d.dtc.tmp

ok, then basic support should be ported…then i have no idea at the moment :frowning: sorry