Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a executable hex from elf file format

I am very very new to this, I have elf file input.out and need to create hex executable from it. I am using objcopy to create executable in intel hex format as follows

objcopy -O ihex input.out out.hex

by this out.hex contains data from all sections (.interp, .note.ABI-tag etc), but i am not sure if all of it is required for executable. Is just .text section enough for creating executable hex so can i just use as below or any more sections are required

objcopy -j.text -O ihex input.out out.hex

Also if there any good reference to understand this in detail, I couldn't find much by Goggling. Probably I don't know what to search.

like image 900
DevC Avatar asked Jun 15 '26 07:06

DevC


2 Answers

It could work with

objcopy -O ihex input.elf output.hex
like image 191
Bolor Avatar answered Jun 17 '26 21:06

Bolor


Add the -S will strip useless sections.

like image 36
Zhang Li Avatar answered Jun 17 '26 22:06

Zhang Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!