[U-Boot] [BUG] Odroid-C2 does not boot with U-Boot master anymore

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Dec 9 12:55:48 UTC 2018


On 12/9/18 1:16 AM, Alexander Graf wrote:
> 
> 
> On 08.12.18 14:16, Heinrich Schuchardt wrote:
>> Hello Alex,
>>
>> the patch 7a82c3051c8f ("efi_loader: Align runtime section to 64kb")
>> currently breaks booting Linux on the Odroid-C2.
>>
>> Output stops for kernel 4.18 after earlycon is replaced:
>> [    0.012518] console [tty0] enabled
>> [    0.015923] bootconsole [meson0] disabled
>> Without your patch it continues.
>>
>> The calculation introduced by the patch does what is expected:
>> ram_start = 0x0000000000000000
>> ram_end = 0x0000000080000000
>> __efi_runtime_start = 0x000000007ff67118
>> ~runtime_mask = 0xffffffffffff0000
>> runtime_start = 0x000000007ff60000
>> runtime_end = 0x000000007ff70000
>>
>> These two memory reservation do not conflict with addresses in question:
>> arch/arm/mach-meson/board-common.c(60) meson_board_add_reserved_memory:
>> 0x0000000000000000-0x0000000001000000
>> arch/arm/mach-meson/board-common.c(60) meson_board_add_reserved_memory:
>> 0x0000000010000000-0x0000000010200000
> 
> I'll write up a nice patch description after some sleep, but here's at
> least something that makes it work again for me:
> 
> diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
> index 95844efdb0..4f2aa9deda 100644
> --- a/lib/efi_loader/efi_runtime.c
> +++ b/lib/efi_loader/efi_runtime.c
> @@ -436,8 +436,13 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
>  			uint32_t descriptor_version,
>  			struct efi_mem_desc *virtmap)
>  {
> +#if defined(__aarch64__)
> +	unsigned long runtime_mask = SZ_64K - 1;
> +#else
> +	unsigned long runtime_mask = EFI_PAGE_MASK;
> +#endif
>  	ulong runtime_start = (ulong)&__efi_runtime_start &
> -			      ~(ulong)EFI_PAGE_MASK;
> +			      ~runtime_mask;
>  	int n = memory_map_size / descriptor_size;
>  	int i;
> 
> 
> Alex
> 
Hello Alex,

the patch is lacking the following lines:

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 4f2aa9deda..7523f350eb 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -11,6 +11,7 @@
 #include <elf.h>
 #include <efi_loader.h>
 #include <rtc.h>
+#include <linux/sizes.h>

 /* For manual relocation support */


With your patch and the reference to the include on top of U-Boot HEAD
my Odroid-C2 is able to boot via GRUB EFI into Linux 4.18.20.

So, please, go ahead with you patch.

Your current patches only handle 64KiB alignment for the U-Boot runtime.
Won't we need further patches to align runtime drivers and runtime data
along 64KiB boundaries to comply with the UEFI spec?

Best regards

Heinrich


More information about the U-Boot mailing list