From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: Big endian working?
Date: Wed, 9 Apr 2014 07:30:16 +0200 [thread overview]
Message-ID: <20140409073016.72060cd3@skate> (raw)
In-Reply-To: <CAA3XUr3gR-R1X6+CxP-Z0fv7kiSzENtm0NsYd539BNVWKCgdNw@mail.gmail.com>
Dear Victor Kamensky,
On Tue, 8 Apr 2014 21:46:05 -0700, Victor Kamensky wrote:
> > If I remember correctly, those are for booting a BE kernel on hardware
> > that initializes in LE mode and expects a LE kernel. Since the zImage
> > header values are defined to be words, those must be swapped so they
> > read as LE even if the kernel is BE. Of course the kernel is then
> > responsible for switching the endian mode when entered.
>
> My understanding is that CPU_BE8_BOOT_LE was needed only for
> atags boot case. Since now practically nobody uses atags, but rather
> fdt those patches were not pushed into main stream.
Well it would still be nice to have ATAGs support, as a few people are
still using old, non fdt-capable bootloaders.
> Please look at
> git://git.baserock.org/delta/linux baserock/311-rc7/be/atags-v2
>
> Thomas, does your Armada XP uboot still uses atags? I would think
> not.
The bootloader is not doing FDT based booting, but in my BE kernel, I
have:
# CONFIG_ATAGS is not set
# CONFIG_ARM_ATAG_DTB_COMPAT is not set
So the kernel completely ignores the ATAGs.
> I can confirm that in main line TC2 works in BE mode without any
> changes. In linaro kernel tree we have Arandle and Pandaboard with
> additional, drivers only changes, and they work OK. However I don't
> think we are testing zImage, in all cases I use it, it is uImage.
>
> Maybe Nico's zImage change was under atags umbrella by mistake and
> it really addresses general zImage issue. In this case we need to add
> this commit to main line. However, I don't think we need to carry
> CPU_BE8_BOOT_LE option forward, why we just use
> CONFIG_CPU_BIG_ENDIAN instead. Note in all cases when BE
> image used loader is always in LE mode. Never seen case
> otherwise.
>
> As toolchain concerned any recent 4.7 and 4.8 should work. Note
> toolchain should may not be configured as BE by default. LE toolchain
> should compile BE kernel just fine.
Right, in the end, the BE kernel was working completely fine for me,
without any patches. The problem was due to a mistake made between the
load address and entry point address encoded into the uImage header vs.
the real address at which I was loading the uImage in memory. This was
leading the first 0x40 bytes of the kernel code to be skipped,
therefore skipping the "setend be" instructions.
The most amazing thing being that with a LE kernel, even if you skip
the first 0x40 bytes of the kernel code, it still boots completely
successfully! This is the reason why it took me so long to debug: if a
LE kernel is booting, and the same BE kernel with the same
configuration doesn't boot, surely it shouldn't be related to how/where
I load the kernel. But it was!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-04-09 5:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 7:54 Big endian working? Thomas Petazzoni
2014-04-08 9:14 ` Taras Kondratiuk
2014-04-08 19:03 ` Arnd Bergmann
2014-04-09 3:44 ` Nicolas Pitre
2014-04-09 4:46 ` Victor Kamensky
2014-04-09 5:30 ` Thomas Petazzoni [this message]
2014-04-09 7:09 ` Arnd Bergmann
2014-04-09 9:04 ` Taras Kondratiuk
2014-04-09 9:38 ` Arnd Bergmann
2014-04-09 16:17 ` Victor Kamensky
2014-04-09 16:35 ` Marc Zyngier
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=20140409073016.72060cd3@skate \
--to=thomas.petazzoni@free-electrons.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).