  It is shown that the differential form of Friedmann equation of a FRW
universe can be rewritten as a universal form $dE = TdS + WdV$ at apparent
horizon, where $E$ and $V$ are the matter energy and volume inside the apparent
horizon (the energy $E$ is the same as the Misner-Sharp energy in the case of
Einstein general relativity), $W=(\rho-P)/2$ is the work density and $\rho$ and
$P$ are energy density and pressure of the matter in the universe,
respectively. From the thermodynamic identity one can derive that the apparent
horizon has associated entropy $S= A/4G$ and temperature $T = \kappa / 2\pi$ in
Einstein general relativity, where $A$ is the area of apparent horizon and
$\kappa$ is the surface gravity at apparent horizon. We extend our procedure to
the Gauss-Bonnet gravity and more general Lovelock gravity and show that the
differential form of Friedmann equations in these gravities can also be
rewritten to thee universal form $dE = TdS + WdV$ at the apparent horizon with
entropy $S$ being given by expression previously known via black hole
thermodynamics.
