Optimal wave packets in a boundary layer and initial phases of a turbulent spot