BPI-R4:Beginner questions for kernel building

Try without the ramdisk defined in build.conf by disabling the builddir/ramdisksize

Have you changed options to defconfig?

Ah, afterall the VM didn’t have sudo installed, so the build.sh script failed on some commands. All good now.

@frank-w Thanks anyway for your time.

@frank-w I have these errors on boot with the kernel 6.12-rc1 from your repo, are they normal?

0.771551] mtk-xsphy soc:xphy@11e10000: failed to get ref_clk(id-1)
0.786377] mtk-socinfo mtk-socinfo.0.auto: error -ENOENT: Failed to get socinfo data
0.794328] mtk-socinfo mtk-socinfo.0.auto: probe with driver mtk-socinfo failed with error -2
2.605997] mtk-pcie-gen3 11280000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x1)
[    2.614806] mtk-pcie-gen3 11280000.pcie: probe with driver mtk-pcie-gen3 failed with error -110
[    2.624056] mtk-pcie-gen3 11290000.pcie: host bridge /soc/pcie@11290000 ranges:
[    2.631377] mtk-pcie-gen3 11290000.pcie: Parsing ranges property...
[    2.637648] mtk-pcie-gen3 11290000.pcie:       IO 0x0028000000..0x00281fffff -> 0x0028000000
[    2.646085] mtk-pcie-gen3 11290000.pcie:      MEM 0x0028200000..0x002fffffff -> 0x0028200000
[    2.855979] mtk-pcie-gen3 11290000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x1)
[    2.864762] mtk-pcie-gen3 11290000.pcie: probe with driver mtk-pcie-gen3 failed with error -110
[    2.873803] mtk-pcie-gen3 11300000.pcie: host bridge /soc/pcie@11300000 ranges:
[    2.881116] mtk-pcie-gen3 11300000.pcie: Parsing ranges property...
[    2.887383] mtk-pcie-gen3 11300000.pcie:       IO 0x0030000000..0x00301fffff -> 0x0030000000
[    2.895813] mtk-pcie-gen3 11300000.pcie:      MEM 0x0030200000..0x0037ffffff -> 0x0030200000
[    3.105972] mtk-pcie-gen3 11300000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x1)
[    3.114752] mtk-pcie-gen3 11300000.pcie: probe with driver mtk-pcie-gen3 failed with error -110
[    3.123755] mtk-pcie-gen3 11310000.pcie: host bridge /soc/pcie@11310000 ranges:
[    3.131066] mtk-pcie-gen3 11310000.pcie: Parsing ranges property...
[    3.137334] mtk-pcie-gen3 11310000.pcie:       IO 0x0038000000..0x00381fffff -> 0x0038000000
[    3.145763] mtk-pcie-gen3 11310000.pcie:      MEM 0x0038200000..0x003fffffff -> 0x0038200000
[    3.281045] mtk-pcie-gen3 11310000.pcie: set IO trans window[0]: cpu_addr = 0x38000000, pci_addr = 0x38000000, size = 0x200000
[    3.292428] mtk-pcie-gen3 11310000.pcie: set MEM trans window[1]: cpu_addr = 0x38200000, pci_addr = 0x38200000, size = 0x200000
[    3.303893] mtk-pcie-gen3 11310000.pcie: set MEM trans window[2]: cpu_addr = 0x38400000, pci_addr = 0x38400000, size = 0x400000
[    3.315359] mtk-pcie-gen3 11310000.pcie: set MEM trans window[3]: cpu_addr = 0x38800000, pci_addr = 0x38800000, size = 0x800000
[    3.326823] mtk-pcie-gen3 11310000.pcie: set MEM trans window[4]: cpu_addr = 0x39000000, pci_addr = 0x39000000, size = 0x1000000
[    3.338373] mtk-pcie-gen3 11310000.pcie: set MEM trans window[5]: cpu_addr = 0x3a000000, pci_addr = 0x3a000000, size = 0x2000000
[    3.349924] mtk-pcie-gen3 11310000.pcie: set MEM trans window[6]: cpu_addr = 0x3c000000, pci_addr = 0x3c000000, size = 0x4000000
[    3.361731] mtk-pcie-gen3 11310000.pcie: PCI host bridge to bus 0001:00
[    4.357358] mtk_soc_eth 15100000.ethernet: generated random MAC address 20:08:02:00:00:00
[    4.365549] mtk_soc_eth 15100000.ethernet: generated random MAC address 20:08:02:00:00:00
[    4.377540] mtk_soc_eth 15100000.ethernet eth0: mediatek frame engine at 0xffffffc085000000, irq 101
[    4.387188] mtk_soc_eth 15100000.ethernet eth1: mediatek frame engine at 0xffffffc085000000, irq 101
[    4.396835] mtk_soc_eth 15100000.ethernet eth2: mediatek frame engine at 0xffffffc085000000, irq 101
[    4.407436] MediaTek MT7988 PHY mt7530-0:00: probe with driver MediaTek MT7988 PHY failed with error -22
[    4.417277] MediaTek MT7988 PHY mt7530-0:01: probe with driver MediaTek MT7988 PHY failed with error -22
[    4.427090] MediaTek MT7988 PHY mt7530-0:02: probe with driver MediaTek MT7988 PHY failed with error -22
[    4.436884] MediaTek MT7988 PHY mt7530-0:03: probe with driver MediaTek MT7988 PHY failed with error -22
[    4.446421] mt7530-mmio 15020000.switch: configuring for fixed/internal link mode
[    4.453909] mt7530-mmio 15020000.switch: Link is Up - 10Gbps/Full - flow control rx/tx
[    4.454587] mt7530-mmio 15020000.switch wan (uninitialized): PHY [mt7530-0:00] driver [Generic PHY] (irq=POLL)
[    4.472873] mt7530-mmio 15020000.switch lan1 (uninitialized): PHY [mt7530-0:01] driver [Generic PHY] (irq=POLL)
[    4.483850] mt7530-mmio 15020000.switch lan2 (uninitialized): PHY [mt7530-0:02] driver [Generic PHY] (irq=POLL)
[    4.494814] mt7530-mmio 15020000.switch lan3 (uninitialized): PHY [mt7530-0:03] driver [Generic PHY] (irq=POLL)

