[U-Boot] bootelf and 64 bit elf application

Hi,
I am trying to use bootelf to load a 64-bit elf binary, but it appears to fail. I tried using the hello_world from U-Boot sources as well. My U-Boot is based 2015.01 and I have patches applied for 64elf support, and compiled as a 64 bit U-Boot. Any idea what is need to support bootelf for 64-bit?
<snip> # file hello_world.bin hello_world.bin: ELF 64-bit LSB executable, version 1 (SYSV), statically linked, not stripped
uboot# tftp 0x80300000 tsiddharth/hello_world.bin *****ethHw_checkPortSpeed setting speed: 5 Using bcmiproc_eth-0 device TFTP from server 10.204.96.200; our IP address is 10.216.67.182; sending through gateway 10.216.79.254 Filename 'tsiddharth/hello_world.bin'. Load address: 0x80300000 Loading: ##### 889.6 KiB/s done Bytes transferred = 68336 (10af0 hex) uboot# bootelf -p 0x80300000 <=== I looked at cmd/elf.c and I see that bootelf calls load_elf64_img_phdr() only with ā-pā option. Loading phdr 0 to 0x000000000c100000 (794 bytes) Loading phdr 1 to 0x0000000000000000 (0 bytes) ## Starting application at 0x0c100000 ... "Synchronous Abort" handler, esr 0x86000210 ELR: c100000 LR: fff4197c x0 : 0000000000000002 x1 : 00000000feb3f058 x2 : 0000000000000020 x3 : 0000000000000001 x4 : 0000000000000020 x5 : 00000000015087ba x6 : 00000000ffffffd0 x7 : 0000000000000004 x8 : 0000000000000063 x9 : 000000007af38000 x10: 00000000feaf7678 x11: 00000000fff8c000 x12: 000000000000000f x13: 00000000fffa18c1 x14: 00000000fff99186 x15: 00000000fff99180 x16: 00000000fffa18c1 x17: 00000000fff99175 x18: 00000000feaf7e30 x19: 000000000c100000 x20: 0000000000000000 x21: 00000000feb3f058 x22: 0000000000000002 x23: 0000000000000002 x24: 0000000000000000 x25: 00000000fff912f9 x26: 0000000000000000 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000feaf7b00
Resetting CPU ...
resetting ...
</snip>
Patches applied -
author Bin Meng <bmeng.cn@gmail.commailto:bmeng.cn@gmail.com> Thu, 12 Apr 2018 10:32:14 +0530 (22:02 -0700) commit 839c4e9c5bb09ac1ef2c129c7082a15b9cbd3a8a elf: Add a very simple ELF64 loader This adds a very simple ELF64 loader via program headers, similar to load_elf_image_phdr() that we already have.
author Bin Meng <bmeng.cn@gmail.commailto:bmeng.cn@gmail.com> Thu, 12 Apr 2018 10:32:13 +0530 (22:02 -0700) commit 2bce3f595d224fc620b07449d47fa2b08151a890 elf: Add ELF64 related structure defines This adds ELF header, program header and section header structure defines for the 64-bit ELF image.
Regards
Siddharth

