code cleanup

- split code into multiple source files
- prepare 2ndstage support
- prepare vold tracing - this doesn't work yet but we have a workaround