scripts: gen_config.py: support generic device, refactor code, use pathlib
FYI @piotr.kubik: Updated quite a bit. Needs some testing. Please see the note in the Team chat.
FYI @piotr.kubik: Updated quite a bit. Needs some testing. Please see the note in the Team chat.