Formation of rocks