|
| 1 | +# Memfault Build ID Tool |
| 2 | + |
| 3 | +This package contains the `mflt_build_id` CLI tool. |
| 4 | + |
| 5 | +The purpose of the tool is simplify reading or writing |
| 6 | +[Build IDs](https://interrupt.memfault.com/blog/gnu-build-id-for-firmware) in a |
| 7 | +firmware image irrespective of the compiler or build system being used in a |
| 8 | +project. |
| 9 | + |
| 10 | +## Example Usage |
| 11 | + |
| 12 | +``` |
| 13 | +$ mflt_build_id --help |
| 14 | +usage: mflt_build_id [-h] [--dump [DUMP]] [--crc CRC] [--sha1 SHA1] elf |
| 15 | +
|
| 16 | +Inspects provided ELF for a Build ID and when missing adds one if possible. |
| 17 | +
|
| 18 | +If a pre-existing Build ID is found (either a GNU Build ID or a Memfault Build ID), |
| 19 | +no action is taken. |
| 20 | +
|
| 21 | +If no Build ID is found, this script will generate a unique ID by computing a SHA1 over the |
| 22 | +contents that will be in the final binary. Once computed, the build ID will be "patched" into a |
| 23 | +read-only struct defined in memfault-firmware-sdk/components/core/src/memfault_build_id.c to hold |
| 24 | +the info. |
| 25 | +
|
| 26 | +If the --crc <symbol_holding_crc32> argument is used, instead of populating the Memfault Build ID |
| 27 | +structure, the symbol specified will be updated with a CRC32 computed over the contents that will |
| 28 | +be in the final binary. |
| 29 | +
|
| 30 | +If the --sha1 <symbol_holding_sha> argument is used, instead of populating the Memfault Build ID |
| 31 | +structure, the symbol specified will be updated directly with Memfault SHA1 using the same strategy |
| 32 | +discussed above. The only expectation in this mode is that a global symbol has been defined as follow: |
| 33 | +
|
| 34 | +const uint8_t g_your_symbol_build_id[20] = { 0x1, }; |
| 35 | +
|
| 36 | +For further reading about Build Ids in general see: |
| 37 | + https://mflt.io//symbol-file-build-ids |
| 38 | +
|
| 39 | +positional arguments: |
| 40 | + elf |
| 41 | +
|
| 42 | +options: |
| 43 | + -h, --help show this help message and exit |
| 44 | + --dump [DUMP] |
| 45 | + --crc CRC |
| 46 | + --sha1 SHA1 |
| 47 | +``` |
0 commit comments