[PATCH] armv7: Add Position Independent Execution support

ChiaWei Wang chiawei_wang at aspeedtech.com
Tue Aug 3 02:51:35 CEST 2021


Hi Tom,

> From: Tom Rini <trini at konsulko.com>
> Sent: Tuesday, August 3, 2021 5:31 AM
> On Mon, Aug 02, 2021 at 06:44:57PM +0800, Chia-Wei Wang wrote:
> > A U-Boot image could be loaded and executed at a different location
> > than it was linked at.
> >
> > For example, Aspeed takes a stable release version of U-Boot image as
> > the golden one for recovery purposes. When the primary storage such as
> > flash is corrupted, the golden image could be loaded to any SRAM/DRAM
> > address on demands through ethernet/UART/etc.
> >
> > To deal with this condition, the PIE is needed as there is only one
> > signed, golden image, which could be however executed at different
> > places.
> >
> > This patch adds the PIE support for ARMv7 platform.
> >
> > Signed-off-by: Chia-Wei Wang <chiawei_wang at aspeedtech.com>
> > ---
> >  arch/arm/Kconfig           |  4 +++-
> >  arch/arm/cpu/armv7/start.S | 43
> ++++++++++++++++++++++++++++++++++++++
> >  arch/arm/lib/crt0.S        | 11 ++++++++++
> >  arch/arm/lib/relocate.S    | 35 ++++++++++++++++++++++---------
> >  4 files changed, 82 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index
> > 2b7b625705..45879c9f06 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -9,7 +9,7 @@ config ARM64
> >  	select PHYS_64BIT
> >  	select SYS_CACHE_SHIFT_6
> >
> > -if ARM64
> > +if ARM64 || CPU_V7A
> >  config POSITION_INDEPENDENT
> >  	bool "Generate position-independent pre-relocation code"
> >  	help
> 
> Thanks for doing this.  I think we need to fix the depends on lines here rather
> than hide with if ARM64 || CPU_V7A, and then fix anything else that follows to
> also have the correct dependencies.

Thanks for reviewing this. I will prepare a v2 patch to include the 'depends on' fix.

Regards,
Chiawei


More information about the U-Boot mailing list