[Concept] [PATCH 02/21] mkimage: Move code from main() to a new function