[PATCH] arm64: head: set TEXT_OFFSET to the historical value

Ard Biesheuvel ardb at kernel.org
Mon Oct 6 16:46:08 PDT 2025


On Mon, 6 Oct 2025 at 16:01, Will Deacon <will at kernel.org> wrote:
>
> [+Ard and Mark]
>
> On Mon, Oct 06, 2025 at 01:21:04AM +0300, Dmitry Baryshkov wrote:
> > From: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
> >
> > Historically arm64 kernel contained (almost fixed) value of 0x8000 at
>
> 0x8000 or 0x80000?
>
> > the TEXT_OFFSET. The commit cfa7ede20f13 ("arm64: set TEXT_OFFSET to 0x0
> > in preparation for removing it entirely") and then commit 120dc60d0bdb
> > ("arm64: get rid of TEXT_OFFSET") replaced this field with 0.
>
> Given that we made the initial change over five years ago, I'm struggling
> to see why we should start caring about old broken bootloaders _now_.
>
> In fact, I'm far more concerned about changing this to a non-zero value
> and having more recent bootloaders misbehave.
>
> > This caused no problems so far, because nobody seemed to be playing with
> > the extremely picky Qualcomm bootloader as used on some of Google Pixel
> > phones. Current attempting to boot the Linux kernel on those devices
> > will fail to load on those phones with the following message:
> >
> > KernelDecompress failed: Invalid Parameter Kernel TextOffset does not match
> > Error calling BootPrepareAsync Invalid Parameter
> >
> > Since the kernel ignores the field, set it to the expected value of
> > 0x8000, unbreaking boot of upstream kernels on Qualcomm devices.
>
> (same typo)
>

Just setting the header field and not updating the base address also
means that the boot breaks without CONFIG_RELOCATABLE, and you will
get a warning in the kernel log about the load address not being
aligned to 2 MiB.

So I don't think this is the right solution.

If this is really something that needs to be fixed upstream, we should
just bring back TEXT_OFFSET in its entirety, but I'm not convinced
that this is really justified here. As a workaround, you could just
add 2 MiB - 0x80000 bytes of padding at the start of the image, and
add your own header (as Will alludes to as well)



More information about the linux-arm-kernel mailing list