[boot-wrapper PATCH 07/12] aarch64: respect text offset

Mark Rutland mark.rutland at arm.com
Fri Jul 30 08:43:00 PDT 2021


On Fri, Jul 30, 2021 at 04:13:38PM +0100, Andre Przywara wrote:
> On Thu, 29 Jul 2021 16:20:45 +0100
> Mark Rutland <mark.rutland at arm.com> wrote:
> 
> > The boot-wrapper assumes that an AArch64 kernel's text offset is 0x80000
> > rather than reading the `text_offset` field from the Image header as the
> > documentation says it should.
> > 
> > Add a script to figure this out during the build process. As with FDT.pm
> > the parsing of the Image (and common logic associated with this) is
> > factored into a module that we may use in more scripts in future.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > ---
> >  Makefile.am                 |  4 +--
> >  scripts/AA64Image.pm        | 87 +++++++++++++++++++++++++++++++++++++++++++++
> >  scripts/aa64-load-offset.pl | 28 +++++++++++++++
> >  3 files changed, 117 insertions(+), 2 deletions(-)
> >  create mode 100755 scripts/AA64Image.pm
> >  create mode 100755 scripts/aa64-load-offset.pl

> > +sub get_load_offset
> > +{
> > +	my $self = shift;
> > +	my $min = shift;
> > +	my $offset = $self->get_text_offset();
> > +
> > +	if ($min < $offset) {
> 
> So this should be ($min <= $offset), otherwise a kernel with
> TEXT_OFFSET 0x80000 needlessly gets loaded up to 2.5MB.

Good spot; I've fixed that up locally.

> Otherwise looks good and seems to handle the cases I tested correctly.

Great!

Thanks,
Mark.



More information about the linux-arm-kernel mailing list