参考这个网站:
https://wiki.centos.org/action/show/Sources?action=show&redirect=sources
1. 下载获取源码的脚本
git clone https://git.centos.org/centos-git-common.git
2. 下载源码库
git clone https://git.centos.org/rpms/kernel.git \\(下载时会提示失败,网上搜下错误码,也不确定哪个命令有效了(https://stackoverflow.com/questions/21277806/fatal-early-eof-fatal-index-pack-failed),下完后没有内容,checkout一下有了)
cd kernel
git checkout c7 \\ 切换到你想要的版本,https://git.centos.org/rpms/kernel.git(有相应的branch 和label)
~/bin/get_sources.sh \\ 执行这个代码就会获得相应版本的代码