'How to convert ELF file to binary file?

My understanding is that a binary file is the hex-codes of the instructions of the processor (can be loaded into memory & start executing from entry point) and a ELF file is the same with NO-Fixed memory addresses assigned for data etc...

Now, how can I convert ELF to binary?

How the conversion works? I mean how the memory addresses are assigned?

elf


Solution 1:[1]

I came here while searching for "convert .elf into binary file" (with arm files in mind, though).

It turned out that the easiest way in my case was to use

    arm-none-eabi-objcopy -O binary kernel.elf kernel.bin

Solution 2:[2]

I do not understand what do you want to say but ELF(Executable Linkable format) is a new executable format. ofcourse its sections including .text need to be mapped in memory for execution. but if you want to convert ELF into binary check what is the difference between ELF files and bin files. some answers contain information how to change ELF into other binary format

in order to clear how ELF is loaded into memory check http://www.gsp.com/cgi-bin/man.cgi?topic=elf. if you have still some problems come with specific question.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Krischu
Solution 2 Community