Scientists think that the secondary atmosphere came from the many volcanic eruptions which took place in Earth's early history, and which continue today. All volcanoes are different but in general they release gases such as H2O, CO2, SO2, H2S, HCl, N2, NO2. These gases come from the melting of the Earth's crust at subterranian depths. In fact, volcanic activity can be thought of as recycling and replenishing the molecules of the atmosphere. These molecules are not the Nitrogen and Oxygen which are the majority of gases in the air today, however.
The formation of the early ocean played a large part in shaping what gases remained in the atmosphere and what gases were carried into the water, to become dissolved into the ocean and surface reservoirs. Scientists think that the Earth's secondary atmosphere may have come to be dominated by N2 because it alone of all the gases comprising the secondary atmosphere does not readily dissolve in water. Oxygen came into the atmosphere as a waste product from the photosynthetic activity of early life forms after that oxygen had first combined with residual surface iron to produce iron ore (coal).
We will talk more about the changes in Earth's atmosphere later.
This is page 29 of 60