# How to add custom bytes to the image after build?

**URL:** <https://discourse.cmake.org/t/how-to-add-custom-bytes-to-the-image-after-build/10428>\
**Category:** Code\
**Created:** [March 21, 2024, 9:40am UTC](https://discourse.cmake.org/t/how-to-add-custom-bytes-to-the-image-after-build/10428 "2024-03-21T09:40:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcckr](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/e19adc/32.png) [@gcckr](https://discourse.cmake.org/u/gcckr)\
**Post date:** [March 21, 2024, 9:40am UTC](https://discourse.cmake.org/t/how-to-add-custom-bytes-to-the-image-after-build/10428/1 "2024-03-21T09:40:31Z")

</div>

I am new to cmake. I want to add custom bytes to the image file and want to read these bytes in the mcu. There will be two usages, device id and custom checksum. I dont want to change h or c files but I want to add something like during or post build.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [April 10, 2024, 11:45pm UTC](https://discourse.cmake.org/t/how-to-add-custom-bytes-to-the-image-after-build/10428/2 "2024-04-10T23:45:44Z")

</div>

Can you use `install(SCRIPT)` or `install(CODE)` to run custom logic at install time?
