<p><br>
On Jan 19, 2011 3:43 AM, "Dave Martin" <<a href="mailto:dave.martin@linaro.org">dave.martin@linaro.org</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> Apologies if this has been discussed before--- I don't see an obvious<br>
> rebuttal in my quick searching past threads, so I'll just quickly ask<br>
> the question:<br>
><br>
> Could we use host-endianness for the device tree binary blob?</p>
<p>Hi David.</p>
<p>This has been discussed thoroughly and rejected. The dtb isn't so much bigendian as it is network byte order. While we /could/ switch it for arm, it creates all kinds of problems with tools and working with .dtb files on dissimilar platforms. Plus all the property values must remain in BE because all the bindings are already defined that way in the OpenFirmware specifications.</p>
<p>Besides, there is no real advantage to changing it: it already works as-is on le architectures. :-)</p>
<p>g.</p>
<p>><br>
> The fdt binary format seems to lend itself strongly to a host-endian<br>
> format: it begins with a word-sized magic number, and when parsing the<br>
> device tree every elements type and size is known before that element<br>
> is read; furthermore, every element is size-aligned. Therefore, I<br>
> (naively?) presume that a little-endian format should "just work",<br>
> simply by flipping the endianness of every element and discarding all<br>
> the __be32_to_cpu() type stuff when reading the fdt at boot time. The<br>
> magic number ensures that there's no risk of accidentally reading the<br>
> fst in the wrong byte order.<br>
><br>
> Although it would be necessary to augment the fdt tools to cope with<br>
> this, offline tools appear to be the right place to put this<br>
> intelligence. For the kernel to flip the byte order of everything in<br>
> the fdt blob every time the system boots just seems unnecessary when<br>
> the required endianness is statically known.<br>
><br>
> Since fdt is new on ARM we have an opportunity to change determine the<br>
> binary format now without breaking anything in the field -- we don't<br>
> necessarily have to adopt the host-endian format on any other<br>
> architectures if it's not desirable.<br>
><br>
> Any thoughts?<br>
><br>
> Cheers<br>
> ---Dave<br>
><br>
> _______________________________________________<br>
> linux-arm-kernel mailing list<br>
> <a href="mailto:linux-arm-kernel@lists.infradead.org">linux-arm-kernel@lists.infradead.org</a><br>
> <a href="http://lists.infradead.org/mailman/listinfo/linux-arm-kernel">http://lists.infradead.org/mailman/listinfo/linux-arm-kernel</a><br>
</p>