It took me so much time do discover this, buuuut, after a while I was able to do it. Originally I did this over the lichee linux, but can be done for any board.
Tihs solution works on Ubuntu, becuase their images use grub.
Problem
It is necessary to configure the registers and the peripherals on device-tree. The common, and recommended, is to load an overlay. This can be done with U-Boot. However there are multiples ways to add the device-tree overlay, and this may not work. So I did a work-around that is working. This solution works in every subsystem because is exactly to copy the original devicetree, modify, and then upload that replacement.
The steps are:
- Discover where the overlay is run. This can be in U-boot, EFI (not sure), or grub.
- Modify the path of the overlay. On grub is like 20230805 - Grub for adding devicetree overlays
- Get the previous and working overlay. This is created by the manufacturer. And we can get it back from the system like
dtc -I fs /proc/device-tree
- Modify that overlay with your things. I put as a test one led with default-state on
- Compile it like
dtc -@ -I dts -O dtb -o test.dtb test.dts
- Modify the grub/u-boot to run your modified device tree
- Test it.