Optimal perturbations in boundary-layer flows over rough surfaces