Booting elf file from uboot in hikey6220

I have an elf64 binary which is about 90MB. I want to load it from uboot using bootelf command. But I could not get the address to load the elf binary. I get synchronous abort exception and board resets. Currently I am trying to load elf using “fatload mmc dev:part address sample.elf; bootelf -p address” . Here what should be the address? I have tried using address which is some SYS_TEXT_OFFSET+uboot.bin which gives exception.

I think first and foremost, we should start with the observation that, as far as I can see, u-boot doesn’t support elf64. However on the assumption you’ve got an out-of-tree patch to add elf64 I can answer the rest.

The choice of address will depend upon what is in the program header of your elf binary. bootelf will copy the image to wherever the program header tells it to… so your choose of address must not overlap with wherever you elf image will be loaded). For a 90MB executable the normal load addresses such as $fdt_addr_r or $ramdisk_addr_r) are likely to overlap with the executable and therefore cannot be used.

So a rule of thumb would be to look at the highest address in the program header (e.g. the highest paddr+size for a loadable segment) and use something slightly higher than that as your temporary address.

Thank u Daniel. I will try the way you suggested and let you know the details.

Hi,

I could not find the required address for loading elf64. Could you please help me get the address which would work. Below are the elf image header details. ELF image is about 90MB.

ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2’s complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0xffffffc000093b80
Start of program headers: 64 (bytes into file)
Start of section headers: 292348 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 5219
Size of section headers: 64 (bytes)
Number of section headers: 3
Section header string table index: 2

Below are DRAM info:

=> bdinfo
arch_number = 0x00000000
boot_params = 0x00000000
DRAM bank = 0x00000000
→ start = 0x00000000
→ size = 0x05E00000
DRAM bank = 0x00000001
→ start = 0x05F00000
→ size = 0x00001000
DRAM bank = 0x00000002
→ start = 0x05F02000
→ size = 0x00EFD000
DRAM bank = 0x00000003
→ start = 0x06E00000
→ size = 0x0060F000
DRAM bank = 0x00000004
→ start = 0x07410000
→ size = 0x1AAF0000
DRAM bank = 0x00000005
→ start = 0x22000000
→ size = 0x1C000000

Thanks,
IVID