[Concept] [PATCH 20/21] mkimage: Move the list-or-process code into a function