The process in which the wraps of cell membrane that constitute myelin are laid down around an axon in the central or peripheral nervous system.