ar71xx: Move the final image preparations to their own subroutine

By moving the final preparations to their own routine and calling
them in this way, it is ensured that we only try to read the
root.ubi file after it has been created. Furthermore, we can add
a custom routine for the ubifs image, so we can use that to
eventually create a working sysupgrade image.