Generating repair segments

Change-Id: Iaa1439cb9d6f92c2e17d959c50b57b4b7cabdd14