Device tree flattening code not copying properties from blob

Grant Likely grant.likely at secretlab.ca
Sun Jun 16 05:53:47 EST 2013


On Fri, Jun 14, 2013 at 4:55 PM, Collins, Rod
<Rod.Collins at saabsensis.com> wrote:
> Grant
>
> That makes perfect sense, but I find that the DTB is included in the
> vmlinux.lds.h file which lives in source/include/asm-generic.
>
> This seems to always want to put the dtb in the init section which gets
> removed. To fix this the asm-generic/vmlinux.lds.h file would need to be
> changed.
>
> Forgive me ahead of time for not understanding all of the versions and
> the intents. We are using the 3.7 kernel in the uCLinux distribution.
>
> It seems to me that it should always be added to rodata when linked in,
> unless it is passed as a command line parameter?

Linking the DTB into the kernel-proper (by that I mean the vmlinux
binary) is actually not the typical use case for DT. Normally the DTB
is either passed in by the bootloader (preferred), or attached (not
linked) to the kernel binary as part of the zImage wrapper (for
backwards compatibility with non-DT enabled bootloaders). Both PowerPC
and ARM support both methods. Linking into the vmlinux image has
problems that I've discussed in my other reply. If the linked-in
method is used, then it is *required* for the kernel to copy it into
safe memory before unflattening the tree. The assumption with the
dtb.S target is that multiple DTBs may be linked into the kernel, but
only one will actually get used. In that situation the kernel should
discard all the unused DTB data. The easiest way to do that is put all
the DTBs in the __init rodata section and then copy only the DTB that
is actually used.

g.


More information about the devicetree-discuss mailing list