The oxidation of the terminal amino-methylene groups of peptidyl-L-lysine or peptidyl-5-hydroxy-L-lysine to aldehyde groups to form allysine or hydroxyallysine residues, respectively; these are intermediates in the formation of covalent cross-links between adjacent polypeptide chains in proteins such as collagens.