Re: [PATCH] ARM: zImage: ensure header in LE format for BE8 kernels

From: Kevin Hilman
Date: Wed Jun 18 2014 - 13:55:11 EST


On Thu, Apr 10, 2014 at 9:27 AM, Taras Kondratiuk
<taras.kondratiuk@xxxxxxxxxx> wrote:
> From: Nico Pitre <nico@xxxxxxxxxxx>
>
> All known BE8-capable systems have LE bootloaders, so we need to ensure
> that the magic number and image start/end values are in little endian
> format.
>
> [ben.dooks@xxxxxxxxxxxxxxx: from nico's original email on this subject]
> Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> [taras.kondratiuk@xxxxxxxxxx: removed lds.S->lds rule, added target to extra-y]
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@xxxxxxxxxx>

This patch has now hit -next (as of next-20140618) and I noticed all
my big-endian boot tests failed[1]. Turns out they failed because I'm
deciding whether to pass a big-endian or little-endian initramfs based
on the magic number of the zImage. Since it's now always little
endian, even the big-endian kernels were boot tested with a little
endian initramfs. And guess what.... they failed.

I like this patch for several reasons, including the fact that
u-boot's bootz support checks the magic number and failed before this
patch.

All of that to say, with this patch applied, I need a new (and
reliable) way to determine the endianness of a kernel just by looking
at the zImage. Recommendations welcome.

Thanks,

Kevin

[1] http://lists.linaro.org/pipermail/kernel-build-reports/2014-June/004059.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/