  We study ergodic optimization and multifractal behavior of Lyapunov exponents
for matrix cocycles. We show the continuity of the entropy spectrum at the
boundary of Lyapunov spectrum in the sense that $h_{top}(E(\alpha_{t}))\
\rightarrow h_{top}(E(\beta(\mathcal{A}))$ for generic cocycles, where
$E(\alpha)=\{x\in X: \lim_{n\rightarrow \infty}\frac{1}{n}\log
\|\mathcal{A}^{n}(x)\|=\alpha\}$. We also show that the Lyapunov spectrum is
equal to the closure of the set where the entropy spectrum is positive for such
cocycles over mixing subshifts of finite type. Moreover, we prove the
restricted variational principle for such cocycles.
  We prove the continuity of the lower joint spectral radius for general
cocycles under the assumption that linear cocycles satisfy a cone condition.
