Need help with FDT overlay

Matwey V. Kornilov matwey.kornilov at gmail.com
Sun Mar 22 12:03:38 CET 2026


сб, 21 мар. 2026 г. в 22:21, Simon Glass <sjg at chromium.org>:
>
> Hi Matwey,
>
> On Sat, 21 Mar 2026 at 11:20, Matwey V. Kornilov
> <matwey.kornilov at gmail.com> wrote:
> >
> > I compile dtbo as the following;
> >
> > cpp -x assembler-with-cpp -I /home/matwey/lab/linux/include
> > overlay.dtso overlay.i
> > dtc -@ -O dtb -o overlay.dtbo overlay.i
> >
> > Decompiled overlay.dtbo looks like this:
> >
> > /dts-v1/;
> >
> > / {
> >
> >     fragment at 0 {
> >         target = <0xffffffff>;
> >
> >         __overlay__ {
> >             status = "okay";
> >         };
> >     };
> >
> >     fragment at 1 {
> >         target = <0xffffffff>;
> >
> >         __overlay__ {
> >             status = "okay";
> >         };
> >     };
> >
> >     fragment at 2 {
> >         target-path = "/";
> >
> >         __overlay__ {
> >
> >             i2c-gpio {
> >                 compatible = "i2c-gpio";
> >                 sda-gpios = <0xffffffff 0x08 0x00 0x06>;
> >                 scl-gpios = <0xffffffff 0x08 0x0f 0x06>;
> >                 i2c-gpio,delay-us = <0x02>;
> >                 #address-cells = <0x01>;
> >                 #size-cells = <0x00>;
> >                 status = "okay";
> >                 phandle = <0x01>;
> >             };
> >         };
> >     };
> >
> >     __symbols__ {
> >         i2c_gpio = "/fragment at 2/__overlay__/i2c-gpio";
> >     };
> >
> >     __fixups__ {
> >         i2c0 = "/fragment at 0:target:0";
> >         i2c1 = "/fragment at 1:target:0";
> >         pio = "/fragment at 2/__overlay__/i2c-gpio:sda-gpios:0",
> > "/fragment at 2/__overlay__/i2c-gpio:scl-gpios:0";
> >     };
> > };
> >
> >
> > I am not sure about the size. How do I check it correctly? Now, I just do
> >
> > fdt resize 16384
> >
> > сб, 21 мар. 2026 г. в 18:02, Simon Glass <sjg at chromium.org>:
> > >
> > > Hi Matwey,
> > >
> > > On Sat, 21 Mar 2026 at 06:55, Matwey V. Kornilov
> > > <matwey.kornilov at gmail.com> wrote:
> > > >
> > > > Hello,
> > > >
> > > > I am running U-boot 2026.01 with orangepi_zero2w config and I am
> > > > trying to apply my hand-written dtbo via fdt apply.
> > > > The issue is that the fdi apply command just hangs forever for me. The
> > > > issue only appears when I try to append a new node to the root. How
> > > > could I find what is going wrong here?
> > > >
> > > > The overlay source is the following:
> > > >
> > > > /dts-v1/;
> > > > /plugin/;
> > > >
> > > > #include <dt-bindings/i2c/i2c.h>
> > > > #include <dt-bindings/gpio/gpio.h>
> > > >
> > > >
> > > > &i2c0 {
> > > >     status = "okay";
> > > > };
> > > >
> > > > &i2c1 {
> > > >     status = "okay";
> > > > };
> > > >
> > > > &{/} {
> > > >     i2c_gpio: i2c-gpio {
> > > >         compatible = "i2c-gpio";
> > > >         sda-gpios = <&pio 8 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; // PI0  (29)
> > > >         scl-gpios = <&pio 8 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; // PI15 (31)
> > > >         i2c-gpio,delay-us = <2>;        /* ~100 kHz */
> > > >         #address-cells = <1>;
> > > >         #size-cells = <0>;
> > > >         status = "okay";
> > > >     };
> > > > };
> > > >
> > >
> > > Can you provide thte dtc command you are using to build this? Is there
> > > enough spare space in the dtb? I'm not sure what would cause it to
> > > hang.
> > >
> > > Regards,
> > > Simon
>
> It might help to have the console log too. I can't see any way this
> can hang unless the addreses are wrong and something important is
> overwritten.
>
> Try this to see the address:
>
> fdt header
>
> Compare to 'meminfo' so you can tell that there is nothing important
> above the fdt. Also where do you load the overlay?
>

Hi,

I guess I found my mistake. I've been trying to apply the overlay to
${fdtcontroladdr}. It has been working while I updated only existing
nodes.

Now, I do the following:

cp.b ${fdtcontroladdr} ${fdt_addr_r} 0x8000
fdt addr ${fdt_addr_r}
fdt resize 10000
fdt apply ${fdtoverlay_addr_r}

I am not sure if there is a better way


> BTW U-Boot uses hex, so it should be 'fdt resize 4000'

Then doc/usage/fdt_overlays.rst should be improved because now it says
'fdt resize 8192'.

>
> Regards,
> Simon



-- 
With best regards,
Matwey V. Kornilov


More information about the U-Boot mailing list