Formation of the solar system