Receptivity of compressible boundary layers to three-dimensional perturbations at the wall is solved with the help of the biorthogonal eigenfunction system. The method allows computation of normal mode amplitudes of the discrete and continuous spectra. Considered examples of boundary layers over a flat plate include periodic-in-time blowing and suction through the wall at free-stream Mach numbers M = 2 and 4.5, and an array of roughness elements at M = 0.5 and 2. Results with the periodic-in-time actuator are compared with earlier results that were obtained by direct numerical integrations in the complex plane of the streamwise wavenumber. The main input into perturbation outside the boundary layer is associated with the fast acoustic waves. Perturbations associated with the entropy and vorticity modes have their maxima at the edge of the boundary layer, and they decay far from the edge (toward the Mach wave). In the case of roughness elements placed on the wall, there are counter-rotating streamwise vortices, a wake region downstream from the hump, and high-speed streaks at both sides of the hump. Temperature perturbation is positive in the wake region and negative on the sides. In the case of a cold wall, there is a low-temperature streak above the wake region that is attributed to displacement of the cold gas by the hump. In the supersonic boundary layer, in addition to the perturbations inside the boundary layer, the perturbations also have relatively large amplitudes in the vicinity of the Mach waves generated by the roughness elements.