Subject: [PATCH 3/4] arm64: export effective Image size to bootloaders

From: [email-masked] (Mark Rutland)
Date: Fri, 20 Jun 2014 11:17:17 +0100

On Thu, Jun 19, 2014 at 07:07:48PM +0100, Geoff Levand wrote:
> Hi Mark,
> 
> On Thu, 2014-06-19 at 11:25 +0100, Mark Rutland wrote:
> > I disagree that the bootloader _must_ have to deal with the endianness
> > of the kernel. If the user knows the endianness of the kernel and
> > provides a filesystem of the appropriate endianness, I don't see why the
> > bootloader should have to do anything differently. In most cases the
> > bootloader has no need to care.
> 
> As I mentioned, I don't really care how this is fixed, but there will be
> bootloaders built as both big and little endian (kexec based ones for
> example), and so no matter what, bootloaders will need to deal with
> converting values.

Sure, bootloaders will need to convert values in some cases.

By having a fixed endian header format, whether or not you need to
byteswap values becomes a fixed property of the bootloader (i.e. whether
it is BE or not) rather than a dynamic property of the kernel Image. So
you only require a single path through your loader for BE and LE
kernels.

If you have constructs like LE64_TO_CPU available to your loader, then
it becomes trivial to write an endian-clean loader. The only pain is
having to test if image_size is non-zero first, but that test is
independent of endiannness.

Mark.