[PATCH] armv7: Add Position Independent Execution support

ChiaWei Wang chiawei_wang at aspeedtech.com
Tue Aug 3 08:17:22 CEST 2021


Hi Peng,

> -----Original Message-----
> From: Peng Fan (OSS) <peng.fan at oss.nxp.com>
> Sent: Tuesday, August 3, 2021 2:02 PM
> 
> 
> On 2021/8/3 5:30, Tom Rini wrote:
> > 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.
> 
> How? When flash got corrupted, how do you manage to load the golden
> image?

AST2600 supports boot-from-UART through HW strap.
When boot-from-UART is enabled for recovery purposes, the ROM code receives image data bytes from UART and put them into SRAM for execution.
In addition, if secure boot is also enabled, the image sent has to be signed and be verified by the public key programmed in OTP.

As AST2600 is based on ARMv7 architecture, this patch is implemented for.

Regards,
Chiawei

> 
> >>
> >> 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.
> >


More information about the U-Boot mailing list