Understanding the rolling constraint for one cylinder rolling inside another cylinder

This is the problem to find the equation of motion of 2 cylinders in which 1 cylinder is placed inside another cylinder with larger radius as shown in figure. The condition is that both are rolling. Now, in the figure they say:

The rolling constraint on 2nd cylinder can be written as : $$r_{2} \phi_{2} = r_{1} (\phi_{1}+\theta}$$

(Eqn 2 at last in picture) With symbols as shown in figure below. I want to understand how they come up with this rolling condition(i.e formula).

The $$r_2 \phi_2$$ is simply the length of the red line on the inner cylinder in your picture. That must be equal to the length of the red line on the outer cylinder, since this is the line that the inner cylinder tracked on the inner surface of the outer cylinder. That length is given according to the picture by $$r_1(\phi_1+\theta)$$ since the arc defining the red line is given by $$\phi_1+\theta$$ as can be seen from the picture and $$r_1$$ is the radius of the inner circle of the outer cylinder.