romfs: check the dirent before use it

System will crash when the romfs is erased. Add checks before using them
to avoid it.
romfs: rewrite mkromfs.py
Merge pull request #368 from grissiom/romfs-next

Romfs next