radxa-pkg / radxa-overlays

Additional device tree overlays to support different hardwares on Radxa products
GNU General Public License v2.0
27 stars 24 forks source link

u-boot not accepting overlay #334

Open CT1IQI opened 2 weeks ago

CT1IQI commented 2 weeks ago

Situation: image compiled with Armbian build system, Edge for Radxa Rock 5C board. Custom overlay, based on examples given here, compiled fine. The image uses u-boot downloaded from Radxa on github. But u-boot gives an error when trying to do the overlay as defined in armbianEnv.txt. After a lot of trial and error found what the problem was. Not in the syntax of the overlay but in the 'compatible =' line in the metadata section. What is given there has to match what is in the compatible line in the underlying board's dts. In my case that is compatible = "radxa,rock-5c", "rockchip,rk3588s"; The overlay had: compatible = "radxa,rock-5a", "radxa,rock-5c"; u-boot did not accept this discrepancy. Please document this clearly as it is hard to find due to the error message giving no clues.

RadxaYuntian commented 1 week ago

Please give me the name of the overlay file as well as the targeted device. This is not an issue that we have encountered with our systems during testing.

RadxaYuntian commented 1 week ago

Further metadata is a custom data block we defined ourselves. It has no real meaning in the device tree schema, so I don't understand how it is connected to another field in the base device tree. From the device tree's standpoint it is no different from another fan node which will obviously have a different compatible string.

CT1IQI commented 1 week ago

Hi Yuntian,

well, to figure out why u-boot was not doing the overlay I made it simpler and just took a very short one from this repository. It only started working when I had changed the compatible line under metadata to exactly match the compatible line in the board's device tree, in my case a Rock 5C with its dts as defined in Armbian.

Then made that same change to my more complicated overlay, spi4m2 with mcp2515 for CANbus, and it worked. As it is u-boot doing this stuff, one would have to check there what it is doing with the metadata contents. I can just say from experience, and a hint in the right direction I found googling, that apparently the metadata in the overlay are being interpreted.

On Sun, 2024-06-23 at 18:53 -0700, ZHANG Yuntian wrote:

Further metadata is a custom data block we defined ourselves. It has no real meaning in the device tree schema, so I don't understand how it is connected to another field in the base device tree. From the device tree's standpoint it is no different from another fan node which will obviously have a different compatible string. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

CodeChenL commented 1 week ago

@CT1IQI , I tried to enable https://github.com/radxa-pkg/radxa-overlays/blob/3dd8baf16bf16543e0ca812f1a058289813746f4/arch/arm64/boot/dts/rockchip/overlays/rock-5a-radxa-camera-4k.dts#L12 , and uboot loads overlays fine:

U-Boot rknext-2017.09-31-5202c42-g6880b24 #runner (Jun 27 2024 - 02:07:51 +0000)

Model: Radxa ROCK 5C
MPIDR: 0x81000000
PreSerial: 2, raw, 0xfeb50000
DRAM:  8 GiB
Sysmem: init
Relocation Offset: eda3a000
Relocation fdt: eb9f93e0 - eb9fecd8
CR: M/C/I
Using default environment

DM: v2
mmc@fe2c0000: 1, mmc@fe2e0000: 0
Bootdev(atags): mmc 0
MMC0: HS400 Enhanced Strobe, 200Mhz
PartType: EFI
No misc partition
boot mode: normal
FIT: No boot partition
Failed to load DTB, ret=-2
No valid DTB, ret=-22
Failed to get kernel dtb, ret=-22
Model: Radxa ROCK 5C
MPIDR: 0x81000000
starting USB...
Bus usb@fc800000: USB EHCI 1.00
Bus usb@fc840000: USB OHCI 1.0
Bus usb@fc880000: USB EHCI 1.00
Bus usb@fc8c0000: USB OHCI 1.0
scanning bus usb@fc800000 for devices... 2 USB Device(s) found
scanning bus usb@fc840000 for devices... 1 USB Device(s) found
scanning bus usb@fc880000 for devices... 1 USB Device(s) found
scanning bus usb@fc8c0000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
No usb mass storage found
CLK: (sync kernel. arm: enter 1008000 KHz, init 1008000 KHz, kernel 0N/A)
  b0pll 24000 KHz
  b1pll 24000 KHz
  lpll 24000 KHz
  v0pll 24000 KHz
  aupll 24000 KHz
  cpll 1500000 KHz
  gpll 1188000 KHz
  npll 24000 KHz
  ppll 1100000 KHz
  aclk_center_root 702000 KHz
  pclk_center_root 100000 KHz
  hclk_center_root 396000 KHz
  aclk_center_low_root 500000 KHz
  aclk_top_root 750000 KHz
  pclk_top_root 100000 KHz
  aclk_low_top_root 396000 KHz
Net:   No ethernet found.
Hit Ctrl+C key in 0 seconds to stop autoboot...

Device 0: unknown device
MMC: no card present
mmc_init: -123, time 1
pcie@fe190000: PCIe-0 Link Fail

Device 0: unknown device
pcie@fe190000: failed to find reset-gpios property

Device 1: unknown device
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:2...
Scanning mmc 0:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
1221 bytes read in 3 ms (397.5 KiB/s)
U-Boot menu
1:      Debian GNU/Linux 12 (bookworm) 6.1.43-12-rk2312
2:      Debian GNU/Linux 12 (bookworm) 6.1.43-12-rk2312 (rescue target)
Enter choice: 1:        Debian GNU/Linux 12 (bookworm) 6.1.43-12-rk2312
Retrieving file: /boot/initrd.img-6.1.43-12-rk2312
16007924 bytes read in 58 ms (263.2 MiB/s)
Retrieving file: /boot/vmlinuz-6.1.43-12-rk2312
35181056 bytes read in 124 ms (270.6 MiB/s)
append: root=UUID=4a435c4c-be8d-491e-b090-5e0ffe496f4f console=ttyFIQ0,1500000n8 quiet splash loglevel=4 rw earlycon consoleblank=0 console=tty1 coherent_pool=2M irqchip.gicv3_pseudo_nmi=0 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
Retrieving file: /usr/lib/linux-image-6.1.43-12-rk2312/rockchip/rk3588s-rock-5c.dtb
234489 bytes read in 68 ms (3.3 MiB/s)
Retrieving file: /boot/dtbo/rock-5a-radxa-camera-4k.dtbo
5023 bytes read in 12 ms (408.2 KiB/s)
Fdt Ramdisk skip relocation
No misc partition
## Flattened Device Tree blob at 0x08300000
   Booting using the fdt blob at 0x08300000
   reserving fdt memory region: addr=8300000 size=3c000
   Using Device Tree in place at 0000000008300000, end 000000000833efff
## reserved-memory:
  ramoops@110000: addr=110000 size=e0000
Adding bank: 0x00200000 - 0xf0000000 (size: 0xefe00000)
Adding bank: 0x100000000 - 0x200000000 (size: 0x100000000)
Adding bank: 0x2f0000000 - 0x300000000 (size: 0x10000000)
Total: 7117.374/7383.468 ms

Starting kernel ...