Instanton cosmology and domain walls from M-theory and string theory