From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM big-endian on current kernels for linux-3.8
Date: Wed, 13 Feb 2013 11:00:01 +0000 [thread overview]
Message-ID: <511B7231.2090006@codethink.co.uk> (raw)
In-Reply-To: <alpine.LFD.2.03.1302121707250.1242@fluxnic.net>
On 12/02/13 22:13, Nicolas Pitre wrote:
> On Tue, 12 Feb 2013, Ben Dooks wrote:
>
>> If we ignore the ATAG issue, then most of the support is currently in
>> the kernel to do this and there's not a lot of changes.
>
> You could make CPU_BE8_BOOT_LE depend on !ATAG.
That would be one consideration. For my next series I've removed the
CPU_BE8_BOOT_LE and added the 'setend be' as conditional on running BE8
as this is such as small code addition it seems to make sense to do it
that way.
I will put together a new series that deals with the endian-ness of the
bootloader.
>> I think that some of the boot changes could be dealt with by a
>> post-process of the zImage (such as the zImage magic) which would make
>> this series less intrusive to the kernel.
>
> No, please don't do that. Especially if the kernel binary _expects_ to
> be booted from a LE environment. Otherwise we might end up with
> kernels that don't boot because there are environment expectation
> mismatch, etc.
>
> Here's what could be done for the zImage header:
I will keep this in mind, it looks like a pretty good solution to the
whole issue.
> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
> index 4d5f4192ee..2077ebb734 100644
> --- a/arch/arm/boot/compressed/head.S
> +++ b/arch/arm/boot/compressed/head.S
> @@ -129,9 +129,9 @@ start:
> THUMB( adr r12, BSYM(1f) )
> THUMB( bx r12 )
>
> - .word 0x016f2818 @ Magic numbers to help the loader
> - .word start @ absolute load/run zImage address
> - .word _edata @ zImage end address
> + .word _magic_sig @ Signature to help the loader (0x016f2818)
> + .word _magic_start @ zImage load/run address (0 if relocatable)
> + .word _magic_end @ zImage end address
> THUMB( .thumb )
> 1:
> mrs r9, cpsr
> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
> index a517153a13..52539f46c1 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -200,8 +200,11 @@ CFLAGS_font.o := -Dstatic=
> $(obj)/font.c: $(FONTC)
> $(call cmd,shipped)
>
> -$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
> +$(obj)/vmlinux.lds.S: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
> @sed "$(SEDFLAGS)"< $< > $@
>
> +$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.S
> + $(call if_changed,cpp_lds_S)
> +
> $(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S
> $(call cmd,shipped)
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
> index 4919f2ac8b..567250fb7d 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.in
> +++ b/arch/arm/boot/compressed/vmlinux.lds.in
> @@ -7,6 +7,16 @@
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation.
> */
> +
> +#ifdef CONFIG_CPU_BE8_BOOT_LE
> +#define ZIMAGE_MAGIC(x) ( (((x)>> 24)& 0x000000ff) | \
> + (((x)>> 8)& 0x0000ff00) | \
> + (((x)<< 8)& 0x00ff0000) | \
> + (((x)<< 24)& 0xff000000) )
> +#else
> +#define ZIMAGE_MAGIC(x) (x)
> +#endif
> +
> OUTPUT_ARCH(arm)
> ENTRY(_start)
> SECTIONS
> @@ -57,6 +67,10 @@ SECTIONS
> .pad : { BYTE(0); . = ALIGN(8); }
> _edata = .;
>
> + _magic_sig = ZIMAGE_MAGIC(0x016f2818);
> + _magic_start = ZIMAGE_MAGIC(_start);
> + _magic_end = ZIMAGE_MAGIC(_edata);
> +
> . = BSS_START;
> __bss_start = .;
> .bss : { *(.bss) }
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
next prev parent reply other threads:[~2013-02-13 11:00 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 23:17 ARM big-endian on current kernels for linux-3.8 Ben Dooks
2013-02-08 23:17 ` [PATCH 01/17] ARM: add CPU_BE8_BOOT_LE configuration Ben Dooks
2013-02-09 4:10 ` Nicolas Pitre
2013-02-09 16:46 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 02/17] ARM: set BE8 if LE in head code Ben Dooks
2013-02-09 3:33 ` Nicolas Pitre
2013-02-09 16:47 ` Ben Dooks
2013-02-09 21:38 ` Rob Herring
2013-02-09 21:56 ` Ben Dooks
2013-02-11 19:35 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 03/17] ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-02-08 23:17 ` [PATCH 04/17] ARM: Add ARCH_SUPPORTS_BIG_ENDIAN Ben Dooks
2013-02-09 11:55 ` Russell King - ARM Linux
2013-02-09 16:55 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 05/17] ARM: fixup_pv_table bug when CPU_ENDIAN_BE8 Ben Dooks
2013-02-09 3:40 ` Nicolas Pitre
2013-02-11 19:11 ` Ben Dooks
2013-02-12 21:45 ` Nicolas Pitre
2013-02-08 23:17 ` [PATCH 06/17] ARM: fixup head for atag verification Ben Dooks
2013-02-09 3:51 ` Nicolas Pitre
2013-02-09 17:09 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 07/17] ARM: twd: data endian fix Ben Dooks
2013-02-08 23:17 ` [PATCH 08/17] ARM: smp_scu: data endian fixes Ben Dooks
2013-02-08 23:17 ` [PATCH 09/17] ARM: add atag32_to_cpu() function Ben Dooks
2013-02-09 3:57 ` Nicolas Pitre
2013-02-09 12:03 ` Russell King - ARM Linux
2013-02-11 19:15 ` Ben Dooks
2013-02-11 19:30 ` Russell King - ARM Linux
2013-02-12 18:46 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 20:34 ` Russell King - ARM Linux
2013-02-08 23:17 ` [PATCH 10/17] ARM: update atag-to-fdt code to be endian agnostic Ben Dooks
2013-02-09 3:57 ` Nicolas Pitre
2013-02-09 12:05 ` Russell King - ARM Linux
2013-02-11 19:16 ` Ben Dooks
2013-02-12 21:53 ` Nicolas Pitre
2013-02-13 11:27 ` Ben Dooks
2013-02-14 4:43 ` Nicolas Pitre
2013-02-15 11:28 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 11/17] ARM: fixup atags " Ben Dooks
2013-02-09 4:03 ` Nicolas Pitre
2013-02-09 12:06 ` Russell King - ARM Linux
2013-02-08 23:17 ` [PATCH 12/17] ARM: fix magic for bootloader in BE8 Ben Dooks
2013-02-09 4:06 ` Nicolas Pitre
2013-02-09 12:08 ` Russell King - ARM Linux
2013-02-12 18:50 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-12 18:54 ` Ben Dooks
2013-02-12 19:52 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-11 19:17 ` Ben Dooks
2013-02-12 21:57 ` Nicolas Pitre
2013-02-08 23:17 ` [PATCH 13/17] ARM: pl01x debug code endian fix Ben Dooks
2013-02-09 12:09 ` Russell King - ARM Linux
2013-02-11 19:19 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 14/17] highbank: enable big-endian Ben Dooks
2013-02-09 21:33 ` Rob Herring
2013-02-09 22:00 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 15/17] xgmac: fix printing of hardware version Ben Dooks
2013-02-09 12:10 ` Russell King - ARM Linux
2013-02-09 17:20 ` Ben Dooks
2013-02-09 21:35 ` Rob Herring
2013-02-08 23:17 ` [PATCH 16/17] xgmac: replace __raw with relaxed IO Ben Dooks
2013-02-09 20:59 ` Rob Herring
2013-02-09 22:03 ` Ben Dooks
2013-02-08 23:17 ` [PATCH 17/17] mvebu: support running big-endian Ben Dooks
2013-02-12 17:08 ` ARM big-endian on current kernels for linux-3.8 Thomas Petazzoni
2013-02-12 17:25 ` Ben Dooks
2013-02-12 18:49 ` Thomas Petazzoni
2013-02-12 18:54 ` Ben Dooks
2013-02-13 9:48 ` Thomas Petazzoni
2013-02-12 17:13 ` Russell King - ARM Linux
2013-02-12 17:33 ` Ben Dooks
2013-02-12 22:13 ` Nicolas Pitre
2013-02-13 11:00 ` Ben Dooks [this message]
2013-02-13 10:24 ` Matthieu CASTET
2013-02-13 11:18 ` Ben Dooks
2013-02-13 15:52 ` Catalin Marinas
2013-02-13 16:02 ` Ben Dooks
2013-02-13 16:03 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=511B7231.2090006@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.