Compiling bin files with variables changed from scripting

I need to generate multiple bin files with each bin file having a unique ID hardcoded into it. I have a JSON file with all the unique IDs in it and can be read in a Python script.

  1. How do I insert those IDs into the firmware?
  2. How can I compile multiple files from the scripting?