How to use mender update modules to deploy firmware on multiple microcontrollers

I have yocto machines connected to mender server.
Now I want to use mender to provide firmware to several different microcontrollers attached to the main CPU.

What is the best way to use update modules for this purpose. All microcontrollers have the same type (so they are flashed with the same linux tool), but they are used for different applications, so they should receive different firmware binaries.

Do I need a separate “update module type” for each microcontroller (e.g. one type for uC-A, another type for uC-B)?

Or is it possible to use the same “update module type” for all? I tried already to use the artifact_name to address the correct microcontroller, but this doesn’t work properly. The artifact_name reported in ${FILES}/current_artifact_nameis not always consistent with the name in the .mender file.

Thanks in advance for any advice.

You can use the same Update Module type for all. Note that ${FILES}/current_artifact_name lists the currently installed artifact. The one you are looking for is ${FILES}/header/artifact_name, which lists the name in the artifact being installed (see this section for more info).

However, I think for robustness purposes I would consider putting the information about which microcontroller the update belongs to, somewhere else. Either an extra payload file in the artifact (mender-artifact -f option), or perhaps in the meta-data (mender-artifact -m option), which is freeform JSON that the Update Module can use for any purpose. Artifact name is, well, exactly that, just a name, and is not meant to carry architecture details.

Many thanks for your fast reply. I can confirm that using ${FILES}/header/artifact_nameis consistent to the .mender file.

But as you said, I will write my target microcontroller into meta-data.