I added these options to the config. I added CONFIG_MTK_CQDMA=y and the others on the same block thinking they would help with the errors, but did not.

CONFIG_ATH12K=m
#
CONFIG_MT792x_LIB=m
#
CONFIG_MT7921_COMMON=m
CONFIG_MT7921E=m
CONFIG_MT7925_COMMON=m
CONFIG_MT7925E=m
#
CONFIG_MT7996E=m
#
CONFIG_MTK_CQDMA=y
CONFIG_MTK_UART_APDMA=m
CONFIG_MTK_CMDQ=y
CONFIG_MTK_SVS=m
CONFIG_PHY_MTK_PCIE=m
CONFIG_PHY_MTK_UFS=m
#
CONFIG_USB_USBNET=m
CONFIG_USB_RTL8152=m
#
CONFIG_WIREGUARD=m
CONFIG_WIREGUARD_DEBUG=y

BTW, if i pack the kernel build in to a package, all i have to do to update the kernel is to upgrade it on the running system? Like, no extra files to edit? In case the kernel is the same version.

I ask this as i’ll transfer the install on microsd card to emmc.

Pcie errors are normal if there is no card in that slot (110 is timeout). Socinfo i already seen but not digged deeper,seens not needed. Mt753x is afair probed later again and then working.xsphy driver expects a ref clock,but mt7988 has none set in dts. Afaik not needed.

For install you should backup previous kernel (itb) as filename in package is bpi-r4.itb. you can also rename new file while unpacking,but then you have to change fit variable in uEnv.txt

1 Like

Looking at driver code ref-clock seems needed

