From: daniel.thompson@linaro.org (Daniel Thompson)
To: linux-arm-kernel@lists.infradead.org
Subject: Change of TEXT_OFFSET for multi_v7_defconfig
Date: Tue, 22 Apr 2014 12:41:01 +0100 [thread overview]
Message-ID: <5356554D.6030207@linaro.org> (raw)
In-Reply-To: <20140422104043.GT24070@n2100.arm.linux.org.uk>
On 22/04/14 11:40, Russell King - ARM Linux wrote:
> On Tue, Apr 22, 2014 at 11:26:53AM +0100, Daniel Thompson wrote:
>> On 18/04/14 05:34, Nicolas Pitre wrote:
>>>> I'm not suggesting to break anything or changing existing platforms,
>>>>> but how do we improve the Image format in a compatible way. If
>>>>> bootloaders want to support booting Image files or vmlinux directly,
>>>>> then we should support that including any compatible changes to make
>>>>> things work better.
>>> And why would bootloaders want that? Just to create confusion with
>>> the established boot protocol?
>>
>> I'd say that they don't. My original concern was how the different
>> architectures negotiate if more than one arch wants a special text
>> offset, not how to write a correct bootloader.
>>
>> The existing uImage files already provide sufficient information to load
>> the kernel regardless of the TEXT_OFFSET chosen by negotiation among the
>> enabled architectures.
>
> No. uImage merely specifies the address at which to load/execute the
> zImage, and more often than not this is a step which has to be done
> after kernel build as the kernel build does not have the information
> to be able to generate a uImage on its own. Also, a uImage generated
> for one platform will not necessarily boot on a different platform
> even though the contents of the uImage may be 100% identical apart
> from the header.
You were right about the typo but I'm afraid the location was much
earlier. Sorry! Replace uImage with the vmlinux ELF image and my last
post is not quite such nonsense.
>> The entry point is PAGE_OFFSET + TEXT_OFFSET and, although only
>> implicitly defined, the entry point cannot be set to any other value
>> without making a backward incompatible to arm/Booting:
>> "The boot loader is expected to call the kernel image by jumping
>> directly to the first instruction of the kernel image."
Although for this bit probably will always be nonsense.
>> Therefore providing PAGE_OFFSET remains 1G aligned and the hardware
>> meets the not-unreasonably-stupid test (i.e. TEXT_OFFSET < 1G) then
>> deriving the right value for TEXT_OFFSET is a trivial mask operation on
>> the entry point.
>
> PAGE_OFFSET doesn't have to be 1G aligned. As I've already pointed out
> in previous replies, PAGE_OFFSET is totally irrelevant in this discussion.
> PAGE_OFFSET is the *virtual* address of the RAM, and has no bearing what
> so ever on where you load the kernel image.
When trying to directly load an ELF image, where by default vaddr ==
paddr, its actually PAGE_OFFSET we're looking for. Combining that with
some platform specific knowledge about RAM (i.e. typical PHYS_OFFSET for
the platform) and we can derive sensible paddr values.
At the start of last week the loader I used assumed TEXT_OFFSET would be
0x8000 and used it to calculate PAGE_OFFSET from the ELF entry point.
So I guess what I have now is still broken just, not quite as obviously...
next prev parent reply other threads:[~2014-04-22 11:41 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 10:44 Change of TEXT_OFFSET for multi_v7_defconfig Daniel Thompson
2014-04-15 17:53 ` Stephen Boyd
2014-04-16 16:18 ` Christopher Covington
2014-04-16 19:14 ` Nicolas Pitre
2014-04-16 21:08 ` Christopher Covington
2014-04-16 21:36 ` Peter Maydell
2014-04-16 22:34 ` Russell King - ARM Linux
2014-04-16 22:33 ` Russell King - ARM Linux
2014-04-16 23:21 ` Nicolas Pitre
2014-04-17 18:33 ` Christopher Covington
2014-04-17 19:48 ` Nicolas Pitre
2014-04-17 20:49 ` Christopher Covington
2014-04-17 20:54 ` Peter Maydell
2014-04-17 20:35 ` Jason Gunthorpe
2014-04-22 9:44 ` Daniel Thompson
2014-04-22 17:05 ` Jason Gunthorpe
2014-04-22 17:55 ` Nicolas Pitre
2014-04-22 18:36 ` Russell King - ARM Linux
2014-04-22 14:50 ` [Qemu-devel] " Michal Simek
2014-04-22 17:00 ` Jason Gunthorpe
2014-04-22 17:11 ` Russell King - ARM Linux
2014-04-22 17:53 ` Jason Gunthorpe
2014-04-22 18:12 ` Russell King - ARM Linux
2014-04-22 18:32 ` Arnd Bergmann
2014-04-22 18:38 ` Russell King - ARM Linux
2014-04-22 18:45 ` Arnd Bergmann
2014-04-17 17:11 ` Rob Herring
2014-04-17 20:06 ` Nicolas Pitre
2014-04-17 20:16 ` Russell King - ARM Linux
2014-04-17 21:18 ` Rob Herring
2014-04-17 21:35 ` Russell King - ARM Linux
2014-04-18 2:53 ` Rob Herring
2014-04-18 4:34 ` Nicolas Pitre
2014-04-22 10:26 ` Daniel Thompson
2014-04-22 10:40 ` Russell King - ARM Linux
2014-04-22 11:41 ` Daniel Thompson [this message]
2014-04-18 8:41 ` Russell King - ARM Linux
2014-04-22 9:53 ` Daniel Thompson
2014-04-22 10:07 ` Russell King - ARM Linux
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=5356554D.6030207@linaro.org \
--to=daniel.thompson@linaro.org \
--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).