I would like to know an answer to that problem, too. Is the hello.world.bin an ELF file ? What does objdump say ?
Also, the entry address is not the same as the load address, so maybe there is something to do with that...
George
On 2018-08-01 21:06, Siddharth Tuli wrote:
Hi,
I am trying to use bootelf to load a 64-bit elf binary, but it appears to fail. I tried using the hello_world from U-Boot sources as well. My U-Boot is based 2015.01 and I have patches applied for 64elf support, and compiled as a 64 bit U-Boot. Any idea what is need to support bootelf for 64-bit?
<snip> # file hello_world.bin hello_world.bin: ELF 64-bit LSB executable, version 1 (SYSV), statically linked, not stripped
uboot# tftp 0x80300000 tsiddharth/hello_world.bin *****ethHw_checkPortSpeed setting speed: 5 Using bcmiproc_eth-0 device TFTP from server 10.204.96.200; our IP address is 10.216.67.182; sending through gateway 10.216.79.254 Filename 'tsiddharth/hello_world.bin'. Load address: 0x80300000 Loading: ##### 889.6 KiB/s done Bytes transferred = 68336 (10af0 hex) uboot# bootelf -p 0x80300000 <=== I looked at cmd/elf.c and I see that bootelf calls load_elf64_img_phdr() only with ā-pā option. Loading phdr 0 to 0x000000000c100000 (794 bytes) Loading phdr 1 to 0x0000000000000000 (0 bytes) ## Starting application at 0x0c100000 ... "Synchronous Abort" handler, esr 0x86000210 ELR: c100000 LR: fff4197c x0 : 0000000000000002 x1 : 00000000feb3f058 x2 : 0000000000000020 x3 : 0000000000000001 x4 : 0000000000000020 x5 : 00000000015087ba x6 : 00000000ffffffd0 x7 : 0000000000000004 x8 : 0000000000000063 x9 : 000000007af38000 x10: 00000000feaf7678 x11: 00000000fff8c000 x12: 000000000000000f x13: 00000000fffa18c1 x14: 00000000fff99186 x15: 00000000fff99180 x16: 00000000fffa18c1 x17: 00000000fff99175 x18: 00000000feaf7e30 x19: 000000000c100000 x20: 0000000000000000 x21: 00000000feb3f058 x22: 0000000000000002 x23: 0000000000000002 x24: 0000000000000000 x25: 00000000fff912f9 x26: 0000000000000000 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000feaf7b00
Resetting CPU ...
resetting ...
</snip>
Patches applied -
author Bin Meng <bmeng.cn@gmail.commailto:bmeng.cn@gmail.com> Thu, 12 Apr 2018 10:32:14 +0530 (22:02 -0700) commit 839c4e9c5bb09ac1ef2c129c7082a15b9cbd3a8a elf: Add a very simple ELF64 loader This adds a very simple ELF64 loader via program headers, similar to load_elf_image_phdr() that we already have.
author Bin Meng <bmeng.cn@gmail.commailto:bmeng.cn@gmail.com> Thu, 12 Apr 2018 10:32:13 +0530 (22:02 -0700) commit 2bce3f595d224fc620b07449d47fa2b08151a890 elf: Add ELF64 related structure defines This adds ELF header, program header and section header structure defines for the 64-bit ELF image.
Regards
Siddharth _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hi George,
Yes, it is an elf64 binary. o/p of objdump -x is,
hello_world: file format elf64-littleaarch64 hello_world architecture: aarch64, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x000000000c100000
Program Header: LOAD off 0x0000000000010000 vaddr 0x000000000c100000 paddr 0x000000000c100000 align 2**16 filesz 0x000000000000031a memsz 0x000000000000031a flags r-x STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4 filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw- private flags = 0:
Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000290 000000000c100000 000000000c100000 00010000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .rodata 0000008a 000000000c100290 000000000c100290 00010290 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .comment 0000002b 0000000000000000 0000000000000000 0001031a 2**0 CONTENTS, READONLY 3 .debug_aranges 00000070 0000000000000000 0000000000000000 00010345 2**0 CONTENTS, READONLY, DEBUGGING 4 .debug_info 00001808 0000000000000000 0000000000000000 000103b5 2**0 CONTENTS, READONLY, DEBUGGING 5 .debug_abbrev 000003f0 0000000000000000 0000000000000000 00011bbd 2**0 CONTENTS, READONLY, DEBUGGING 6 .debug_line 00000301 0000000000000000 0000000000000000 00011fad 2**0 CONTENTS, READONLY, DEBUGGING 7 .debug_frame 00000090 0000000000000000 0000000000000000 000122b0 2**3 CONTENTS, READONLY, DEBUGGING 8 .debug_str 00000a77 0000000000000000 0000000000000000 00012340 2**0 CONTENTS, READONLY, DEBUGGING 9 .debug_loc 00000178 0000000000000000 0000000000000000 00012db7 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_ranges 00000050 0000000000000000 0000000000000000 00012f2f 2**0 CONTENTS, READONLY, DEBUGGING SYMBOL TABLE: 000000000c100000 l d .text 0000000000000000 .text 000000000c100290 l d .rodata 0000000000000000 .rodata 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges 0000000000000000 l d .debug_info 0000000000000000 .debug_info 0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev 0000000000000000 l d .debug_line 0000000000000000 .debug_line 0000000000000000 l d .debug_frame 0000000000000000 .debug_frame 0000000000000000 l d .debug_str 0000000000000000 .debug_str 0000000000000000 l d .debug_loc 0000000000000000 .debug_loc 0000000000000000 l d .debug_ranges 0000000000000000 .debug_ranges 0000000000000000 l df *ABS* 0000000000000000 hello_world.c 0000000000000000 l df *ABS* 0000000000000000 stubs.c 000000000c100250 g .text 0000000000000000 mdelay 000000000c100244 g .text 0000000000000000 strcpy 000000000c100118 g .text 0000000000000000 printf 000000000c100214 g .text 0000000000000000 spi_release_bus 000000000c100220 g .text 0000000000000000 spi_xfer 000000000c10022c g .text 0000000000000000 ustrtoul 000000000c100238 g .text 0000000000000000 ustrtoull 000000000c1001b4 g .text 0000000000000000 simple_strtol 000000000c1001cc g .text 0000000000000000 i2c_write 000000000c11031a g .rodata 0000000000000000 _bss_end__ 000000000c1000e8 g .text 0000000000000000 getc 000000000c10010c g .text 0000000000000000 puts 000000000c100130 g .text 0000000000000000 free_hdlr 000000000c10013c g .text 0000000000000000 malloc 000000000c1001e4 g .text 0000000000000000 spi_init 000000000c11031a g .rodata 0000000000000000 __bss_start__ 000000000c100160 g .text 0000000000000000 get_timer 000000000c100178 g .text 0000000000000000 do_reset 000000000c1000f4 g .text 0000000000000000 tstc 000000000c10016c g .text 0000000000000000 vprintf 000000000c11031a g .rodata 0000000000000000 __bss_end__ 000000000c100184 g .text 0000000000000000 env_get 000000000c100154 g .text 0000000000000000 udelay 000000000c1001a8 g .text 0000000000000000 strict_strtoul 000000000c100208 g .text 0000000000000000 spi_claim_bus 000000000c11031a g .rodata 0000000000000000 __bss_start 000000000c10025c g .text 0000000000000000 memset 000000000c1001d8 g .text 0000000000000000 i2c_read 000000000c110320 g .rodata 0000000000000000 __end__ 000000000c100100 g .text 0000000000000000 putc 000000000c1001c0 g .text 0000000000000000 strcmp 000000000c100000 g F .text 00000000000000dc hello_world 000000000c100190 g .text 0000000000000000 env_set 000000000c10026c g F .text 0000000000000024 app_startup 000000000c1001f0 g .text 0000000000000000 spi_setup_slave 000000000c100124 g .text 0000000000000000 install_hdlr 000000000c1000dc g F .text 0000000000000190 dummy 000000000c10019c g .text 0000000000000000 simple_strtoul 000000000c11031a g .rodata 0000000000000000 _edata 000000000c110320 g .rodata 0000000000000000 _end 000000000c1000dc g .text 0000000000000000 get_version 000000000c1001fc g .text 0000000000000000 spi_free_slave 000000000c100148 g .text 0000000000000000 free
Regards
Siddharth
-- Sent from: http://u-boot.10912.n7.nabble.com/
participants (2)
-
George Robinson
-
Siddharth Tuli