How to convert a memory dump/raw binary image into an ELF file

Joel Sherrill joel@rtems.org
Sun Aug 5 18:52:00 GMT 2018


On Sun, Aug 5, 2018, 1:45 PM A.W.C. via binutils <binutils@sourceware.org>
wrote:

> How to convert a raw MIPS binary file into an .ELF file?
> The binary file is contents of memory region (SPI Flash), converted from
> hex to binary form (.bin) use xxd -r command.
> The Linux 'file' command determines the file type of file.bin as 'data'
> file type.
>

This can be done with objcopy but over the years on the RTEMS project we
found it sometimes painful to get CPU model and endian flags set correctly
that way.

We have a utility called rtems-bin2c that converts a binary file into a C
array. Then you can compile that as you would any other file in the
project. Reliable cross-architecture solution.

It is in rtems-tools at git.rtems.org.

--joel

>
>
>
>
>
>  Regards,
>  Alex
>
>



More information about the Binutils mailing list