But have not noticed any broken behaviour,from dts it is linked to first ssusb controller

Maybe it is the usb mapped to the top m.2 slot. But based on schematic it is the pcie from this and usb from hub port4,so xsphy possibly unused

Ok, so all good anyway, right?

imho for current state yes…not sure if xsphy and socinfo is needed

Ok.

Frank, an off topic matter, is firewalld / nftables working good for you? Right after a fresh install and installing firewalld,doing a firewall-cmd --add-interface=eth1 --zone=internal, throws an error.

Error: COMMAND_FAILED: 'python-nftables' failed: internal:0:0-0: Error: No such file or directory; did you mean chain ‘filter_IN_external’ in table inet ‘firewalld’?

internal:0:0-0: Error: No such file or directory; did you mean chain ‘filter_FWD_external_allow’ in table inet ‘firewalld’?

That only happens with zones internal ou home, not the other ones. I have opened a issue here: Error on debian 12 (arm64), Error: COMMAND_FAILED: 'python-nftables' failed · Issue #1410 · firewalld/firewalld · GitHub

This does not happen on a x64 machine.

i do not use firewalld (i’m using nftables) so cannot help here…no idea what firewalld tries to do here

i tested nftables on bpi-r3 and afair added kernel-options from r3 defconfig to the r4 one

1 Like

@frank-w What is the procedure for upgrading the kernel?

I built a deb package from your repo, but doing dpkg -i bananapi-r4-image-6.13-main_6.13.0-1_arm64.deb and rebooting, is not using that new kernel.

I also did these commands:

cp /boot/bananapi/bpi-r4/linux/dtb/bpi-r4-6.13.0-main.dtb     /boot/bpi-r4.dtb
cp /boot/bananapi/bpi-r4/linux/uEnv.txt   /boot/uEnv.txt
cp /boot/bananapi/bpi-r4/linux/uImage_6.13.0-main_nodt   /boot/uImage_nodt

Right now, there are these files on /boot:

/boot/
/boot/uEnv.txt
/boot/bpi-r4.dtb
/boot/uImage_nodt
/boot/bpi-r4.itb
/boot/bananapi
/boot/bananapi/bpi-r4
/boot/bananapi/bpi-r4/linux
/boot/bananapi/bpi-r4/linux/uEnv.txt
/boot/bananapi/bpi-r4/linux/dtb
/boot/bananapi/bpi-r4/linux/dtb/bpi-r4-6.13.0-main.dtb
/boot/bananapi/bpi-r4/linux/dtb/bpi-r4-6.12.7-main.dtb
/boot/bananapi/bpi-r4/linux/uImage_6.13.0-main_nodt
/boot/bananapi/bpi-r4/linux/uImage_6.12.7-main_nodt

I see there are references to the old kernel, 6.12.7 on the bpi-r4.itb file, but i don’t see a .itb file for the new kernel 6.13.

EDIT: Not sure if this matters, but i’m using Openwrt’s boot loader, as i used it to install Debian 12 in the EMMC.

SOLUTION: copy the new .itb file from compilation machine. `

scp ./build/bpi-r4.itb BANANA-R4:/boot

The itb is the important part,maybe it is missing in 6.13 somehow…needed to patch deb creation script to include the files,maybe something has changed recently. If the deb contains no itb there is the problem. If the itb has version in name (as i guess) you have to change fit var in uEnv.txt to boot it (of course it need to exist). The dtb/no_dt is not needed here,but created for compatibility reasons with r64 and for manual try to apply dtb

Ok, i just copied the .itb file from compilation machine and now 6.13 kernel boots.

scp ./build/bpi-r4.itb BANANA-R4:/boot

Yes,this is the way i use it too,but with install option to sdcard which installs modules too (which are installed through deb i guess) :slight_smile: but you should make backup of your last itb before overwriting it

For missing itb,i wonder why dtb and uimage_nodt are packed for r4 as this should be done only for r64 based on my patch

Maybe there are better ways.

1 Like