I think that copying the sections or segments one by one may achieve the goal. For this, you need know the placement of the value inside these sections/segments, change the value according the placement and recreate (just like elfcopy utility) the ELF file.
Alternatively, using ELFIO facilities, you may get properties of the sections/segments and this will permit to determine the value location inside the original ELF file. After that, you may patch the file as usual binary file.
Serge
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not in rocket-sience,
but would appreciate your help!
I need a checksum over my Microcontoller's Code to be generated 'offline' and to be validated 'online'.
The .map-file offers the right address of the expected value, but I do not know, how to patch the expected value into the ELF-file (using ELFIO ;-).
Your samples show how to generate new ELF-files, but not how to duplicate existing files (and apply minimal changes)...
Everey hint would be welcome...
Harry
Hi Harry,
I think that copying the sections or segments one by one may achieve the goal. For this, you need know the placement of the value inside these sections/segments, change the value according the placement and recreate (just like elfcopy utility) the ELF file.
Alternatively, using ELFIO facilities, you may get properties of the sections/segments and this will permit to determine the value location inside the original ELF file. After that, you may patch the file as usual binary file.
Serge