The sizes of the freshmen class and the sophomore class are in the ratio $5:4$. The sizes of the sophomore class and the junior class are in the ratio $7:8$. The sizes of the junior class and the senior class are in the ratio $9:7$. If these four classes together have a total of $2158$ students, how many of the students are freshmen?
1. Let the number of freshmen be \( f \), sophomores be \( o \), juniors be \( j \), and seniors be \( s \).

2. Given the ratios:
   \[
   \frac{f}{o} = \frac{5}{4} \implies f = \frac{5}{4}o
   \]
   \[
   \frac{o}{j} = \frac{7}{8} \implies o = \frac{7}{8}j \implies j = \frac{8}{7}o
   \]
   \[
   \frac{j}{s} = \frac{9}{7} \implies j = \frac{9}{7}s \implies s = \frac{7}{9}j
   \]

3. Substitute \( j = \frac{8}{7}o \) into \( s = \frac{7}{9}j \):
   \[
   s = \frac{7}{9} \left( \frac{8}{7}o \right) = \frac{7 \cdot 8}{9 \cdot 7}o = \frac{8}{9}o
   \]

4. Now we have all variables in terms of \( o \):
   \[
   f = \frac{5}{4}o, \quad o = o, \quad j = \frac{8}{7}o, \quad s = \frac{8}{9}o
   \]

5. The total number of students is given by:
   \[
   f + o + j + s = 2158
   \]
   Substitute the expressions for \( f, j, \) and \( s \):
   \[
   \frac{5}{4}o + o + \frac{8}{7}o + \frac{8}{9}o = 2158
   \]

6. To simplify, find a common denominator for the fractions. The least common multiple of 4, 7, and 9 is 252:
   \[
   \frac{5}{4}o = \frac{5 \cdot 63}{4 \cdot 63}o = \frac{315}{252}o
   \]
   \[
   o = \frac{252}{252}o
   \]
   \[
   \frac{8}{7}o = \frac{8 \cdot 36}{7 \cdot 36}o = \frac{288}{252}o
   \]
   \[
   \frac{8}{9}o = \frac{8 \cdot 28}{9 \cdot 28}o = \frac{224}{252}o
   \]

7. Combine the fractions:
   \[
   \frac{315}{252}o + \frac{252}{252}o + \frac{288}{252}o + \frac{224}{252}o = 2158
   \]
   \[
   \frac{315 + 252 + 288 + 224}{252}o = 2158
   \]
   \[
   \frac{1079}{252}o = 2158
   \]

8. Solve for \( o \):
   \[
   o = 2158 \times \frac{252}{1079}
   \]
   \[
   o = 504
   \]

9. Now, find \( f \):
   \[
   f = \frac{5}{4}o = \frac{5}{4} \times 504 = 630
   \]

The final answer is \(\boxed{630}\)