uname -r #-> 3.10.0-123.el7.x86_64

yum install kernel-devel kernel-headers
cd /tmp
wget http://vault.centos.org/7.0.1406/os/Source/SPackages/kernel-3.10.0-123.el7.src.rpm
# http://vault.centos.org/7.7.1908/os/Source/SPackages/kernel-3.10.0-1062.el7.src.rpm
# http://vault.centos.org/7.2.1511/os/Source/SPackages/kernel-3.10.0-327.el7.src.rpm
rpm -ihv kernel-3.10.0-123.el7.src.rpm
cd ~/rpmbuild/SOURCES
tar Jxvf linux-3.10.0-123.el7.tar.xz -C /usr/src/kernels/
cd /usr/src/kernels/
mv $(uname -r) $(uname -r)-old
mv linux-3.10.0-123.el7 $(uname -r)
cd $(uname -r)
make mrproper
cp ../$(uname -r)-old/Module.symvers ./
cp /boot/config-$(uname -r) ./.config
make oldconfig
make prepare
make scripts
make CONFIG_BLK_DEV_NBD=m M=drivers/block
cp drivers/block/nbd.ko /lib/modules/$(uname -r)/kernel/drivers/block/
depmod -a

常见错误
https://blog.csdn.net/xj178926426/article/details/78028547

文档更新时间: 2020-10-31 00:58   作者:月影鹏鹏