[PATCH] cpu: imx8_cpu: Avoid revision to corrupt device tree

Peng Fan peng.fan at nxp.com
Thu Oct 17 05:07:55 CEST 2024


> Subject: Re: [PATCH] cpu: imx8_cpu: Avoid revision to corrupt device
> tree
> 
> On Thu, Oct 17, 2024 at 01:10:02AM +0000, Peng Fan wrote:
> > > Subject: Re: [PATCH] cpu: imx8_cpu: Avoid revision to corrupt
> device
> > > tree
> > >
> > > On Sat, Oct 12, 2024 at 12:16:14AM +0000, Peng Fan wrote:
> > > > > Subject: Re: [PATCH] cpu: imx8_cpu: Avoid revision to corrupt
> > > device
> > > > > tree
> > > > >
> > > > > > Why isn't this padding and alignment with the BSS being
> taken
> > > care
> > > > > of
> > > > > > in either the linker script or the binman dts?
> > > >
> > > > Sorry, I am not sure what you mean.
> > >
> > > I mean, why are things placed in this position to start with? Why is
> > > the device tree not already in a place where we aren't smashing it
> > > at run time? Is this a problem of the alignment / placement of items
> in a blob?
> > > A runtime placement problem? What?
> >
> > Whether binman or not. I think u-boot.dtb is padded just end of
> > u-boot-nodtb.bin. Not alignment or else.
> >
> > This is a common issue, bss should not be written before reloc_fdt.
> 
> It's possible I'm missing the examples in my quick grep right now but,
> yes, why are you needing to make this device tree change so early? We
> should not be using the "put this in the data section" kludge unless
> strictly necessary. Why is this necessary and cannot wait until, well,
> further along in the boot? This is supposed to be for pre-DRAM-
> initialization stuff.

You may misunderstand.
It is imx8_cpu driver probe at pre reloc stage before reloc_fdt,
so the written to bss area in imx8_cpu driver will corrupt device
tree which padded after u-boot-nodtb.bin.

Then after reloc_fdt, the new dtb is actually a broken one.

Regards,
Peng.


> 
> --
> Tom


More information about the U-Boot mailing list