[PATCH] armv7: Add Position Independent Execution support

Peng Fan (OSS) peng.fan at oss.nxp.com
Tue Aug 3 08:02:17 CEST 2021



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?

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